-
Notifications
You must be signed in to change notification settings - Fork 12
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
Error: Unsupported $ref value: #/definitions/mongoIdentifier #5
Comments
I no longer do Node.js. You are welcome to put in a pull request or take over the library. Thanks! |
@dannybrown Hi Danny, i realise this is ancient now but for anyone who gets here with it, I have a project that uses json-schema-to-mongoose with json-schema-ref-parser to parse schemas with references (including local definitions in the same or other files and, remote references). The relevant code is here but you probably better off just looking at the json-schema-ref-parser docs. The only not-easily-resolvable issue I ran into was circular references, but they are avoidable if it's your own schema and I've not found them to be terribly common in others. |
Another simple possiblity: function extractDefinitionsAndCreateMongooseSchema(oSchema) {
var oDefinitions = { '#': oSchema };
for (let sDef in oSchema.definitions) {
oDefinitions['#/definitions/' + sDef] = oSchema.definitions[sDef];
}
oMongooseSchema = createMongooseSchema(oDefinitions, oSchema);
} Doesn't help with the circular references though - in this case, the reference back to the schema root using '#' leads to My problem - the basic JSON Schema itself (https://github.com/json-schema-org/json-schema-spec/blob/master/schema.json) uses those references, however, I do want to store those in the database as well. Did someone get around that problem? |
Hi,
I am using a JSON schema that passes through both http://www.jsonschemavalidator.net/ and http://jsonschemalint.com/draft4/. It uses $ref attributes which point to a defitions section inside the same JSON schema file, e.g.
#/definitions/mongoIdentifier
.This fails both when I pass I pass the definitions from the schema file as a parameter
and when I pass an empty object:
The library says this is currently unsupported. How easy would it be to remedy, or am I just doing something incorrectly?
Thanks,
Danny
The text was updated successfully, but these errors were encountered: