-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Resolving nested references #125
Comments
Things are working as designed and is documented here: https://github.com/whitlockjc/json-refs/tree/master/docs#resolution When it comes to resolution, you can do remote-only resolution but anytime you reference a remote document, or a portion of the document outside of If after using |
When I tried to reproduce your issue, I get a complete resolution as expected: {
"swagger": "2.0",
"info": {
"version": "2",
"title": "a"
},
"basePath": "/a/v1",
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/a": {
"post": {
"description": "A.",
"parameters": [
{
"name": "A",
"description": "A",
"in": "body",
"required": true,
"schema": {
"type": "object",
"required": [
"Aa"
],
"properties": null,
"Aa": {
"type": "string"
},
"Ab": {
"description": "Ab\n",
"type": "string"
},
"Ac": {
"description": "Ac\n",
"type": "string"
}
}
}
]
}
}
},
"definitions": {
"A": {
"type": "object",
"required": [
"Aa"
],
"properties": null,
"Aa": {
"type": "string"
},
"Ab": {
"description": "Ab\n",
"type": "string"
},
"Ac": {
"description": "Ac\n",
"type": "string"
}
}
}
} |
Thanks for the answer. It is interesting that you had a different result than me. I use json-refs via the CLI. I added my example files and the result here: json-refs-example.zip |
What version of |
I use version 3.0.0. |
Yes, you can view the resolution metadata. Basically, JsonRefs#resolveRefs returns a As for the objects being referenced a lot and creating large files, I get it. The good news is that in memory, Lastly, I'll look into your example and report what I find. |
I think this is a bug. It looks like the local reference is being resolved prior to the remote reference and that shouldn't happen. I'll see if I can reproduce this in a simpler test and go from there. |
This has been fixed and is resolved in |
Thanks for the fix. A possible workaround would be when json-refs would not resolve the local references only the remote ones. In this way several occurences could point to one local reference which would point to the remote one? |
The issue is more about how we're updating values as part of resolution. If I update |
Hi,
I would like to use nested references, when a reference contains an other reference. The aim to do this is to collect all external OpenAPI definitions into the main OpenAPI file, but not to inline the definitions.
I have an OpenAPI file a.yaml, like:
and the definitions are in an external file ./definitions/definitions.yaml:
After json-refs-ing I get:
While my target would be:
I'm open to any solution ideas.
Any ideas if this is a new feature or a bug in json-refs?
Thanks
The text was updated successfully, but these errors were encountered: