Skip to content
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

OpenAPI 3.1.0 - $ref with json path with esaping in it throws URISyntaxException #2122

Open
ilya-anodot opened this issue Sep 29, 2024 · 0 comments

Comments

@ilya-anodot
Copy link

I just tried switching my project to OpenAPI 3.1.0 version and found that any $ref with json path with escaping in it fails with

java.net.URISyntaxException: Illegal character in fragment at index 46: ./some_folder/API.json#/paths/~1path-in-json~1"
    at java.net.URI$Parser.fail (URI.java:2976)
    at java.net.URI$Parser.checkChars (URI.java:3147)
    at java.net.URI$Parser.parse (URI.java:3191)
    at java.net.URI.<init> (URI.java:623)
    at io.swagger.v3.parser.reference.ReferenceUtils.toBaseURI (ReferenceUtils.java:15)
    at io.swagger.v3.parser.reference.ReferenceVisitor.toBaseURI (ReferenceVisitor.java:65)
    at io.swagger.v3.parser.reference.ReferenceVisitor.toReference (ReferenceVisitor.java:69)
    at io.swagger.v3.parser.reference.ReferenceVisitor.resolveRef (ReferenceVisitor.java:205)
    at io.swagger.v3.parser.reference.ReferenceVisitor.visitPathItem (ReferenceVisitor.java:108)

My $ref looks like this: "$ref": "./some_folder/API.json#/paths/~1path-in-json~1".
Inside the target file it points to element:

{
   "paths" :{
        "/path-in-json/" : {
            ...
        }     
   }
}

This worked perfectly in version 3.0.3 and stopped working since I tried changing to new version. I'm using

<plugin>
  <groupId>org.openapitools</groupId>
  <openapi-generator-maven-plugin</artifactId>
  <version>7.8.0</version>
</plugin>
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

No branches or pull requests

1 participant