PaloAltoNetworks / PaloAltoNetworks/docusaurus-openapi-docs
DiscriminatorNode access on undefined property
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.1k
- Forks
- 315
- Avg merge
- 7d 5h
- Merged PRs (30d)
- 7
Description
Describe the bug
With version 4.2.0 OAS discriminator was changed and now results in "This page crashed": TypeError: undefined is not an object (evaluating 'subProperties[discriminator.propertyName]') errors.
Rolling back to 4.1.0 fixes the issue but shows "circular(InnerClassTypeA)".
Your Environment
- Version used: 4.2.0
Context
The relevant part of redacted OAS looks like this:
# ...
components:
schemas:
OuterClass:
type: object
properties:
_TYPE:
type: string
enum:
- type1
- type2
sharedProperty:
type: string
discriminator:
propertyName: _TYPE
mapping:
type1: "#components/schemas/OuterClassType1"
type2: "#components/schemas/OuterClassType2"
OuterClassType1:
allOf:
- $ref: "#components/schemas/OuterClass"
- type: object
properties:
# property named the same but different concrete schema per discriminated property
innerClass:
$ref: "#components/schemas/InnerClassTypeA"
OuterClassType2:
allOf:
- $ref: "#components/schemas/OuterClass"
- type: object
properties:
# property named the same but different concrete schema per discriminated property
innerClass:
$ref: "#components/schemas/InnerClassTypeB"
# never used directly but only "inherited" from with allOf
InnerClass:
type: object
properties:
_TYPE:
type: string
enum:
- typeA
- typeB
sharedProperty:
type: string
discriminator:
propertyName: _TYPE
mapping:
type1: "#components/schemas/InnerClassTypeA"
type2: "#components/schemas/InnerClassTypeB"
InnerClassTypeA:
allOf:
- $ref: "#components/schemas/InnerClass"
- type: object
properties:
specificFieldA:
type: string
InnerClassTypeB:
allOf:
- $ref: "#components/schemas/InnerClass"
- type: object
properties:
specificFieldB:
type: string
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 crash using the redacted OAS schema in the issue and compare the discriminator behavior between versions 4.1.0 and 4.2.0. No files or tests are named, so first trace the schema rendering path that accesses subProperties; done means the supplied nested allOf/discriminator case renders without the undefined-property error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, typescript
- Domain
- api, documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100