microsoft-graph-devx-api icon indicating copy to clipboard operation
microsoft-graph-devx-api copied to clipboard

OpenApi - Separate Model Generation and Code Generation for Snippets Generation

Open rkodev opened this issue 3 years ago • 4 comments

Current code generation for OpenAPI Languages need to process the snippet generation and code model for each language and this is done by the independent language generators. This means that a fix for one language on how to parse the snippet model or the object path requires the same fix to be done for all the other languages.

Describe the solution you'd like Updating the code generation process into

1. Snippet / Code Model Generation The "Code Model" will be able to process the snippet given and generate a generic Object Graph representing all the parts of the code model. The code model will not contain any language specific code but will hold all the properties that can be used write the snippet to a specific language code.

2. Language Writing All the languages would use the output of the code model to convert the Object Graph to Code

rkodev avatar May 16 '22 12:05 rkodev

cc @baywet @zengin @nikithauc

rkodev avatar May 16 '22 12:05 rkodev

Thanks for raising this. I know there's a broader reflection happening about Kiota's "documentation" generation capabilities (snippets/markdown for API exploration/mermaid for modeling). I'll defer this to @darrelmiller

baywet avatar May 16 '22 13:05 baywet

I am all for a refactor if it is going to save time in the long run. Please try to have quantify how much time we target to save by this proposal vs. how much estimated time it would take to implement. Part of the acceptance criteria will be not to have any regressions for snippets we are already generating through OpenAPI (Go, PowerShell, TypeScript). A close-enough result should be fine as we haven't fully validated these snippets with Raptor yet.

zengin avatar May 16 '22 17:05 zengin

Having a generic Object Graph will bring in a lot of consistency and optimization with respect to development.

Would paralleling the access to the generic object graph for each language increase the runtime complexity as compared to what we have now?

nikithauc avatar May 17 '22 06:05 nikithauc