Add support for json mediatype with version#1374
Add support for json mediatype with version#1374obouchet wants to merge 1 commit intooapi-codegen:masterfrom
Conversation
|
Hmm, this is an interesting one - and one I've dealt with at a previous company - because technically this is non-standard behaviour - https://www.iana.org/assignments/media-types/application/json notes that it is not possible to specify a Not completely against it, but thinking that I'd be tempted to do more strict validation (namely via https://gitlab.com/jamietanna/content-negotiation-go/-/blob/main/mediatype.go?ref_type=heads) to make sure it truly is a JSON-compatible thing. |
|
Hi @jamietanna Thanks for the reply. I'm trying to convince people at my job to not use this but it's a hard battle... |
|
Hey @obouchet thanks for this! I've raised #1386 which doesn't go quite as far as I'd initially suggested, but uses the standard library's Would you like me to add you as a |
|
Hi @jamietanna! Thank you so much for this. I like your solution and it's a good step to a full fledge solution if you like to go that far. Thank you again! |
Description
When json media type has a version provided (like
appication/json;version=v1), the generator ignores it and doesn't produce helper structs in response object (very useful for the parsing of the http response into a struct).This PR adds the support for this type of json mediatype definition.