Skip to content

patternProperties is ignored when properties is absent #1197

@theAnuragMishra

Description

@theAnuragMishra

Description

The SchemaProperties components just returns null if properties === undefined || !Object.keys(properties), that is, there is no element in properties. This affects every ui that uses asyncapi-react to render the document visually. For instance, here's a related issue asyncapi/studio#1223.

Expected result

patternProperties should be rendered regardless of whether there is an element in properties or not.

Actual result

patternProperties are not rendered when there is nothing to show in properties.

Steps to reproduce

use any ui that uses asyncapi-react, for example studio.asyncapi.com.
paste this schema in the editor:

asyncapi: 3.0.0
info:
  title: Account Service
  version: 1.0.0
components:
  schemas:
    Shadow:
      type: object
      properties:
        id:
          type: string
          format: uuid
      patternProperties:
        "^[a-zA-Z0-9]+$":
            type: string

    Camera:
      type: object
      patternProperties:
        "^[a-zA-Z0-9]+$":
            type: string

You will see that patternProperties are rendered for Shadow but not for Camera.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions