Redocly / Redocly/redoc

Request body from example is not showing property

Open
#1,369 1 comment 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
25.9k
Forks
2.4k
Avg merge
13h 10m
Merged PRs (30d)
4

Description

I have the following schema that we are using:

 "RenderingDomainRequest" : {
        "title" : "A Rendering Instruction Request",
        "required" : [ "instructionId", "type" ],
        "type" : "object",
        "properties" : {
          "type" : {
            "title" : "The rendering instruction type",
            "type" : "string",
            "description" : "Rendering Type",
            "enum" : [ "CREATIVE_EXTENSION", "EXTENSION", "AD_PARAMETERS" ]
          },
          "instructionId" : {
            "maxLength" : 50,
            "minLength" : 1,
            "type" : "string",
            "description" : "The instruction Id string",
            "example" : "l360_head"
          }
        },
        "discriminator" : {
          "propertyName" : "type",
          "mapping" : {
            "AD_PARAMETERS" : "#/components/schemas/AdParametersRenderingDomain",
            "CREATIVE_EXTENSION" : "#/components/schemas/CreativeExtensionRenderingDomain",
            "EXTENSION" : "#/components/schemas/ExtensionRenderingDomain"
          }
        },
        "oneOf" : [ {
          "$ref" : "#/components/schemas/CreativeExtensionRenderingDomain"
        }, {
          "$ref" : "#/components/schemas/ExtensionRenderingDomain"
        }, {
          "$ref" : "#/components/schemas/AdParametersRenderingDomain"
        } ]
      }

where we have instructionId and type as properties in this parent class and body in the child(discriminated) classes(AdParametersRenderingDomain).

However, when a method uses the RenderingDomainRequest as a request body, I can see it being described correctly based on the discriminator type:

Screenshot 2020-08-31 at 23 33 04

But in the rendering section, the property instructionId is missing from the example request sample:

Screenshot 2020-08-31 at 23 37 33

Furthermore, switching between the discriminated types is not working: the first type is always rendered.

I am using redoc@v2.0.0-rc.40 standalone version.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in Redoc v2.0.0-rc.40 using the provided RenderingDomainRequest schema and its discriminated child schemas. Investigate request-body example rendering and discriminator type switching; done means the example includes instructionId and each discriminator choice renders the corresponding child type.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.