Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Referenced schemas lose default property #2588

Open
onavratil-monetplus opened this issue Sep 11, 2024 · 1 comment
Open

Referenced schemas lose default property #2588

onavratil-monetplus opened this issue Sep 11, 2024 · 1 comment
Assignees

Comments

@onavratil-monetplus
Copy link

Describe the bug

Redocly often fails to display default values of properties, although they are defined in accordance with standard.

To Reproduce
Steps to reproduce the behavior:

Given this api and separate model:

openapi: 3.1.0
tags:
  - name: test
info:
  title: Bundle Sample
  version: '0.1.0'
  description: |
    Sample API
  contact:
    name: Ondřej Navrátil
    email: [email protected]
servers:
  - url: '127.0.0.1'
    description: localhost
paths:
  /test-endpoint:
    post:
      summary: Sample endpoint
      operationId: post-something
      description: |-
        xxx.
      requestBody:
        content:
          application/json:
            schema:
                type: object
                properties:
                  testProperty:
                    $ref: some-model.yaml
                  testProperty2:
                    title: Test Property 2
                    description: |
                      Whatever2.
                    type: string
                    enum:
                      - ABCD
                      - EFGH
                    default: ABCD
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  testProperty:
                    $ref: some-model.yaml
      tags:
        - test

Model:

title: Test Property
description: |
  Whatever.
type: string
enum:
  - ABCD
  - EFGH
default: ABCD

Running the following

$ redocly build-docs sample-api.yaml 

...redocly fails to display defaults in the referenced schemas. Note that the same model is displayed correctly when explicitly dereferenced.

image

Expected behavior

Defaults are displayed even in referenced models.

Logs

No idea what the warning means, but AFAIK is not related to the problem.

(node:2452) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Found undefined and using theme.openapi options
Prerendering docs

🎉 bundled successfully in: redoc-static.html (43 KiB) [⏱ 2ms].

OpenAPI description

See above

Redocly Version(s)

$ redocly --version
1.25.0

Node.js Version(s)

$ node --version
v22.8.0

OS, environment

$ uname -a
Linux nb-onavratil2 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Additional context

@AlexVarchuk AlexVarchuk transferred this issue from Redocly/redocly-cli Sep 11, 2024
@AlexVarchuk AlexVarchuk self-assigned this Sep 11, 2024
@AlexVarchuk AlexVarchuk added the p2 label Sep 11, 2024
@AlexVarchuk
Copy link
Collaborator

hi @onavratil-monetplus. Thank you for the issue. We'll take a look into it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants