Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Epic: Support OpenApi 3 #945

Open
9 of 15 tasks
RicoSuter opened this issue Sep 13, 2017 · 15 comments
Open
9 of 15 tasks

Epic: Support OpenApi 3 #945

RicoSuter opened this issue Sep 13, 2017 · 15 comments

Comments

@RicoSuter
Copy link
Owner

RicoSuter commented Sep 13, 2017

Documentation in the wiki

Specification:

Changes:

Tasks:

Open questions:

@stijnherreman
Copy link
Contributor

Is it possible to help you with this? I'm particularly interested in the new (or improved?) multipart support described in the spec, it'll allow adding API methods that take multipart/mixed content.

@RicoSuter
Copy link
Owner Author

RicoSuter commented Nov 24, 2017

Hi @stijnherreman, yes, I'd really appreciate it!

I think the first step is to find a way to enhance the model (NSwag.Core) so that both versions (2/3) can be serialized/deserialized from a single set of model classes (see updated issue). There are properties which have to be renamed or ignored depending on the spec version - for this we have a custom contract resolver (see https://blog.rsuter.com/advanced-newtonsoft-json-dynamically-rename-or-ignore-properties-without-changing-the-serialized-class/).

I'm not sure yet, how we can maintain both versions in a single set of model classes (inheritance, only ignore/rename properties, property prefix?).

I think we should start with the simpler thinks, like the new server specification (these are just new properties on SwaggerDocument, https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#serverObject). Then we can look into the new response handling, schema changes, etc...

@daniel-gwilt-software
Copy link

#1091

@RicoSuter
Copy link
Owner Author

Most recent commits for enhancing the model for OpenApi 3:

3e22a08
1eebd6a
8dfa231
aa3d161
ef1d3d1

@RicoSuter
Copy link
Owner Author

RicoSuter commented Mar 16, 2018

Most unit tests for the OpenApi 3 serialization are here: https://github.com/RSuter/NSwag/tree/master/src/NSwag.Core.Tests/Serialization

If someone (@stijnherreman ?) wants to help, we need more unit tests, some OpenApi 3 properties are still missing, etc...

The main idea is to add all properties from Swagger and OpenApi and then based on the target, ignore/hide or rename some properties. The Swagger properties which have an OpenApi equivalent should just be derived properties and update/read the OpenApi properties when being accessed... (see SwaggerDocument.Serialization.cs - there are also the renames/ignores)

@RicoSuter
Copy link
Owner Author

RicoSuter commented Mar 16, 2018

The specs can be found here:

https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md

most properties of OpenApi are implemented, what currently is missing (and which are the hardest one to sync):

  • Operation.requestBody: Operation.parameters.bodyParameter (Swagger) should sync with Operation.requestBody (OpenApi) (hard to implement with change tracking etc.)
  • Response.content: Response.schema (Swagger) should sync with Response.content (OpenApi) (easier to implement)

RicoSuter added a commit to RicoSuter/NJsonSchema that referenced this issue Mar 16, 2018
@RicoSuter
Copy link
Owner Author

For proper inheritance support we also need:

@RicoSuter
Copy link
Owner Author

Ref ea63ef2

@stijnherreman
Copy link
Contributor

Due to priority changes in our project I won't be able to spend time on this for now, unfortunately. Perhaps in a couple months, if help is still needed.

@RicoSuter
Copy link
Owner Author

@stijnherreman I then, I think help will also be needed in a couple of months :-)

@RicoSuter
Copy link
Owner Author

RicoSuter commented May 15, 2018

Some sample Swagger 2.0 and OpenAPI 3.0 specifications can be compared here: https://github.com/RSuter/NSwag/tree/master/src/NSwag.Sample.NETCore20/Output

To update, just start the sample app and run Update-SwaggerSpecs.ps1.

@RicoSuter
Copy link
Owner Author

RicoSuter commented Jun 21, 2018

PR to add explode and parameter style: #1342

@themultiplexer
Copy link

I guess a very small adjustment needs to be done to the open-api version number:

image

Currently it is only 3.0.

@foscjos2
Copy link

I notice that this epic is still open and has some uncompleted tasks - is OAPI 3.0 fully supported in this library?

@rshettybr
Copy link

Is this usable to upgrade to Open API 3 standard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants