Skip to content

API for determining supported schema URIs #1067

Closed as not planned
Closed as not planned
@ikonst

Description

@ikonst

Since 836db7c, there's no more public API for determining the supported schema URIs.

Providing an unsupported URI silently uses the latest draft, and I'd like to be able to prevent this, or alert the user in my app. That alone I can do (a bit awkwardly) with

sentinel = object()
validator = validator_for(schema, sentinel)
if validator is sentinel:
  if schema_uri := schema.get('$schema')
    raise ValueError(f"Schema had unsupported {schema_uri!r}")
  else:
    raise ValueError("Schema had no $schema, refusing to default")

What I still cannot do, is be more helpful and list the supported URIs, because meta_schemas is private now.

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