Semantic error at definitions.Response«Page«EnterpriseProfile»».properties.payLoad.$ref $ref values must be RFC3986-compliant percent-encoded URIs in swagger editor
See original GitHub issueTill yesturday(5/22/2018) it was working fine.
now i am getting this error Semantic error at definitions.Response«Page«AppServerProfile»».properties.payLoad.$ref $ref values must be RFC3986-compliant percent-encoded URIs
can u help me. how to resolve this issue.
example yaml:
- in: body
name: appServerProfile
description: appServerProfile
required: true
schema:
$ref: '#/definitions/AppServerProfile'
responses:
'200':
description: App Server Profile modified Successfully
schema:
**$ref: '#/definitions/Response«AppServerProfile»'**// here i am getting this errror
'201':
description: Created
thanks
Q&A (please complete the following information)
- OS: [e.g. macOS]
- Browser: [e.g. chrome, safari]
- Version: [e.g. 22]
- Method of installation: [e.g. npm, dist assets]
- Swagger-Editor version: [e.g. 3.10.0]
- Swagger/OpenAPI version: [e.g. Swagger 2.0, OpenAPI 3.0]
Content & configuration
Example Swagger/OpenAPI definition:
# your YAML here
Swagger-Editor configuration options:
SwaggerEditor({
// your config options here
})
?yourQueryStringConfig
Describe the bug you’re encountering
To reproduce…
Steps to reproduce the behavior:
- Go to ‘…’
- Click on ‘…’
- Scroll down to ‘…’
- See error
Expected behavior
Screenshots
Additional context or thoughts
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
$ref values must be RFC3986-compliant percent-encoded ...
Issue is when I do use URL encoding, swagger is unable to recognize UpdateTestCustomerResponse reference(error is missing reference) and ...
Read more >UISP Swagger 2.0 API Not Validating
user.get.responses.200.schema should NOT have additional properties ... ref $ref values must be RFC3986-compliant percent-encoded URIs Jump to line 6719 ...
Read more >$ref values must be RFC3986-compliant percent-encoded ...
Hi team,. First, thanks for this amazing tool... Recently, we started the validation process of our APIs (version 2.0) using Swagger-Hub ...
Read more >Generated Swagger.json Does Not Validate with ...
A OpenAPI-standards-compliant file is generated. No errors or warnings appear in the Swagger editor. The Swagger Editor generates code samples ...
Read more >Parameters cannot have both a "in: body" and "in: formData ...
I'm using 5.1.0 to generate our API. A customer has tried to import the resulting openapi.json file into Swagger Editor and has come...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@karunchinna The error is valid.
#/foo/bar
is a JSON Pointer, and according to the JSON Pointer Specification, special characters in key names must be percent-encoded when a JSON Pointer is used as an URL fragment[1] (as is the case with $refs). So you need to replacewith
By the way, if you will be migrating to OpenAPI 3.0, keep in mind that it only allows the characters
a-z A-Z 0-9 . - _
in component names. SoResponse«AppServerProfile»
is not a valid model name in OpenAPI 3.0.[1] JSON Pointer Specification, section 6 (emphasis mine):
RFC3986, section 3.5:
where
and ALPHA = A-Z a-z, DIGIT = 0-9.
The characters
«
and»
do not belong to the unreserved set, so they must be percent-encoded when used after the#
character in URLs.@shockey @hkosova Also, if you make the recommended escaping change to the $ref values (in my case [ and ] to %5B and %5D respectively), you end up with broken client-side - and presumably, server-side - generated code:
This is because the generator removes the % but not the rest of the escape code: %5B -> 5B, %5D -> 5D, etc.
So, essentially, it’s now impossible to use Swagger Editor to generate - at least - C# client-side code and probably most of the rest of the code types.
Excellent, well-done!