Skip to content

Schema Description Does Not Display When Polymorphic #2911

Description

@kentbulza

When a schema is a monomorph, the top level description displays. But when it's a polymorph (oneOf), the top level description does not display.

Monomorphic Schema

Here's an example JSON Schema that correctly display the description above the schema definition:

{"type": "object", "required": ["myElement"], "properties": {"myElement": {"type": "string", "description": "Here's a string"}}, "description": "I'm a monomorphic schema", "maxProperties": 1, "minProperties": 1}

Image

Polymorphic Schema

This example JSON Schema is polymorphic and does not display a description, although the description for each shape does display. This doesn't allow an overall description for the schema.

{"oneOf": [{"type": "object", "title": "Morph A", "required": ["tinySchemaWithString"], "properties": {"tinySchemaWithString": {"type": "object", "required": ["myStringElement"], "properties": {"myStringElement": {"type": "string", "description": "A string."}}, "description": "Morph A"}}, "description": "I might be this.", "additionalProperties": false}, {"type": "object", "title": "Morpb B", "required": ["tinySchemaWithNumber"], "properties": {"tinySchemaWithNumber": {"type": "object", "required": ["myNumberElement"], "properties": {"myNumberElement": {"type": "number", "description": "A number."}}, "description": "Morph B"}}, "description": "I might be that.", "additionalProperties": false}], "description": "I'm a polymorphic schema."}

Image Image

Activity

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

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