Created
August 17, 2022 07:56
-
-
Save Nikos410/32ab8c734b8f9a50adee138aba623f49 to your computer and use it in GitHub Desktop.
Openapi spec with inheritance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "openapi": "3.0.1", | |
| "info": { | |
| "title": "Example", | |
| "version": "1" | |
| }, | |
| "paths": {}, | |
| "components": { | |
| "schemas": { | |
| "BranchDto": { | |
| "type": "object", | |
| "properties": { | |
| "name": { | |
| "type": "string" | |
| } | |
| } | |
| }, | |
| "AbstractUserDto": { | |
| "type": "object", | |
| "properties": { | |
| "username": { | |
| "type": "string" | |
| }, | |
| "branch": { | |
| "$ref": "#/components/schemas/BranchDto" | |
| }, | |
| "type": { | |
| "type": "string" | |
| } | |
| }, | |
| "discriminator": { | |
| "propertyName": "type", | |
| "mapping": { | |
| "internal-authenticated": "#/components/schemas/InternalAuthenticatedUserDto", | |
| "remote-authenticated": "#/components/schemas/RemoteAuthenticatedUserDto" | |
| } | |
| } | |
| }, | |
| "InternalAuthenticatedUserDto": { | |
| "type": "object", | |
| "allOf": [ | |
| { | |
| "$ref": "#/components/schemas/AbstractUserDto" | |
| } | |
| ] | |
| }, | |
| "RemoteAuthenticatedUserDto": { | |
| "type": "object", | |
| "allOf": [ | |
| { | |
| "$ref": "#/components/schemas/AbstractUserDto" | |
| } | |
| ] | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment