-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
x-extendedDiscriminator does not work in redoc 2.X #496
Comments
@nemenemsrouge thanks for issue report. Most likely x-extendedDiscriminator will be deprecated in ReDoc 2.x. x-discriminator:
propertyName: type
mapping:
visa: "#/definitions/paymentMethodVisa"
mastercard: "#/definitions/paymentMethodMastercard"
amex: "#/definitions/paymentMethodAmex" I will try to implement this till the end of the week. |
Thank you very much! |
Related issue: Mermade/oas-kit#70 |
Is this supposed to work as of today? I'm using 2.0.0-alpha-24 but I can't get the dropdowns to show up. @nemenemsrouge Does it work for you? I'm using the following yml: swagger: '2.0'
info:
version: 1.0.0
title: Test API
host: test.api.int.com
basePath: /v2
schemes:
- https
securityDefinitions:
basic:
type: basic
consumes:
- application/json
produces:
- application/json
paths:
'/transactions/{id}':
get:
summary: Get a transaction by ID
description: Get a `Transaction` object by ID
parameters:
- name: id
in: path
description: The transaction ID
required: true
type: string
format: uuid
responses:
'200':
description: The Transaction
schema:
$ref: '#/definitions/Transaction'
parameters:
definitions:
Transaction:
type: object
properties:
id:
type: string
example: A11234
pattern: '[A-Z][0-9]{1,32}'
readOnly: true
account_id:
type: string
example: 05a2106b-92a4-4ee3-a6a3-c32f8b609de1
format: uuid
readOnly: true
operation_type:
type: string
enum:
- payment
- refund
example: payment
payment_method:
$ref: '#/definitions/PaymentMethod'
PaymentMethod:
type: object
x-discriminator:
propertyName: type
mapping:
visa: "#/definitions/paymentMethodVisa"
mastercard: "#/definitions/paymentMethodMastercard"
amex: "#/definitions/paymentMethodAmex"
properties:
type:
description: The type of Payment Method used for Transaction
type: string
paymentMethodVisa:
description: A visa
allOf:
- $ref: '#/definitions/PaymentMethod'
- properties:
prop1:
type: string
description: A custom prop
enum:
- type1
- type2
- properties:
type:
type: string
enum:
- visa
paymentMethodMastercard:
description: A mastercard
allOf:
- $ref: '#/definitions/PaymentMethod'
- properties:
prop1:
type: string
description: A custom prop
enum:
- type3
- type4
- properties:
type:
type: string
enum:
- mastercard
paymentMethodAmex:
description: A amex
allOf:
- $ref: '#/definitions/PaymentMethod'
- properties:
prop1:
type: string
description: A custom prop
enum:
- type5
- properties:
type:
type: string
enum:
- amex |
This includes the fix for x-discriminator. Fixes #496.
Hello
I have a reduce case with x-extendedDiscriminator which works well on 1.X release but doesn't work anymore on 2.X release.
Here is the yaml file:
Here is my html page displaying the yaml
As you can see I use the latest version of 2.X and 1.X.
Here is the result with 1.X
So it works just well.
And here is the same yaml with latest 2.X redoc version:
In both case, I don't have any warnings.
The text was updated successfully, but these errors were encountered: