mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-23 00:56:33 +03:00
Fix discriminator end-less recursion
This commit is contained in:
parent
fdb485fa91
commit
fc86c93d87
|
@ -47,7 +47,7 @@
|
|||
<tr *ngIf="schema.derived.length" class="param-wrap discriminator-wrap">
|
||||
<td colspan="2">
|
||||
<div class="derived-schema" *ngFor="#derived of schema.derived" [ngClass]="{active: derived.active}">
|
||||
<json-schema pointer="{{derived.$ref}}" [final]="derived.final" class="discriminator-part">
|
||||
<json-schema [childFor]="pointer" pointer="{{derived.$ref}}" [final]="derived.final" class="discriminator-part">
|
||||
</json-schema>
|
||||
</div>
|
||||
</td>
|
||||
|
|
|
@ -11,7 +11,7 @@ import JsonPointer from '../../utils/JsonPointer';
|
|||
templateUrl: './lib/components/JsonSchema/json-schema.html',
|
||||
styleUrls: ['./lib/components/JsonSchema/json-schema.css'],
|
||||
directives: [JsonSchema, Tabs, Tab],
|
||||
inputs: ['isArray', 'final', 'nestOdd']
|
||||
inputs: ['isArray', 'final', 'nestOdd', 'childFor']
|
||||
})
|
||||
@Reflect.metadata('parameters', [[SchemaManager], [ElementRef]])
|
||||
export default class JsonSchema extends BaseComponent {
|
||||
|
@ -74,6 +74,10 @@ export default class JsonSchema extends BaseComponent {
|
|||
let propertySchema = schema.properties[prop];
|
||||
let propPointer = JsonPointer.join(schema._pointer || this.pointer, ['properties', prop]);
|
||||
propertySchema = JsonSchema.injectPropertyData(propertySchema, prop, propPointer);
|
||||
// stop endless discriminator recursion
|
||||
if (propertySchema._pointer === this.childFor) {
|
||||
propertySchema._pointer = null;
|
||||
}
|
||||
propertySchema.required = !!requiredMap[prop];
|
||||
propertySchema.isDiscriminator = (schema.discriminator === prop);
|
||||
if (propertySchema.isDiscriminator) discriminatorFieldIdx = idx;
|
||||
|
|
Loading…
Reference in New Issue
Block a user