Skip to content

Validate formats in check_schema #1278

@alliefitter

Description

@alliefitter

I'm wondering if there's a way to validate formats when using check_schema. It seems to allow invalid format names. The below example passes validation, even though datetime should be date-time. I noticed the concrete implementation of check_schema has a format_checker argument (even though the FormatChecker protocol does not have this argument). Setting the format checker doesn't validate format names either. Is there anyway to get check_schema to fail for invalid formats?

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "foo": {"type": "string", "minLength": 2},
    "bar": {"type": "number", "minimum": 10},
    "baz": {"type": "string", "format": "datetime"}
  }
}

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