feat(gen client): added support to work with multiple mimes #3042
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix: no longer sort producers and consumers
The client runtime picks the first one, so the order is relevant.
feat: added extra options to set media type
For client codegen only, AND whenever a single group of operations
deals with more than one media for producers OR more than one media
for consumers , THEN we generate an extra set of convenience ClientOption
functions to switch media type.
Generates generic options to set the mime as an arbitrary string
(comes in handy to set mime extensions):
WithContentType(string) (to negotiate consumers)
WithAccept(string) (to negotiate producers)
Generate shorthands with a mangled name such as:
WithContentTypeApplicationxWwwFormUrlencoded
to be used directly as an option.
Simple APIs with a single producer and a single consumer are not
affected.
Server codegen is not affected
test: content type is not sorted
test: asserted codegen
Signed-off-by: Frédéric BIDON fredbi@yahoo.com