Request body standardization with multiple content types accepted
See original GitHub issueI use Autorest and the ModelerFour plugin to generate resource types for the Azure Bicep project. ModelerFour has not been able to process some ARM swagger documents since https://github.com/Azure/autorest/pull/4405; specifically, resources under the Microsoft.Web
namespace can no longer be generated because the ARM resource provider can consume the same object structure as either JSON or form data.
Should ModelerFour permit requests with the same structured input over two different content types? I saw that there is a special case to allow operations to consume both XML and JSON but was wondering if a more general solution would be possible.
Before asking the question:
- have you checked the faq, the documentation in the docs folder and couldn’t find the information there
- have you checked existing issues for a similar question?
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Describing Request Body - Swagger
The requestBody is more flexible in that it lets you consume different media types, such as JSON, XML, form data, plain text, and...
Read more >Does the HTTP Protocol support multiple content types in ...
No. As pointed out in the accepted answer, the header value itself does not allow for multiple values, and ...
Read more >4 The Content-Type Header Field
The Content-Type header field is used to specify the nature of the data in the body of an entity, by giving type and...
Read more >RFC 7231: Hypertext Transfer Protocol (HTTP/1.1)
This document defines the semantics of HTTP/1.1 messages, as expressed by request methods, request header fields, response status codes, and response header ...
Read more >4. Metadata Design - REST API Design Rulebook [Book]
The Content-Type header names the type of data found within a request or response message’s body. The value of this header is a...
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 FreeTop 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
Top GitHub Comments
It is possible in openapi3 to do, what it means here is that the payload schema is the same but it can be serialized as json or formData. I was just asking on what was m4 behavior before if you know, was it just ignoring the formData type and acting like this was just application/json. As far as I know the generators don’t support different serializion types for the same schema which is why this check is there complaining but we could have the same special case as with xml where if json is specified it takes precendence
It does! Thanks for the quick work on this.