Skip to content

Array fields #87

Closed
Closed
@bertramakers

Description

@bertramakers

Hi @tobyzerner ! Today I was wondering how to define a field of a specific type like Str, Integer, Date, ... that accepts multiple values.

In JSON Schema it could be described as this for e.g. an array of 1-10 values, each one a string from 1-255 characters:

{
  "type": "object",
  "properties": {
    "tags": {
      "type": "array",
      "minItems": 1,
      "maxItems": 10,
      "items": { // This part can already be defined using the built-in `Str`, `Integer`, etc classes
        "type": "string",
        "minLength": "1",
        "maxLength": "255"
      }
    }
  }
}

Valid value for the example:

{
  "tags": [
    "tag_1",
    "tag_2"
  ]
}

Invalid examples:

{
  "tags": "tag_1"
}
{
  "tags": [
    "tag_1",
    1000,
    false
  ]
}

Do you plan to support fields like this in the future? Or do you maybe already have a solution for this that I'm overlooking?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions