docusaurus-openapi-docs icon indicating copy to clipboard operation
docusaurus-openapi-docs copied to clipboard

additionalProperties object specified via $ref is rendered with the ref's name in the description

Open johnmaguire opened this issue 2 years ago • 1 comments

Describe the bug

$ cat Downloads.yaml
type: object
properties:
  dnclient:
    type: object
    properties:
      latest:
        description: Download links for the latest DNClient version
        $ref: './DownloadsDNClientLinks.yaml'
    additionalProperties:
      $ref: './DownloadsDNClientLinks.yaml'

$ cat DownloadsDNClientLinks.yaml
type: object
description: Download links for a given DNClient version
properties:
  linux-amd64:
    type: string
  linux-arm64:
    type: string
  macos-universal:
    type: string
  macos-universal-dmg:
    type: string
  windows-amd64:
    type: string
  windows-arm64:
    type: string
additionalProperties:
  x-additionalPropertiesName: os-platform
  type: string

Expected behavior

Screenshot 2023-04-07 at 2 39 36 PM

Current behavior

Screenshot 2023-04-07 at 2 18 30 PM

Possible solution

Adding the file name of the $ref is confusing as a docs consumer, as it has no relevance to me. It's simply an implementation detail of how the OpenAPI spec is defined. The hardcoded property doesn't show the $ref, but additionalProperties does. My preference is to remove the $ref name from the output.

Steps to reproduce

Build docs using specs listed above.

Screenshots

See above.

Context

n/a

Your Environment

  • Version used: docusaurus 2.4.0 & docusaurus-plugin-openapi-docs 2.0.0-beta.2
  • Environment name and version (e.g. Chrome 59, node.js 5.4, python 3.7.3): node.js 18.7.0
  • Operating System and version (desktop or mobile): Linux

johnmaguire avatar Apr 07 '23 18:04 johnmaguire

:tada: Thanks for opening your first issue here! Welcome to the community!