Closed
Description
Is this a Bug or Feature request?:
Feature request
Steps to reproduce (preferably a link to a GitHub repo with a repro project):
See comments in aspnet/specs#159 and aspnet/specs#161 about client code generation for services described using OpenAPI. The most specific comments are in the API client generation (C# & TypeScript) section of aspnet/specs#161
Description of the problem:
With a focus on MSBuild integration, build one or more wrappers for tools that can generate client code for a service described using OpenAPI. This includes:
- OpenAPI document available at a URI
- OpenAPI document available in a file on disk
- This may be treated as a derivative case of URIs. Could also require some special-casing. For example, though not required initially, we may eventually want to refresh clients in a running application when the OpenAPI document changes i.e. file watching / cache flushes similar to how we handle .cshtml file changes at runtime.
- Project-to-project references that indicate the "other" project can provide an OpenAPI document
- Most general case i.e. something independent of how that document is produced may be a way to start a project, use a described URI to download the OpenAPI document, then generate a client for that document.
- As mentioned in aspnet/specs#161, an "inside man" approach may also be useful when tighter integration with whatever generates the OpenAPI document may be helpful.
Code generation itself
To the extent possible, will outsource the exact OpenAPI to C# or TypeScript conversion. This interface is likely to be behind a small MSBuild Task
that can be easily overridden or a set of properties that control the exact Exec
task used to perform code generation.
Inspirations to investigate
- https://github.com/aspnet/scaffolding
- Scaffolding provides a relatively simple approach for wrapping very different code generators into a common command-line UI. Though the lower (Razor-based) code generators are likely to be irrelevant, this high-level integration may provide an intuitive CLI for our users. Likely not needed until we're done providing MSBuild itegration.
- Add Service Reference
- What artifacts remain in the project after a service reference is added? Can we reuse some of these artifacts for generator-to-project and generator-to-URI integration?
-
<Compile>
and<EmbeddedResource>
links- Can we reuse some of these artifacts and their specific metadata for generator-to-project and generator-to-URI integration?
- If we decide to do something completely different on one side or the other, what inspiration can we take from the
<Compile>
and<EmbeddedResource>
linkage approach