mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 00:26:34 +03:00
fix: nested items with refs (#2035)
This commit is contained in:
parent
a366de4cf6
commit
51127aadc3
|
@ -13,7 +13,7 @@ export interface OAuthFlowProps {
|
|||
export function OAuthFlowComponent(props: OAuthFlowProps) {
|
||||
const { type, flow, RequiredScopes } = props;
|
||||
const scopesNames = Object.keys(flow?.scopes || {});
|
||||
console.log('rended');
|
||||
|
||||
return (
|
||||
<>
|
||||
<SecurityRow>
|
||||
|
|
|
@ -207,6 +207,15 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
|||
},
|
||||
"rightPanel": Object {
|
||||
"backgroundColor": "#263238",
|
||||
"servers": Object {
|
||||
"overlay": Object {
|
||||
"backgroundColor": "#fafafa",
|
||||
"textColor": "#263238",
|
||||
},
|
||||
"url": Object {
|
||||
"backgroundColor": "#fff",
|
||||
},
|
||||
},
|
||||
"textColor": "#ffffff",
|
||||
"width": "40%",
|
||||
},
|
||||
|
@ -465,6 +474,15 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
|||
},
|
||||
"rightPanel": Object {
|
||||
"backgroundColor": "#263238",
|
||||
"servers": Object {
|
||||
"overlay": Object {
|
||||
"backgroundColor": "#fafafa",
|
||||
"textColor": "#263238",
|
||||
},
|
||||
"url": Object {
|
||||
"backgroundColor": "#fff",
|
||||
},
|
||||
},
|
||||
"textColor": "#ffffff",
|
||||
"width": "40%",
|
||||
},
|
||||
|
@ -698,6 +716,15 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
|||
},
|
||||
"rightPanel": Object {
|
||||
"backgroundColor": "#263238",
|
||||
"servers": Object {
|
||||
"overlay": Object {
|
||||
"backgroundColor": "#fafafa",
|
||||
"textColor": "#263238",
|
||||
},
|
||||
"url": Object {
|
||||
"backgroundColor": "#fff",
|
||||
},
|
||||
},
|
||||
"textColor": "#ffffff",
|
||||
"width": "40%",
|
||||
},
|
||||
|
@ -998,6 +1025,15 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
|||
},
|
||||
"rightPanel": Object {
|
||||
"backgroundColor": "#263238",
|
||||
"servers": Object {
|
||||
"overlay": Object {
|
||||
"backgroundColor": "#fafafa",
|
||||
"textColor": "#263238",
|
||||
},
|
||||
"url": Object {
|
||||
"backgroundColor": "#fff",
|
||||
},
|
||||
},
|
||||
"textColor": "#ffffff",
|
||||
"width": "40%",
|
||||
},
|
||||
|
@ -1256,6 +1292,15 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
|||
},
|
||||
"rightPanel": Object {
|
||||
"backgroundColor": "#263238",
|
||||
"servers": Object {
|
||||
"overlay": Object {
|
||||
"backgroundColor": "#fafafa",
|
||||
"textColor": "#263238",
|
||||
},
|
||||
"url": Object {
|
||||
"backgroundColor": "#fff",
|
||||
},
|
||||
},
|
||||
"textColor": "#ffffff",
|
||||
"width": "40%",
|
||||
},
|
||||
|
@ -1489,6 +1534,15 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
|||
},
|
||||
"rightPanel": Object {
|
||||
"backgroundColor": "#263238",
|
||||
"servers": Object {
|
||||
"overlay": Object {
|
||||
"backgroundColor": "#fafafa",
|
||||
"textColor": "#263238",
|
||||
},
|
||||
"url": Object {
|
||||
"backgroundColor": "#fff",
|
||||
},
|
||||
},
|
||||
"textColor": "#ffffff",
|
||||
"width": "40%",
|
||||
},
|
||||
|
@ -1745,6 +1799,15 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
|||
},
|
||||
"rightPanel": Object {
|
||||
"backgroundColor": "#263238",
|
||||
"servers": Object {
|
||||
"overlay": Object {
|
||||
"backgroundColor": "#fafafa",
|
||||
"textColor": "#263238",
|
||||
},
|
||||
"url": Object {
|
||||
"backgroundColor": "#fff",
|
||||
},
|
||||
},
|
||||
"textColor": "#ffffff",
|
||||
"width": "40%",
|
||||
},
|
||||
|
@ -2042,6 +2105,15 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
|||
},
|
||||
"rightPanel": Object {
|
||||
"backgroundColor": "#263238",
|
||||
"servers": Object {
|
||||
"overlay": Object {
|
||||
"backgroundColor": "#fafafa",
|
||||
"textColor": "#263238",
|
||||
},
|
||||
"url": Object {
|
||||
"backgroundColor": "#fff",
|
||||
},
|
||||
},
|
||||
"textColor": "#ffffff",
|
||||
"width": "40%",
|
||||
},
|
||||
|
@ -2300,6 +2372,15 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
|||
},
|
||||
"rightPanel": Object {
|
||||
"backgroundColor": "#263238",
|
||||
"servers": Object {
|
||||
"overlay": Object {
|
||||
"backgroundColor": "#fafafa",
|
||||
"textColor": "#263238",
|
||||
},
|
||||
"url": Object {
|
||||
"backgroundColor": "#fff",
|
||||
},
|
||||
},
|
||||
"textColor": "#ffffff",
|
||||
"width": "40%",
|
||||
},
|
||||
|
@ -2533,6 +2614,15 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
|||
},
|
||||
"rightPanel": Object {
|
||||
"backgroundColor": "#263238",
|
||||
"servers": Object {
|
||||
"overlay": Object {
|
||||
"backgroundColor": "#fafafa",
|
||||
"textColor": "#263238",
|
||||
},
|
||||
"url": Object {
|
||||
"backgroundColor": "#fff",
|
||||
},
|
||||
},
|
||||
"textColor": "#ffffff",
|
||||
"width": "40%",
|
||||
},
|
||||
|
|
|
@ -133,6 +133,13 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"Case6": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/Tag"
|
||||
}
|
||||
},
|
||||
"Cat": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -148,6 +155,29 @@
|
|||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Tag": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "Tag ID",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Id"
|
||||
}
|
||||
]
|
||||
},
|
||||
"name": {
|
||||
"description": "tag name",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"Id": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"readOnly": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,6 +133,13 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"Case6": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/Tag"
|
||||
}
|
||||
},
|
||||
"Cat": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -148,6 +155,29 @@
|
|||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Tag": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "Tag ID",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/Id"
|
||||
}
|
||||
]
|
||||
},
|
||||
"name": {
|
||||
"description": "tag name",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"Id": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"readOnly": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -212,6 +212,22 @@ describe('Models', () => {
|
|||
]);
|
||||
},
|
||||
);
|
||||
|
||||
test.each(eachArray)(
|
||||
'schemaDefinition should resolve prefixItems with additional array items',
|
||||
specFixture => {
|
||||
const spec = require(specFixture);
|
||||
const parser = new OpenAPIParser(spec, undefined, opts);
|
||||
const schema = new SchemaModel(parser, spec.components.schemas.Case6, '', opts);
|
||||
expect(schema.type).toBe('array');
|
||||
expect(schema.typePrefix).toBe('Array of ');
|
||||
expect(schema.items?.fields).toHaveLength(2);
|
||||
expect(schema.items?.pointer).toEqual('#/components/schemas/Tag');
|
||||
expect(schema.isPrimitive).toBe(false);
|
||||
expect(schema.items?.isPrimitive).toBe(false);
|
||||
expect(schema.minItems).toBe(1);
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -209,7 +209,8 @@ export class SchemaModel {
|
|||
this.displayFormat = this.items?.format || '';
|
||||
this.typePrefix = this.items?.typePrefix || '' + l('arrayOf');
|
||||
this.title = this.title || this.items?.title || '';
|
||||
this.isPrimitive = this.items?.isPrimitive || this.isPrimitive;
|
||||
this.isPrimitive =
|
||||
this.items?.isPrimitive !== undefined ? this.items?.isPrimitive : this.isPrimitive;
|
||||
|
||||
if (this.example === undefined && this.items?.example !== undefined) {
|
||||
this.example = [this.items.example];
|
||||
|
|
Loading…
Reference in New Issue
Block a user