-
Notifications
You must be signed in to change notification settings - Fork 537
fix and test for issue 1758 #1760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/OpenAPIDeserializer.java
Outdated
Show resolved
Hide resolved
modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/OpenAPIDeserializer.java
Outdated
Show resolved
Hide resolved
|
@ponelat @frantuma I addressed the comments, and also did the validation in deserializer of examples, and securitySchemes, but not 100% sure it applies here. |
|
@gracekarina Here is an example of using openapi: 3.0.3
info:
title: $ref of an "Example".
version: 1.0.0
paths:
/foo:
get:
description: ok
responses:
'200':
description: ok
content:
application/json:
schema:
type: object
examples:
one:
$ref: '#/components/examples/Ex'
components:
examples:
Ex:
summary: The value one.
value:
one: '1' |
frantuma
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gracekarina couple of minor comments, when addressed please merge
| pathItem.set$ref(ref.textValue()); | ||
| } | ||
| if(ref.textValue().startsWith("#/components") && !(ref.textValue().startsWith("#/components/pathItems"))) { | ||
| result.warning(location, "$ref target "+ref.textValue() +" is not of expected type"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would detail what is the expected type, like "$ref target "+ref.textValue() +" is not of expected type pathItem");. Same applies to similar code below
| }else { | ||
| parameter.set$ref(ref.textValue()); | ||
| } | ||
| if(ref.textValue().startsWith("#/components") && !(ref.textValue().startsWith("#/components/parameters")||ref.textValue().startsWith("#/components/headers"))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cdoe style, would replace meters")||ref.textVal with meters") || ref.textVal
| } else { | ||
| header.set$ref(ref.textValue()); | ||
| } | ||
| if(ref.textValue().startsWith("#/components") && !(ref.textValue().startsWith("#/components/parameters")||ref.textValue().startsWith("#/components/headers"))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cdoe style, would replace meters")||ref.textVal with meters") || ref.textVal
Fix and test for issue #1758.
Adds a validation message for parameters and headers when ref field in internal references are not being pointed at the right components tag.