Skip to content

Enhancement/parser resolve responses flag#2127

Merged
micryc merged 2 commits intomasterfrom
enhancement/parser-resolveResponses-flag
Oct 22, 2024
Merged

Enhancement/parser resolve responses flag#2127
micryc merged 2 commits intomasterfrom
enhancement/parser-resolveResponses-flag

Conversation

@micryc
Copy link
Contributor

@micryc micryc commented Oct 16, 2024

Due to unexpected results during parsing OAS with options - resolve and flatten set to true, we decided to create resolveResponses flag, from now responses will not be fully resolved by default with option resolve - true.
If anyone wants to keep previous behaviour needs to use option setResolveResponses(true)

@micryc micryc requested a review from frantuma October 16, 2024 08:30
if(response != null) {
//This part allows parser to put response inline without the resolveFully option set to true
if (response.get$ref() != null) {
//This part allows parser to put response inline within resolveResponses or ResolveFully
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would replace with // This part allows parser to put response inline when resolveResponses = true

see below

//This part allows parser to put response inline without the resolveFully option set to true
if (response.get$ref() != null) {
//This part allows parser to put response inline within resolveResponses or ResolveFully
if (response.get$ref() != null && cache != null && cache.getParseOptions() != null && (cache.getParseOptions().isResolveResponses() || cache.getParseOptions().isResolveFully())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this shouldn't be triggered by resolveFully but only by the flag. It's true that we currently don't process components/responses in ResolveFully as we do for requestBodies, but this should be addressed in separate ticket and logic added to ResolveFully and not here

@micryc micryc requested a review from frantuma October 21, 2024 11:31
@micryc micryc force-pushed the enhancement/parser-resolveResponses-flag branch from d6bed18 to 6bed0f6 Compare October 21, 2024 11:52
@micryc micryc merged commit 0d10a67 into master Oct 22, 2024
@micryc micryc deleted the enhancement/parser-resolveResponses-flag branch October 22, 2024 07:59
hertzsprung pushed a commit to hertzsprung/openapi-generator that referenced this pull request Jul 15, 2025
needed by swagger-parser>=2.1.23, see swagger-api/swagger-parser#2127
hertzsprung added a commit to hertzsprung/openapi-generator that referenced this pull request Jul 16, 2025
needed by swagger-parser>=2.1.23, see swagger-api/swagger-parser#2127
hertzsprung added a commit to hertzsprung/openapi-generator that referenced this pull request Jul 16, 2025
needed by swagger-parser>=2.1.23, see swagger-api/swagger-parser#2127
hertzsprung added a commit to hertzsprung/openapi-generator that referenced this pull request Jul 16, 2025
needed by swagger-parser>=2.1.23, see swagger-api/swagger-parser#2127
wing328 pushed a commit to OpenAPITools/openapi-generator that referenced this pull request Jul 19, 2025
…#21568)

* set resolveResponses=true

needed by swagger-parser>=2.1.23, see swagger-api/swagger-parser#2127

* update samples

---------

Co-authored-by: James Shaw <james.shaw@masabi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants