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

Bug: improperly decoded JSON pointer characters #1430

Closed
fireproofsocks opened this issue Jul 28, 2017 · 2 comments
Closed

Bug: improperly decoded JSON pointer characters #1430

fireproofsocks opened this issue Jul 28, 2017 · 2 comments

Comments

@fireproofsocks
Copy link

I believe I have I ran into a bug when defining some circular references. Here is my schema (simplified):

{
  "paths":
    "/api/menus/{id}" : {
      "get": {
        "responses": {
           "200": {
              "schema": {
                  "type": "object",
                  "description": "Bundle successfully added my schema object here!"
                  ... etc...
              }
           }
        }
      }
    },
    "/api/menus/{id}/tree": {
       "get": {
          "responses": {
             "200": {
                 "description": "OK",
                 "schema": {
                    "$ref": "#/paths/~1api~1menus~1%7Bid%7D/get/responses/200/schema"
                  }
             }
           }
       }
    }
}

When I paste it into the Swagger editor, I get an error on this line:

    "$ref": "#/paths/~1api~1menus~1%7Bid%7D/get/responses/200/schema"

If I manually replace the %7B and %7D to { and } respectively, the error goes away:

    "$ref": "#/paths/~1api~1menus~1{id}/get/responses/200/schema"

I had originally thought this might have been an error with the dereferencer, but after some discussion in its issue tracker, it seems like the error might not be in the encoding of special characters to create the pointer, but in the Swagger Editor's decoding of the characters.

See APIDevTools/json-schema-ref-parser#44

@hkosova
Copy link
Contributor

hkosova commented May 24, 2018

Your example works fine in Swagger Editor 3.5.6, so this seems to have been fixed.

cc @shockey

UPD: This was likely fixed as part of #871 (comment).

json-pointer

@shockey
Copy link
Contributor

shockey commented May 24, 2018

Thanks @hkosova - closing as fixed!

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

3 participants