Skip to content

Validating URIs with URI-Templates #50

@devinbost

Description

@devinbost

I noticed that JSON Schema currently provides a mechanism to express URI values, as well as URI-reference and URI-template values. However, there is limited functionality for the validation of URIs. Currently, URIs can be validated via regex. However, regex matching can be an expensive operation, and it's not ideal for performing complex matching within a particular framework because complex regex patterns can be difficult to read and hard to maintain and debug.

RFC 6570 provides a rich framework for expressing patterns within URIs with greater structure than regex makes easy to do. However, JSON Schema doesn't currently provide a vocabulary for indicating if a URI-template expressed in a schema is intended for validation of a particular URI.
This level of validation could allow JSON Schema to detect invalid URIs, unexpected (and potentially malicious) web requests, and URIs that contain unknown paths (such as where parts of a URI are not in a set of expected enum values.)

I propose that JSON Schema adopt a mechanism to allow users to express a URI-template for validating a URI or URI-reference contained in that (or perhaps in another) schema.

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