Redocly / redoc

📘 OpenAPI/Swagger-generated API Reference Documentation
https://redocly.github.io/redoc/
MIT License
23.58k stars 2.3k forks source link

Request samples reflects the change of `petType` #99

Open typekpb opened 8 years ago

typekpb commented 8 years ago

Steps to reproduce:

  1. navigate to: http://rebilly.github.io/ReDoc/
  2. pick pet -> Add a new pet to the store
  3. change petType from: Cat to Dog

Is: SectonRequest samples doesn't reflect the change (Cat is still there, instead of Dog)

Expected: SectonRequest samples reflects the change

RomanHotsiy commented 8 years ago

@typekpb thanks. We definitely should implement it, but it requires some work to resolve all edge cases (e.g. discriminator inside discriminator)

nakedible-p commented 8 years ago

As an appendix to this issue, one more use case.

I have an array of items as such:

  BatchRequest:
    type: object
    properties:
      items:
        type: array
        items:
          $ref: '#/definitions/BatchItem'

  BatchItem:
    type: object
    required:
    - type
    discriminator: type
    properties:
      type:
        type: string
        description: Batch item type for this message.

The example shows only:

{
  "items": [
    {
      "type": "string"
    }
  ]
}

...regardless of what is chosen in the message as the discriminator dropdown.

avkonst commented 7 years ago

Here is the same comment I posted in two other issues (https://github.com/Rebilly/ReDoc/issues/210#issuecomment-302992902 and https://github.com/Rebilly/ReDoc/issues/207#issuecomment-302993122) about simplifying and improving the visualization for allOf, oneOf, anyOf and removing discriminator. If ReDoc supported one to one mapping of nested sections per each oneOf/anyOf/allOf, the same reflection could be applied to examples, when a user scrolls the "horizontal" carousel-like slider.

wenjdu commented 7 years ago

+1