-
Notifications
You must be signed in to change notification settings - Fork 537
Closed
Description
When resolving fully a schema with anyOf, allOf and/or oneOf and object properties with references, as in the example schema below, the property references are missed and remain as $ref.
swagger.yaml
openapi: "3.0.2"
info:
version: 15.3.0
title: test
paths:
/add-pets:
put:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Pets'
responses:
'200':
description: Expected response to a valid request
content:
text/plain:
schema:
type: string
components:
schemas:
Pets:
type: object
oneOf:
- required: [petType, colouring]
- required: [breed, colouring]
properties:
petType:
type: string
breed:
$ref: 'common.yaml#/components/schemas/Breed'
colouring:
$ref: 'common.yaml#/components/schemas/Colouring'
common.yaml
openapi: "3.0.0"
info:
version: 15.3.0
title: "Common Data Types"
paths: {}
components:
schemas:
Breed:
type: object
properties:
name:
type: string
family:
type: string
Colouring:
type: object
properties:
primary:
$ref: '#/components/schemas/Colour'
secondary:
$ref: '#/components/schemas/Colour'
Colour:
type: string
enum: ['black', 'white', 'tan', 'red', 'blue']
This is because in ResolverFully.resolveSchema, after the anyOf, allOf and oneOf parts of ComposedSchema are resolved, the method returns immediately, without also resolving the object's properties.
A fix for this would be to not return immediately after resolving the anyOf, allOf and oneOf parts of ComposedSchema, allowing it to proceed to the next code block, where properties are processed.
Metadata
Metadata
Assignees
Labels
No labels