Skip to content

schema.Type should be string or []string #151

@chancez

Description

@chancez

Types are not only singular, but can be an array of valid types: https://json-schema.org/understanding-json-schema/reference/type

The schema.Type field currently only supports a single type currently, but should also support an array of types if many are provided.

I'd be open to implementing this myself, but wanted feedback before opening a PR.

  1. Since this would be a breaking change, should I do it as a new field/struct tag?
  2. How should it be implemented? I could add a new type:
type SchemaType struct {
  Type string
  Types []string
}

Or the existing value could be changed from string to []string, and in the singular case, it would just be a list with a single element. When rendering to JSON it could render it conditionally to a single string or a list, based on how many entries there are.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions