-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
References in discriminator mappings are not being expanded #155
Comments
I modified
Which has produced a correct expanded schema: {'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': {'properties': {'type': {'enum': ['MULTI_CHOICE']}}}, 'SINGLE_CHOICE': {'properties': {'type': {'enum': ['SINGLE_CHOICE']}}}}}, 'oneOf': [{'properties': {'type': {'enum': ['SINGLE_CHOICE']}}}, {'properties': {'type': {'enum': ['MULTI_CHOICE']}}}]}}}}, 'UpdateSuitabilityAssessmentRequestMultiChoiceAnswer': {'properties': {'type': {'enum': ['MULTI_CHOICE']}}}, 'UpdateSuitabilityAssessmentRequestSingleChoiceAnswer': {'properties': {'type': {'enum': ['SINGLE_CHOICE']}}}}}} However, validation is failing: openapi_spec_validator.validation.exceptions.OpenAPIValidationError: {'properties': {'answers': {'items': {'discriminator': {'propertyName': 'type', 'mapping': {'MULTI_CHOICE': {'properties': {'type': {'enum': ['SINGLE_CHOICE']}}}, 'SINGLE_CHOICE': {'properties': {'type': {'enum': ['MULTI_CHOICE']}}}}}, 'oneOf': [{'properties': {'type': {'enum': ['SINGLE_CHOICE']}}}, {'properties': {'type': {'enum': ['MULTI_CHOICE']}}}]}}}} is not valid under any of the given schemas
Failed validating 'oneOf' in schema['properties']['components']['properties']['schemas']['patternProperties']['^[a-zA-Z0-9\\.\\-_]+$']:
{'oneOf': [{'$ref': '#/definitions/Schema'},
{'$ref': '#/definitions/Reference'}]}
On instance['components']['schemas']['UpdateSuitabilityAssessmentRequest']:
{'properties': {'answers': {'items': {'discriminator': {'mapping': {'MULTI_CHOICE': {'properties': {'type': {'enum': ['SINGLE_CHOICE']}}},
'SINGLE_CHOICE': {'properties': {'type': {'enum': ['MULTI_CHOICE']}}}},
'propertyName': 'type'},
'oneOf': [{'properties': {'type': {'enum': ['SINGLE_CHOICE']}}},
{'properties': {'type': {'enum': ['MULTI_CHOICE']}}}]}}}} Sounds like according to the spec, discriminator mapping refs cannot be expanded? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected Behaviour
Discriminator mapping references should be expanded
https://swagger.io/specification/#discriminator-object
Minimal Example Spec
Actual Behaviour
Discriminator mapping references (MULTI_CHOICE, SINGLE_CHOICE) are not expanded
Steps to Reproduce
Environment
The text was updated successfully, but these errors were encountered: