如何从https://github.com/microsoftgraph/MSGraph-SDK-Code-Generator转到代码(java)

时间:2018-12-28 20:18:16

标签: java sdk azure-active-directory microsoft-graph

我试图对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 :(得分:0)

我能够重现您的问题,并且您的解决方案中未安装 ApiDoctor.Validation 软件包,因此您收到此错误。
enter image description here

请从Nuget Manager安装此软件包,然后尝试执行您的代码。安装完成后,我可以运行typewriter.exe,而不会出现任何问题。 enter image description here