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

Relative links not handled correct #3347

Closed
mosling opened this issue Jul 12, 2016 · 4 comments
Closed

Relative links not handled correct #3347

mosling opened this issue Jul 12, 2016 · 4 comments

Comments

@mosling
Copy link

mosling commented Jul 12, 2016

Description

Trouble using relative links.

Using a reference: "$ref": "user.json"
Starting swagger-codgen-cli with -i http://localhost:8282/schema/rest/v1/swagger.json

user.json is available under http://localhost:8282/schema/rest/v1/user.json but not found by codegen.

I can't change this notation for relative links because:

  • it's conform to JSON schema
  • I use JsonSchemaValidator to validate json documents and this tool doesn't work with "./user.json"
Swagger-codegen version

2.2.0-SNAPSHOT

Suggest a Fix

It looks that io.swagger.models.refs.GenericRef is wrong. The default case is INTERNAL link.

@wing328
Copy link
Contributor

wing328 commented Jul 13, 2016

Is the issue similar to this one: #1551 ?

@wing328 wing328 added this to the v2.3.0 milestone Jul 13, 2016
@crankydillo
Copy link

Pretty sure this is the same as this swagger-core issue #1730. Even though, I discuss '#' my fundamental problem is the exact same (i.e. json-schema-validator not liking './').

As an aside, my thinking is that validator library should support './user.json'; however, the treatment of $ref is moderately confusing, so I'm hesitant to claim certainty:)

@fehguy
Copy link
Contributor

fehguy commented Oct 27, 2016

@crankydillo This was just addressed in the swagger-parser project. The ./a.json !== a.json is actually a URI design, and needs to be specially-cased for "reasonable, expected" behavior. See here.

@fehguy
Copy link
Contributor

fehguy commented Oct 27, 2016

This should be fixed by 92af2cf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants