Skip to content

Error parsing valid JSON Schema for array types #51

@ParkerSm1th

Description

@ParkerSm1th

Hi there!

First wanted to start off by saying thanks for working on such a great package, it's allowed my team to move super quickly and has been great.


Issue

Recently we noticed that some valid JSON Schema causes dezerialize to throw, specifically array item types. Here's an example:

The below is the correct JSON Schema but causes zodex to throw:

{
  "type": "object",
  "properties": {
    "myArray": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  }
}

What works correctly for zodex, but is invalid json schema and wouldn't properly validate if the JSON Schema was used:

{
  "type": "object",
  "properties": {
    "myArray": {
      "type": "array",
      "element": {
        "type": "string"
      }
    }
  }
}

I was curious if it would be possible to fix this case? Obviously for backwards compatibility element would still need to continue working but it'd be nice if zodex more closely respected the json schema spec.

Thanks in advance!

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