microsoftgraph/MSGraph-SDK-Code-Generator

SDK Generation Failing Since Child Namespace is Defined Before Parent Namespace in Staging Beta Metadata

fey101 opened this issue · 0 comments

The root cause is actually traced to Vipr.Reader.OData.v4.OdcmReader.ReaderDaemon.WriteNamespaces() method where ordering of namespaces in such a way that the child namespace appears before the parent namespace prevents correct evaluation of KeyProperty 'Id' of the EntityType "lifecycleWorkflowsContainer during generation of its OdcmModel.

The issue is already submitted on the Vipr repo here: microsoft/Vipr#254

Suggested Fix: Either reorder namespaces in the metadata preprocessing step so that the parent namespaces always appear before the child namespaces or incorporate the reordering logic within Vipr.

Error details:

Running Typewriter...
03:05:57 Typewriter Typewriter is running with the following arguments: 
  -v Info -m /mnt/vss/_work/1/s/metadata/clean_metadata.xml -o /mnt/vss/_work/1/s/output -g Files
03:05:57 MetadataResolver Loading metadata from /mnt/vss/_work/1/s/metadata/clean_metadata.xml.
03:05:57 OdcmReader Generating OdcmModel
Unhandled exception. System.InvalidOperationException: Operation is not valid due to the current state of the object.
   at Vipr.Reader.OData.v4.OdcmReader.ReaderDaemon.WriteNamespaceDeep(IEdmModel edmModel, String namespace) in /mnt/vss/_work/1/s/MSGraph-SDK-Code-Generator/submodules/vipr/src/Readers/Vipr.Reader.OData.v4/OdcmReader.cs:line 342
   at Vipr.Reader.OData.v4.OdcmReader.ReaderDaemon.WriteNamespaces() in /mnt/vss/_work/1/s/MSGraph-SDK-Code-Generator/submodules/vipr/src/Readers/Vipr.Reader.OData.v4/OdcmReader.cs:line 200
   at Vipr.Reader.OData.v4.OdcmReader.ReaderDaemon.GenerateOdcmModel(IEnumerable`1 serviceMetadata) in /mnt/vss/_work/1/s/MSGraph-SDK-Code-Generator/submodules/vipr/src/Readers/Vipr.Reader.OData.v4/OdcmReader.cs:line 116
   at Vipr.Reader.OData.v4.OdcmReader.GenerateOdcmModel(IEnumerable`1 serviceMetadata) in /mnt/vss/_work/1/s/MSGraph-SDK-Code-Generator/submodules/vipr/src/Readers/Vipr.Reader.OData.v4/OdcmReader.cs:line 67
   at Typewriter.Generator.MetadataToClientSource(String edmxString, String targetLanguage, IEnumerable`1 properties, String endpointVersion) in /mnt/vss/_work/1/s/MSGraph-SDK-Code-Generator/src/Typewriter/Generator.cs:line 166
   at Typewriter.Generator.GenerateFiles(String csdlContents, Options options) in /mnt/vss/_work/1/s/MSGraph-SDK-Code-Generator/src/Typewriter/Generator.cs:line 29
   at Typewriter.Program.GenerateSDK(Options options, String[] args) in /mnt/vss/_work/1/s/MSGraph-SDK-Code-Generator/src/Typewriter/Program.cs:line 35
   at Typewriter.Program.<>c__DisplayClass2_0.<Main>b__0(Options opts) in /mnt/vss/_work/1/s/MSGraph-SDK-Code-Generator/src/Typewriter/Program.cs:line 18
   at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
   at Typewriter.Program.Main(String[] args) in /mnt/vss/_work/1/s/MSGraph-SDK-Code-Generator/src/Typewriter/Program.cs:line 17

Related raptor pipeline https://microsoftgraph.visualstudio.com/Graph%20Developer%20Experiences/_build/results?buildId=83638&view=logs&j=12f1170f-54f2-53f3-20dd-22fc7dff55f9&t=d1e88c09-dceb-53c1-5579-19c846f3526a.