Skip to content

to-json-schema: incorrect type for examples attribute #1581

Description

@dzhu-amplify

I believe the type of JsonSchema.examples is incorrect. According to https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-validation-01#name-examples, the value of the attribute shouuld always be a list if present. However, the current type is JsonSchemaType | undefined, which includes many non-list types.

I think changing the type of the attribute to unknown[] would be more correct and allow removing some instances of @ts-expect-error (see below). Would that be a reasonable thing to do?


Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions