Description
Describe the bug
I am extending a component schema by using allOf
. The first component definition (TestPage
) contains a property with type, properties and the rest of the schema of the component. The second (Page
) one only contains the same property with only a description, which I want to be the same for all extending objects. When using the preview command in the cli, the document I see in the browser has a response sample with said overridden property marked as null
, regardless of its definition.
To Reproduce
Steps to reproduce the behavior:
-
Given this
redocly.yaml
file
None -
And this OpenAPI file(s)
openapi: 3.1.0
info:
title: Test
version: 1.0.0
paths:
/test:
get:
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/TestPage'
components:
schemas:
Page:
type: object
properties:
page:
type: integer
total:
type: integer
content:
description: Awesome description
TestPage:
allOf:
- type: object
properties:
content:
type: array
items:
$ref: '#/components/schemas/TestSummary'
- $ref: '#/components/schemas/Page'
TestSummary:
type: object
properties:
id:
type: integer
name:
type: string
- Run this command with these arguments...
redocly ...
redocly preview-docs openapi.yaml
- See error
The generated response sample for status 200 is this:
{
"content": null,
"page": 0,
"total": 0
}
Expected behavior
I expected the property content
declared in TestPage
to contain its definition, regardless of being overridden in Page
, since the second doesn't contain a schema.
{
"content": [
{
"id": 0,
"name": "This is a test"
}
],
"page": 0,
"total": 0
}
Logs
-
OpenAPI description
-
Redocly Version(s)
1.19.0
Node.js
Version(s)
v20.13.1
Additional context
-