mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-27 02:53:43 +03:00
joinAllOf fix: ref and inline schema case
This commit is contained in:
parent
21788c282d
commit
b92ebe388b
|
@ -75,7 +75,8 @@ export default class JsonSchema extends BaseComponent {
|
||||||
let discriminatorFieldIdx = -1;
|
let discriminatorFieldIdx = -1;
|
||||||
let props = Object.keys(schema.properties).map((prop, idx) => {
|
let props = Object.keys(schema.properties).map((prop, idx) => {
|
||||||
let propertySchema = schema.properties[prop];
|
let propertySchema = schema.properties[prop];
|
||||||
let propPointer = JsonPointer.join(schema._pointer || this.pointer, ['properties', prop]);
|
let propPointer = propertySchema._pointer ||
|
||||||
|
JsonPointer.join(schema._pointer || this.pointer, ['properties', prop]);
|
||||||
propertySchema = JsonSchema.injectPropertyData(propertySchema, prop, propPointer);
|
propertySchema = JsonSchema.injectPropertyData(propertySchema, prop, propPointer);
|
||||||
// stop endless discriminator recursion
|
// stop endless discriminator recursion
|
||||||
if (propertySchema._pointer === this.childFor) {
|
if (propertySchema._pointer === this.childFor) {
|
||||||
|
|
|
@ -192,12 +192,19 @@ export class BaseComponent {
|
||||||
if (into.type === 'object' && subSchema.properties) {
|
if (into.type === 'object' && subSchema.properties) {
|
||||||
into.properties || (into.properties = {});
|
into.properties || (into.properties = {});
|
||||||
Object.assign(into.properties, subSchema.properties);
|
Object.assign(into.properties, subSchema.properties);
|
||||||
|
Object.keys(subSchema.properties).forEach(propName => {
|
||||||
|
if (!subSchema.properties[propName]._pointer) {
|
||||||
|
subSchema.properties[propName]._pointer = subSchema._pointer ?
|
||||||
|
JsonPointer.join(subSchema._pointer, ['properties', propName]) : null;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (into.type === 'object' && subSchema.required) {
|
if (into.type === 'object' && subSchema.required) {
|
||||||
into.required || (into.required = []);
|
into.required || (into.required = []);
|
||||||
into.required.push(...subSchema.required);
|
into.required.push(...subSchema.required);
|
||||||
}
|
}
|
||||||
|
// don't merge _pointer
|
||||||
|
subSchema._pointer = null;
|
||||||
defaults(into, subSchema);
|
defaults(into, subSchema);
|
||||||
}
|
}
|
||||||
into.allOf = null;
|
into.allOf = null;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user