-
Notifications
You must be signed in to change notification settings - Fork 532
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
AllOf references not resolved by parser, OneOf and AnyOf resolved correctly #1157
Comments
@Leo11221 You would also see the same problem if you had anyOf AND oneOf in the same Schema object, and they were by default combined into a new Schema. I believe a suitable solution to this would be to modify the $ref resolution in ResolverFully.resolveSchema to put any resolved Schema back into the schemas map (replacing the original), as so: ResolverFully.java public Schema resolveSchema(Schema schema) {
if(schema.get$ref() != null) {
String ref= schema.get$ref();
ref = ref.substring(ref.lastIndexOf("/") + 1);
Schema resolved = schemas.get(ref);
if (resolved != null) {
if (this.resolvedModels.containsKey(ref)) {
LOGGER.debug("avoiding infinite loop");
return resolvedModels.get(ref);
}
resolvedModels.put(ref, schema);
Schema model = resolveSchema(resolved);
// if we make it without a resolution loop, we can update the reference
resolvedModels.put(ref, model);
schemas.put(ref, model); // ** Replace original schema with resolved **
return model;
}else {
return schema;
}
} |
… with $ref with new aggregated Schema in schemas Map
Pull Request #1168 raised to implement solution suggested above. Could one of the regular contributors please review? |
Issue #1157 - AllOf references not resolved by parser, OneOf and AnyOf resolved correctly
Hi @Leo11221 for reporting this and @scottr-ad for raising the PR. please let us know if this issue is still happening after the merge. |
@gracekarina I am facing exactly the same issue in v1 (unable to resolve $ref's if allOf used)... can you point me to which version 1.x.x has this fix available? OR if not already, any plan to fix it soon? |
Hi, it seems that AllOf references are not being resolved, it seems to work for AnyOf and OneOf but not AllOf unless I'm not understanding it correctly, test case:
Output:
The text was updated successfully, but these errors were encountered: