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

oneOf not displaying correctly #1061

Open
imnotashrimp opened this issue Dec 31, 2024 · 0 comments
Open

oneOf not displaying correctly #1061

imnotashrimp opened this issue Dec 31, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@imnotashrimp
Copy link

imnotashrimp commented Dec 31, 2024

Describe the bug

When using a oneOf in a body schema, the rendered document shows MOD1 and MOD2 tabs, but neither actually renders the expected object.

Expected behavior

I'd expect to see an object that changes depending on the selected oneOf tab.

Current behavior

This is what's currently shown:

image

The body is not rendered.

However, if I remove the oneOf and move the properties to the body schema, everything renders as it should. In addition, Redoc shows the object as expected. So I believe this is a bug with this plugin, and not a problem with the schema.

Possible solution

Steps to reproduce

In an OAS 3.0 file, create an endpoint with this body schema and generate:

type: object
required:
  - files
  - restoreAccountId
oneOf:
  - properties:
      s3Target:
        $ref: ./S3RestoreTarget.yaml
    required:
      - s3Target
  - properties:
      storageAccountTarget:
        $ref: ./StorageAccountRestoreTarget.yaml
    required:
      - storageAccountTarget
properties:
  restoreAccountId:
    type: string
    description: ID of the restore account.
    example: 1ee34dc5-0a7c-4e56-a820-917371e05c8d
  prefix:
    type: string
    description: |
      Prefix to add to the restore path.
      If you don't specify a prefix, the files are restored to their respective folders in the original file tree, starting from the root of the bucket.
    example: my-restore-prefix

S3RestoreTarget.yaml:

type: object
required:
  - bucketName
description: |
  Information about the S3 bucket where you want to restore the files.
  If you don't specify a target, the files are restored to the original bucket.
properties:
  bucketName:
    type: string
    description: Name of an existing bucket to restore the files to.
    example: my-restore-bucket-12345
  encryptionKeyId:
    type: string
    description: ID of the key you want to use for encrypting the restored files.
    example: "arn:aws:kms:eu-central-1:123456789:key/1e61541a-5039-413a-b821-0f4f596b785b1514358"

StorageAccountRestoreTarget.yaml:

type: object
required:
  - name
  - container
description: |
  Information about the storage account where you want to restore the files.
  If you don't specify a target, the files are restored to the original storage account.
properties:
  name:
    type: string
    description: Name of the storage account to restore the files to.
    example: my-restore-storage-account-12345
  resourceGroup:
    type: string
    description: Name of the resource group that contains the storage account.
    example: my-restore-resource-group-12345
  container:
    type: string
    description: Name of the container in the storage account to restore the files to.
    example: my-restore-container-12345

Screenshots

(see screenshot above for how the plugin renders)

As an example of appropriate rendering, this video shows how it's rendered when creating a static html file with Redocly CLI:

2024-12-31_15-22-06.mp4

Context

There's really no additional context here; it's just that the output isn't as expected.

Your Environment

  • Version used: I tried on both 4.3.0 and 4.3.1, with Docusaurus 3.6.3.
  • Environment name and version (e.g. Chrome 59, node.js 5.4, python 3.7.3):
    • Arc Version 1.74.0 (57065)
    • Chromium Engine Version 131.0.6778.205
    • Node v20.14.0
  • Operating System and version (desktop or mobile): Desktop, macOS Sequoia 15.1.1
  • Link to your project: (private, no link available. Can provide redacted source if needed.)
@imnotashrimp imnotashrimp added the bug Something isn't working label Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant