ng-openapi-gen icon indicating copy to clipboard operation
ng-openapi-gen copied to clipboard

Adds option to maintain different media types of one one response type

Open baflo opened this issue 1 year ago • 4 comments

I started to use your project to generate my Angular client, but soon stumbled on the problem described in #183, so I offer an opt-in solution here.

I added the option keepFullResponseMediaType, where one can choose which media type should be shortened to $Json or which should be kept in whole.

Specifically, when true, the expected response type in the request method names are not abbreviated and all response variants are kept. When array is given, mediaType is expected to be a RegExp string matching the response media type. The first match in the array will decide whether or how to shorten the media type. If no mediaType is given, it will always match.

option value media type variant method name
short application/x-spring-data-compact+json getEntities$Json
tail application/x-spring-data-compact+json getEntities$XSpringDataCompactJson
full application/x-spring-data-compact+json getEntities$ApplicationXSpringDataCompactJson

baflo avatar Jan 19 '24 10:01 baflo

@luisfpg Do you mind reviewing this PR?

baflo avatar Jan 24 '24 09:01 baflo

@luisfpg Do you mind reviewing this PR?

baflo avatar Jun 21 '24 08:06 baflo

I'm sorry, but I'm having basically no time to work on this project. I'll try to give it a go in the next few days, but I can't promise anything.

luisfpg avatar Jun 21 '24 10:06 luisfpg

Thank you for the update :)

baflo avatar Jun 23 '24 09:06 baflo