oneOf support in request body schema for NSwag.Generation.AspNetCore
See original GitHub issueAccording to the checked list item in #945, oneOf
should be supported. Specifically what we need is oneOf
support for requestBody
schemas, as shown in the first example here:
paths:
/pets:
patch:
requestBody:
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Cat'
- $ref: '#/components/schemas/Dog'
We’re having difficulties implementing it, though, as we find no way to decorate our ASP.NET Core code to generate an OpenAPI document with requestBody.content.application/json.schema.oneOf
defined.
Instead, NSwag attempts to generate an OpenAPI document with duplicate path
definitions, causing the following code to be invoked and exception to be thrown:
Ideas and pointers in the right direction would be highly appreciated.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How to support OneOf(OpenApi) in asp.net core WebApi
Is there any way I can support oneOf in asp.net core webapi. Can I support two different schemas in the request body? enter...
Read more >bitbear@icosahedron.website
's NSwag seems to be the best option so far. However, we're currently stuck by the lack of support for `oneOf` in request...
Read more >Get started with NSwag and ASP.NET Core
Learn how to use NSwag to generate documentation and help pages for an ASP.NET Core web API.
Read more >oneOf, anyOf, allOf, not
oneOf. Use the oneOf keyword to ensure the given data is valid against one of the specified schemas. paths: /pets: patch: requestBody: content: ......
Read more >Swashbuckle.AspNetCore
Swagger tooling for APIs built with ASP.NET Core. Generate beautiful API documentation, including a UI to explore and test operations, directly from your ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@NullableInt, as pointed out by @RicoSuter on Twitter let’s discuss whether we can use inheritance to make this work somehow.
@RicoSuter, if we were to fork and implement this ourselves, would you accept a pull request? Also, could you please point us in the right direction on where and how you’d like to see this implemented in the existing source code?