-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Incorrectly parsed reference fails to resolve #395
Comments
Hey @bartfeenstra 🙌 ! |
Hi Roman! Those URLs are proxies for external/third-party JSON schemas. You can base64-decode the last URL path component to see the real schema ID being requested. Or, to reproduce this locally, run the following command in a terminal: This command will not exit, but will idle after starting a web server and wait for you to quit the command. Before quitting, go to http://127.0.0.1:5000/about/openapi to see ReDoc in action. I guess the easiest way to inspect exactly what HTTP responses ReDoc gets back, is to monitor the web page's network traffic through your browser's debugging/inspection tool when visiting the ReDoc page. Once you are done and want to get rid of the application, you can remove the entire cloned Git repo. All of my application's dependencies will be installed locally, and no trace will remain. If you had to install a specific Python version or Virtualenv yourself, those will remain on your system, but they are generic Python tools and not specific to anything in this issue. You may remove those through the same package manager you used to install them, if you'd like. Please let me know if there is any other information I can provide :) Thanks! |
Note that the branch I originally documented in my previous comment was merged into |
Now it no longer errors out as it did originally, but it just seems to get stuck in a loop, resulting in my laptop sounding like it's trying to take off on its fan alone 😁 |
I managed to run ReDoc locally using its dev server, allowing me to debug the code through my browser (I learned a thing!). As it turns out,
I logged the pointers as the schema walker traversed the data:
where {
"id":"http://127.0.0.1:5000/about/json/external-schema/aHR0cDovL2pzb24tc2NoZW1hLm9yZy9kcmFmdC0wNC9zY2hlbWE%3D",
"$schema":"http://127.0.0.1:5000/about/json/external-schema/aHR0cDovL2pzb24tc2NoZW1hLm9yZy9kcmFmdC0wNC9zY2hlbWE%3D",
"description":"Core schema meta-schema",
"definitions":{
"schemaArray":{
"type":"array",
"minItems":1,
"items":{
"$ref":"#"
}
},
"positiveInteger":{
"type":"integer",
"minimum":0
},
"positiveIntegerDefault0":{
"allOf":[
{
"$ref":"#/definitions/positiveInteger"
},
{
"default":0
}
]
},
"simpleTypes":{
"enum":[
"array",
"boolean",
"integer",
"null",
"number",
"object",
"string"
]
},
"stringArray":{
"type":"array",
"items":{
"type":"string"
},
"minItems":1,
"uniqueItems":true
}
},
"type":"object",
"properties":{
"id":{
"type":"string",
"format":"uri"
},
"$schema":{
"type":"string",
"format":"uri"
},
"title":{
"type":"string"
},
"description":{
"type":"string"
},
"default":{
},
"multipleOf":{
"type":"number",
"minimum":0,
"exclusiveMinimum":true
},
"maximum":{
"type":"number"
},
"exclusiveMaximum":{
"type":"boolean",
"default":false
},
"minimum":{
"type":"number"
},
"exclusiveMinimum":{
"type":"boolean",
"default":false
},
"maxLength":{
"$ref":"#/definitions/positiveInteger"
},
"minLength":{
"$ref":"#/definitions/positiveIntegerDefault0"
},
"pattern":{
"type":"string",
"format":"regex"
},
"additionalItems":{
"anyOf":[
{
"type":"boolean"
},
{
"$ref":"#"
}
],
"default":{
}
},
"items":{
"anyOf":[
{
"$ref":"#"
},
{
"$ref":"#/definitions/schemaArray"
}
],
"default":{
}
},
"maxItems":{
"$ref":"#/definitions/positiveInteger"
},
"minItems":{
"$ref":"#/definitions/positiveIntegerDefault0"
},
"uniqueItems":{
"type":"boolean",
"default":false
},
"maxProperties":{
"$ref":"#/definitions/positiveInteger"
},
"minProperties":{
"$ref":"#/definitions/positiveIntegerDefault0"
},
"required":{
"$ref":"#/definitions/stringArray"
},
"additionalProperties":{
"anyOf":[
{
"type":"boolean"
},
{
"$ref":"#"
}
],
"default":{
}
},
"definitions":{
"type":"object",
"additionalProperties":{
"$ref":"#"
},
"default":{
}
},
"properties":{
"type":"object",
"additionalProperties":{
"$ref":"#"
},
"default":{
}
},
"patternProperties":{
"type":"object",
"additionalProperties":{
"$ref":"#"
},
"default":{
}
},
"dependencies":{
"type":"object",
"additionalProperties":{
"anyOf":[
{
"$ref":"#"
},
{
"$ref":"#/definitions/stringArray"
}
]
}
},
"enum":{
"type":"array",
"minItems":1,
"uniqueItems":true
},
"type":{
"anyOf":[
{
"$ref":"#/definitions/simpleTypes"
},
{
"type":"array",
"items":{
"$ref":"#/definitions/simpleTypes"
},
"minItems":1,
"uniqueItems":true
}
]
},
"allOf":{
"$ref":"#/definitions/schemaArray"
},
"anyOf":{
"$ref":"#/definitions/schemaArray"
},
"oneOf":{
"$ref":"#/definitions/schemaArray"
},
"not":{
"$ref":"#"
}
},
"dependencies":{
"exclusiveMaximum":[
"maximum"
],
"exclusiveMinimum":[
"minimum"
]
},
"default":{
}
} To reproduce this, you can run my app locally using the instructions in #395 (comment). The Swagger spec will be available at http://127.0.0.1:5000/about/openapi. UPDATE: I disabled proxying of the core JSON Schema schema, so my Swagger spec and JSON schema have |
I tried 2.0.0-alpha11 as well, but yarn/npm start throws errors. |
@bartfeenstra I'm terribly sorry for the huuge delay with this 🙈 . I will look into this today! |
@bartfeenstra I am unable to start your server using details you provided :( First there is no
(detailed stack trace below) I tried running
I'm not python expert so I need your help to figure it out! Detailed stack trace:
|
My bad! The up-to-date command is indeed I think after you replaced |
@RomanGotsiy What's most tricky is what is called the Virtual Environment this command sets up (they ensure the Python dependencies aren't installed globally by default). If you ctrl+C the set-up command (because after installation it runs a web server in the foreground until you interrupt it), you'll likely see your shell prompt contain |
OK, I am now able to run the server and to load openapi spec. Stack Trace
|
I think this is a Python 3.5 issue, but I don't see any of my tests (run on 3.5 and 3.6) failing. I'll try to reproduce and fix this. In the meantime, would you have a local Python 3.6 installation locally? If so, use the same command, but make sure the two |
I removed this particular piece of code (a type check that wasn't supported until Python 3.6, I believe) on |
@bartfeenstra should be fixed in the latest release |
Awesome, it works like a charm now. Thank you very much! |
I'm using the latest stable CDN-hosted ReDoc version on the Swagger 2.0 and JSON Schema documents at the end of this post. When loading this in ReDoc, it fails with the following error:
ERROR Error: Uncaught (in promise): SyntaxError: Error resolving $ref pointer "http://127.0.0.1:5000/about/json/schema#/definitions/schema". Token "schema" does not exist.
. As you can see in the documents below, this subschema does indeed not exist, but I don't know why ReDoc tries to load it. I'm hoping someone here might. The same JSON schema is also parsed and resolved by a Python library, which works well, so at this point like the error is caused by something on ReDoc's side.Please let me know if I can provide more information. Once #388 has been addressed, I can hopefully help debug this error myself locally :)
Swagger spec:
JSON Schema:
The text was updated successfully, but these errors were encountered: