Request body from example is not showing property
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:
But in the rendering section, the property instructionId is missing from the example request sample:
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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