mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-23 00:56:33 +03:00
Fix allOf withing array items (fixes #136)
This commit is contained in:
parent
d1862ecea0
commit
efcb811151
|
@ -35,10 +35,11 @@ export class SchemaSample extends BaseComponent implements OnInit {
|
|||
let base:any = {};
|
||||
let sample;
|
||||
|
||||
// got pointer not directly to the schema but e.g. to response obj
|
||||
// got pointer not directly to the schema but e.g. to the response obj
|
||||
if (this.componentSchema.schema) {
|
||||
base = this.componentSchema;
|
||||
this.componentSchema = this.componentSchema.schema;
|
||||
this.pointer += '/schema';
|
||||
}
|
||||
|
||||
if (base.examples && base.examples['application/json']) {
|
||||
|
@ -48,7 +49,7 @@ export class SchemaSample extends BaseComponent implements OnInit {
|
|||
|
||||
this.componentSchema = this._normalizer.normalize(this.componentSchema, this.pointer);
|
||||
|
||||
let discriminator = this.componentSchema.discriminator || this.componentSchema['x-extendedDiscriminator'];
|
||||
let discriminator = this.componentSchema.discriminator || this.componentSchema['x-discriminatorBasePointer'];
|
||||
if (discriminator) {
|
||||
let descendants = this.specMgr.findDerivedDefinitions(this.componentSchema._pointer || this.pointer);
|
||||
if (descendants.length) {
|
||||
|
|
|
@ -27,8 +27,11 @@ export class SchemaNormalizer {
|
|||
let hasPtr = !!schema.$ref;
|
||||
if (opts.resolved && !hasPtr) this._dereferencer.visit(ptr);
|
||||
|
||||
if (schema['x-redoc-normalized']) return schema;
|
||||
let res = SchemaWalker.walk(schema, ptr, (subSchema, ptr) => {
|
||||
if (schema['x-redoc-normalized']) {
|
||||
if (!schema['x-redoc-normalized']._pointer) schema['x-redoc-normalized']._pointer = ptr;
|
||||
return schema['x-redoc-normalized'];
|
||||
}
|
||||
let res = SchemaWalker.walk(Object.assign({}, schema), ptr, (subSchema, ptr) => {
|
||||
let resolved = this._dereferencer.dereference(subSchema, ptr);
|
||||
if (resolved.allOf) {
|
||||
resolved._pointer = resolved._pointer || ptr;
|
||||
|
@ -38,7 +41,7 @@ export class SchemaNormalizer {
|
|||
return resolved;
|
||||
});
|
||||
if (opts.resolved && !hasPtr) this._dereferencer.exit(ptr);
|
||||
res['x-redoc-normalized'] = true;
|
||||
schema['x-redoc-normalized'] = res;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user