Как перейти от https://github.com/microsoftgraph/MSGraph-SDK-Code-Generator к коду (Java) - PullRequest
0 голосов
/ 28 декабря 2018

Я пытаюсь внести изменения в шаблоны Java и построить код Java на основе этого шаблона.

  1. построил решение для пишущей машинки в vs2017
  2. клонировал https://github.com/microsoftgraph/microsoft-graph-docs
  3. локально сохранил содержимое https://graph.microsoft.com/v1.0/$metadata (инструкции по использованию пишущей машинки не так уж хороши, он говорит, что выше по умолчанию, но также говорит, что это обязательное значение для ключа -m, поэтому какойэто, имеет ли это значение по умолчанию или это требуется?)
  4. запущен с выпуска .\typewriter.exe -v Info -m C:\Users\Administrator\source\repos\v1.0.12.28.2018.xml -o output -l Java -d C:\Users\Administrator\source\repos\microsoft-graph-docs -g Full

C:\Users\Administrator\source\repos\MSGraph-SDK-Code-Generator\src\Typewriter\bin\Release>.\typewriter.exe -v Info -m C:\Users\Administrator\source\repos\v1.0.12.28.2018.xml -o output -l Java -d C:\Users\Administrator\source\repos\microsoft-graph-docs -g Full
12:02:43 MetadataResolver Loading metadata from C:\Users\Administrator\source\repos\v1.0.12.28.2018.xml.
12:02:43 MetadataPreprocessor RemoveCapabilityAnnotations rule was applied so that capability annotations are removed from the metadata.
12:02:43 MetadataPreprocessor AddLongDescriptionToThumbnail rule was applied to the thumbnail complex type.
12:02:43 MetadataPreprocessor RemoveHasStream rule was applied so that we removed the HasStream attribute from the onenotePage entityType.
12:02:43 MetadataPreprocessor RemoveHasStream rule was applied so that we removed the HasStream attribute from the onenoteResource entityType.
12:02:43 MetadataPreprocessor AddContainsTarget rule applied so that ContainsTarget=true was set on the plannerPlan entity's buckets navigation property.
12:02:43 MetadataPreprocessor AddContainsTarget rule applied so that ContainsTarget=true was set on the plannerUser entity's tasks navigation property.
12:02:43 MetadataPreprocessor AddContainsTarget rule applied so that ContainsTarget=true was set on the plannerPlan entity's tasks navigation property.
12:02:43 MetadataPreprocessor AddContainsTarget rule applied so that ContainsTarget=true was set on the plannerBucket entity's tasks navigation property.
12:02:43 MetadataPreprocessor AddContainsTarget rule applied so that ContainsTarget=true was set on the plannerGroup entity's plans navigation property.
12:02:43 MetadataPreprocessor AddContainsTarget rule applied so that ContainsTarget=true was set on the plannerUser entity's plans navigation property.
12:02:43 MetadataPreprocessor AddContainsTarget rule was not applied. No entity type named plannerDelta found with missing navigation property containment.
12:02:43 FileWriter Metadata written to C:\Users\Administrator\source\repos\MSGraph-SDK-Code-Generator\src\Typewriter\bin\Release\cleanMetadata.xml
12:02:43 AnnotationHelper Opening documentation from C:\Users\Administrator\source\repos\microsoft-graph-docs
Using API requirements file: C:\Users\Administrator\source\repos\microsoft-graph-docs\api-reference\v1.0\config\oneapi-design-v1.json
Using schema config file: C:\Users\Administrator\source\repos\microsoft-graph-docs\api-reference\v1.0\config\schema-config.json
Using table definitions from: C:\Users\Administrator\source\repos\microsoft-graph-docs\api-reference\v1.0\config\table-header-config.json
12:02:43 AnnotationHelper Parsing documentation files

Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at ApiDoctor.Validation.ExtensionMethods.ParseParameterDataType(String value, Boolean isCollection, Action`1 addErrorAction, ParameterDataType defaultValue)
   at ApiDoctor.Validation.TableSpec.TableSpecConverter.<>c__DisplayClass6_0.<ParseParameterTable>b__0(String[] r)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at ApiDoctor.Validation.TableSpec.TableSpecConverter.ParseParameterTable(IMarkdownTable table, ParameterLocation location, TableDecoder decoder, IssueLogger issues, Boolean navigationProperties)
   at ApiDoctor.Validation.TableSpec.TableSpecConverter.ParseTableSpec(Block tableSpecBlock, Stack`1 headerStack, IssueLogger issues)
   at ApiDoctor.Validation.DocFile.ParseMarkdownBlocks(IssueLogger issues)
   at ApiDoctor.Validation.DocFile.Scan(String tags, IssueLogger issues)
   at ApiDoctor.Validation.DocSet.ScanDocumentation(String tags, IssueLogger issues)
   at Typewriter.AnnotationHelper.GetDocSet(Options options, IssueLogger issues) in C:\Users\Administrator\source\repos\MSGraph-SDK-Code-Generator\src\Typewriter\DocAnnotationWriter.cs:line 128
   at Typewriter.AnnotationHelper.<ApplyAnnotationsToCsdl>d__2.MoveNext() in C:\Users\Administrator\source\repos\MSGraph-SDK-Code-Generator\src\Typewriter\DocAnnotationWriter.cs:line 88
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Typewriter.Generator.CleanMetadata(String csdlContents, Options options) in C:\Users\Administrator\source\repos\MSGraph-SDK-Code-Generator\src\Typewriter\Generator.cs:line 53
   at Typewriter.Program.GenerateSDK(Options options) in C:\Users\Administrator\source\repos\MSGraph-SDK-Code-Generator\src\Typewriter\Program.cs:line 44
   at Typewriter.Program.<>c.<Main>b__2_0(Options opts) in C:\Users\Administrator\source\repos\MSGraph-SDK-Code-Generator\src\Typewriter\Program.cs:line 21
   at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
   at Typewriter.Program.Main(String[] args) in C:\Users\Administrator\source\repos\MSGraph-SDK-Code-Generator\src\Typewriter\Program.cs:line 20

C:\Users\Administrator\source\repos\MSGraph-SDK-Code-Generator\src\Typewriter\bin\Release>

1 Ответ

0 голосов
/ 05 января 2019

Я могу воспроизвести вашу проблему, и вы получаете эту ошибку, так как пакет ApiDoctor.Validation не установлен в вашем решении.
enter image description here

Пожалуйста, установите этот пакет из Nuget Manager и попробуйте выполнить ваш код.После установки я могу запустить typewriter.exe без проблем.enter image description here

...