mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 00:26:34 +03:00
fix: merge reference for openapi 3.1 (#2063)
This commit is contained in:
parent
e26c8b23d9
commit
87541e45dc
|
@ -1181,6 +1181,7 @@ components:
|
|||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: number
|
||||
description: Tag ID
|
||||
$ref: '#/components/schemas/Id'
|
||||
name:
|
||||
|
|
|
@ -823,6 +823,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
|||
"discriminator": Object {
|
||||
"propertyName": "type",
|
||||
},
|
||||
"format": undefined,
|
||||
"parentRefs": Array [
|
||||
"#/components/schemas/Pet",
|
||||
],
|
||||
|
@ -1643,6 +1644,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
|||
"discriminator": Object {
|
||||
"propertyName": "type",
|
||||
},
|
||||
"format": undefined,
|
||||
"parentRefs": Array [
|
||||
"#/components/schemas/Pet",
|
||||
],
|
||||
|
@ -2721,6 +2723,7 @@ exports[`Components SchemaView discriminator should correctly render SchemaView
|
|||
"discriminator": Object {
|
||||
"propertyName": "type",
|
||||
},
|
||||
"format": undefined,
|
||||
"parentRefs": Array [
|
||||
"#/components/schemas/Pet",
|
||||
],
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { OpenAPIRef, OpenAPISchema, OpenAPISpec, Referenced } from '../types';
|
||||
|
||||
import { isArray, isBoolean, IS_BROWSER } from '../utils/';
|
||||
import { isArray, isBoolean, IS_BROWSER } from '../utils';
|
||||
import { JsonPointer } from '../utils/JsonPointer';
|
||||
import { getDefinitionName, isNamedDefinition } from '../utils/openapi';
|
||||
import { RedocNormalizedOptions } from './RedocNormalizedOptions';
|
||||
|
@ -173,7 +173,7 @@ export class OpenAPIParser {
|
|||
keys.some(k => k !== 'description' && k !== 'title' && k !== 'externalDocs')
|
||||
) {
|
||||
return {
|
||||
allOf: [rest, resolved],
|
||||
allOf: [resolved, rest],
|
||||
};
|
||||
} else {
|
||||
// small optimization
|
||||
|
@ -244,6 +244,7 @@ export class OpenAPIParser {
|
|||
for (const { $ref: subSchemaRef, schema: subSchema } of allOfSchemas) {
|
||||
const {
|
||||
type,
|
||||
format,
|
||||
enum: enumProperty,
|
||||
properties,
|
||||
items,
|
||||
|
@ -263,6 +264,7 @@ export class OpenAPIParser {
|
|||
receiver.type = [...type, ...receiver.type];
|
||||
} else {
|
||||
receiver.type = type;
|
||||
receiver.format = format;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ exports[`Models Schema schemaDefinition should resolve field with conditional op
|
|||
Object {
|
||||
"allOf": undefined,
|
||||
"default": undefined,
|
||||
"format": undefined,
|
||||
"items": Object {
|
||||
"allOf": undefined,
|
||||
"format": "url",
|
||||
|
@ -24,6 +25,7 @@ exports[`Models Schema schemaDefinition should resolve field with conditional op
|
|||
Object {
|
||||
"allOf": undefined,
|
||||
"default": undefined,
|
||||
"format": undefined,
|
||||
"items": Object {
|
||||
"allOf": undefined,
|
||||
"format": "url",
|
||||
|
@ -48,6 +50,7 @@ Object {
|
|||
exports[`Models Schema schemaDefinition should resolve schema with conditional operators 1`] = `
|
||||
Object {
|
||||
"allOf": undefined,
|
||||
"format": undefined,
|
||||
"maxItems": 2,
|
||||
"parentRefs": Array [],
|
||||
"properties": Object {
|
||||
|
@ -57,6 +60,7 @@ Object {
|
|||
"enum": Array [
|
||||
10,
|
||||
],
|
||||
"format": undefined,
|
||||
"items": Object {
|
||||
"allOf": undefined,
|
||||
"format": "url",
|
||||
|
@ -83,6 +87,7 @@ Object {
|
|||
exports[`Models Schema schemaDefinition should resolve schema with conditional operators 2`] = `
|
||||
Object {
|
||||
"allOf": undefined,
|
||||
"format": undefined,
|
||||
"maxItems": 20,
|
||||
"parentRefs": Array [],
|
||||
"properties": Object {
|
||||
|
|
|
@ -2261,6 +2261,7 @@ Object {
|
|||
"id": Object {
|
||||
"$ref": "#/components/schemas/Id",
|
||||
"description": "Tag ID",
|
||||
"type": "number",
|
||||
},
|
||||
"name": Object {
|
||||
"description": "Tag name",
|
||||
|
|
Loading…
Reference in New Issue
Block a user