Open sagikazarmark opened 4 years ago
RFC7807 is an error response specification. It comes with its own Content-Types:
application/problem+json
application/problem+xml
Unfortunately the Content-Type checks does not match these.
I use the generator for generating Go code, the affected lines are https://github.com/OpenAPITools/openapi-generator/blob/af783a8/modules/openapi-generator/src/main/resources/go/client.mustache#L33-L36
But I think other languages might also benefit from this feature.
In the specific case, I'd change the regular expressions to the following:
var ( jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:(?:vnd\.[^;]+\+)|(?:problem\+))?json)`) xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:problem\+)?xml)`) )
I can imagine a better optimized regex, but this one is probably more readable.
Currently I run a post-processor script on the generated code, but it would be nice if it supported the RFC OOTB.
I'm happy to provide a PR to change the above linked code.
Would you accept a PR for the suggested change?
Is your feature request related to a problem? Please describe.
RFC7807 is an error response specification. It comes with its own Content-Types:
application/problem+json
application/problem+xml
Unfortunately the Content-Type checks does not match these.
I use the generator for generating Go code, the affected lines are https://github.com/OpenAPITools/openapi-generator/blob/af783a8/modules/openapi-generator/src/main/resources/go/client.mustache#L33-L36
But I think other languages might also benefit from this feature.
Describe the solution you'd like
In the specific case, I'd change the regular expressions to the following:
I can imagine a better optimized regex, but this one is probably more readable.
Describe alternatives you've considered
Currently I run a post-processor script on the generated code, but it would be nice if it supported the RFC OOTB.
Additional context
I'm happy to provide a PR to change the above linked code.