You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a property of a model is a reference to another model, the property is not expandable.
Example spec:
openapi: "3.0.0"info:
version: 1.0.0title: Example APIdescription: Hellopaths:
/examples/{id}:
parameters:
- in: pathname: idschema:
type: stringdescription: The ID of the customer.required: trueput:
tags: [Examples]summary: Get an ExamplerequestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Example'responses:
'200':
description: OKcontent:
application/json:
schema:
$ref: '#/components/schemas/Example'application/xml:
schema:
$ref: '#/components/schemas/Example'components:
schemas:
Metadata:
description: About the entity.readOnly: trueproperties:
createdBy:
type: stringdescription: Who made it.createdAt:
type: stringdescription: When they made it.format: date-timeExample:
description: An example model.required: [test, meta]properties:
test:
type: stringdescription: A test field.meta:
$ref: '#/components/schemas/Metadata'tags:
- name: Examplesdescription: | A small example demonstrating the issue.
As you can, the meta field of the Example model is not expandable in the documentation.
I think I have found where the bug is: https://github.com/Rebilly/ReDoc/blob/597688e7208159864c0d5964237df6fb3445e2b7/src/services/models/Schema.ts#L96
At this line, the schema's type is used or type detection happens. However, for references, the type of the schema is undefined. This is no problem; the type detections correctly determines that it is in fact an object. The problem lies later: multiple functions rely on the schema's type, which is undefined.
I believe this could be fixed by:
Finding out why (if this is a problem, not sure) a property with referenced model has an undefined type
Set the type of the schema to the one returned by detectType (I'm not sure if this breaks things)
The text was updated successfully, but these errors were encountered:
When a property of a model is a reference to another model, the property is not expandable.
Example spec:
See the result here: https://rebilly.github.io/ReDoc/?url=https://gist.githubusercontent.com/niknetniko/ebdd032f6e4e132c0864b32181bfaef1/raw/61fe049675904795b9b45adaacffa7acbaa3800a/sample.yaml#tag/Examples
As you can, the
meta
field of theExample
model is not expandable in the documentation.I think I have found where the bug is:
https://github.com/Rebilly/ReDoc/blob/597688e7208159864c0d5964237df6fb3445e2b7/src/services/models/Schema.ts#L96
At this line, the schema's type is used or type detection happens. However, for references, the type of the schema is undefined. This is no problem; the type detections correctly determines that it is in fact an object. The problem lies later: multiple functions rely on the schema's type, which is undefined.
I believe this could be fixed by:
detectType
(I'm not sure if this breaks things)The text was updated successfully, but these errors were encountered: