swagger-parser
swagger-parser copied to clipboard
OpenAPI 3.1.0 - $ref with json path with esaping in it throws URISyntaxException
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>