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

swagger-parser doesn't unescape JSON Pointer expressions #289

Closed
jancona opened this issue Aug 19, 2016 · 1 comment
Closed

swagger-parser doesn't unescape JSON Pointer expressions #289

jancona opened this issue Aug 19, 2016 · 1 comment
Milestone

Comments

@jancona
Copy link
Contributor

jancona commented Aug 19, 2016

RFC 6901 requires that when evaluating a JSON pointer expression, the values ~0 and ~1 must be unescaped to ~ and / respectively. swagger-parser doesn't do that, so examples like this don't work:

$ brew info swagger-codegen
swagger-codegen: stable 2.2.0 (bottled), HEAD
Generation of client and server from Swagger definition
http://swagger.io/swagger-codegen/
/usr/local/Cellar/swagger-codegen/2.2.0 (5 files, 14.2M) *
  Poured from bottle on 2016-08-19 at 14:53:05
From: /~https://github.com/Homebrew/homebrew-core/blob/master/Formula/swagger-codegen.rb
==> Dependencies
Build: maven ✔
$ swagger-codegen generate -l java -i https://gist.githubusercontent.com/jancona/5f6e83aa138e61bbc10b0e25dd0d2298/raw/41a0ea6f791aa2779f607e5348dfc5d634097238/main.yaml
[main] INFO io.swagger.parser.Swagger20Parser - reading from https://gist.githubusercontent.com/jancona/5f6e83aa138e61bbc10b0e25dd0d2298/raw/41a0ea6f791aa2779f607e5348dfc5d634097238/main.yaml
Exception in thread "main" java.lang.RuntimeException: Could not find paths/~1foo in contents of ./child.yaml
        at io.swagger.parser.ResolverCache.loadRef(ResolverCache.java:115)
        at io.swagger.parser.processors.PathsProcessor.processPaths(PathsProcessor.java:72)
        at io.swagger.parser.SwaggerResolver.resolve(SwaggerResolver.java:40)
        at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:66)
        at io.swagger.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:390)
        at io.swagger.codegen.cmd.Generate.run(Generate.java:221)
        at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:36)
$ 
$ swagger -V
1.0.0-beta.2
$ swagger validate https://gist.githubusercontent.com/jancona/5f6e83aa138e61bbc10b0e25dd0d2298/raw/41a0ea6f791aa2779f607e5348dfc5d634097238/main.yaml
https://gist.githubusercontent.com/jancona/5f6e83aa138e61bbc10b0e25dd0d2298/raw/41a0ea6f791aa2779f607e5348dfc5d634097238/main.yaml is valid
@jancona
Copy link
Contributor Author

jancona commented Sep 27, 2016

This was fixed by #295. Are there any plans for a swagger-parser release?

fehguy added a commit that referenced this issue Oct 27, 2016
@fehguy fehguy mentioned this issue Oct 27, 2016
fehguy added a commit that referenced this issue Oct 27, 2016
@fehguy fehguy closed this as completed Oct 27, 2016
@fehguy fehguy modified the milestone: v1.0.23 Oct 28, 2016
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

2 participants