Ask a Question

generating and updating open api from code

osher
New Contributor

generating and updating open api from code

I'm a technical writer documenting my first API. 

Every time the API is updated, our developer generates an Open API using C# and I upload it to Stoplight and add descriptions.

The issue is that I want to create references for all the parameters ($ref), but the file that the developer outputs from the code does not reference parameters, it repeats the full description of each parameter each time it is used in an endpoint.

If I use updated file for the documentation, it will overwrite the references.

 

Is there a tool to generate the Open API from the code that will create and preserve referenced parameters?

 

3 REPLIES 3
ponelat
Staff

Hi @osher 

I'm not sure what code library your team uses (in C#) to generate the definition. Could you perhaps find out, and perhaps there are some options in that to help your problem of inlined-parameters. 

 

We know such options exist for languages like Java, so hopefully C# will be the same.

osher
New Contributor

Hi @ponelat 

They use asp.net core to generate the Open API file from the code.

 

ponelat
Staff

hi @osher there appear to be two popular libs for generating OpenAPI from ASP.net code... https://github.com/RicoSuter/NSwag and https://github.com/domaindrivendev/Swashbuckle.AspNetCore. See which of the two your team uses, and look at the options they provide to help your case.

 

cancel
Showing results for 
Search instead for 
Did you mean: