-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
Expected Behaviour
Discriminator mapping references should be expanded
https://swagger.io/specification/#discriminator-object
Minimal Example Spec
openapi: 3.0.2
info:
title: Test
version: 1.0.1
paths:
/Test:
post:
responses:
'200':
description: Successful Response
components:
schemas:
UpdateSuitabilityAssessmentRequest:
properties:
answers:
items:
discriminator:
propertyName: type
mapping:
MULTI_CHOICE: '#/components/schemas/UpdateSuitabilityAssessmentRequestMultiChoiceAnswer'
SINGLE_CHOICE: '#/components/schemas/UpdateSuitabilityAssessmentRequestSingleChoiceAnswer'
oneOf:
- $ref: '#/components/schemas/UpdateSuitabilityAssessmentRequestSingleChoiceAnswer'
- $ref: '#/components/schemas/UpdateSuitabilityAssessmentRequestMultiChoiceAnswer'
UpdateSuitabilityAssessmentRequestMultiChoiceAnswer:
properties:
type:
enum:
- MULTI_CHOICE
UpdateSuitabilityAssessmentRequestSingleChoiceAnswer:
properties:
type:
enum:
- SINGLE_CHOICEActual Behaviour
Discriminator mapping references (MULTI_CHOICE, SINGLE_CHOICE) are not expanded
{
"openapi": "3.0.2",
"info": {
"title": "Test",
"version": "1.0.1"
},
"paths": {
"/Test": {
"post": {
"responses": {
"200": {
"description": "Successful Response"
}
}
}
}
},
"components": {
"schemas": {
"UpdateSuitabilityAssessmentRequest": {
"discriminator": {
"propertyName": "type",
"mapping": {
"MULTI_CHOICE": "#/components/schemas/UpdateSuitabilityAssessmentRequestMultiChoiceAnswer",
"SINGLE_CHOICE": "#/components/schemas/UpdateSuitabilityAssessmentRequestSingleChoiceAnswer"
}
},
"oneOf": [
{
"properties": {
"type": {
"enum": [
"SINGLE_CHOICE"
]
}
}
},
{
"properties": {
"type": {
"enum": [
"MULTI_CHOICE"
]
}
}
}
]
},
"UpdateSuitabilityAssessmentRequestMultiChoiceAnswer": {
"properties": {
"type": {
"enum": [
"MULTI_CHOICE"
]
}
}
},
"UpdateSuitabilityAssessmentRequestSingleChoiceAnswer": {
"properties": {
"type": {
"enum": [
"SINGLE_CHOICE"
]
}
}
}
}
}
}Steps to Reproduce
import prance
resolver = prance.ResolvingParser(
"openapi.yml",
spec_string=None,
backend="openapi-spec-validator",
strict=False
)Environment
- OS: macos 13.4.1
- Python version: 3.10.7
- Swagger/OpenAPI version used: 3.0.2
- Backend: openapi-spec-validator
Metadata
Metadata
Assignees
Labels
No labels