Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extensible format validator #1

Open
kpy3 opened this issue May 4, 2023 · 0 comments
Open

Extensible format validator #1

kpy3 opened this issue May 4, 2023 · 0 comments

Comments

@kpy3
Copy link

kpy3 commented May 4, 2023

Hello,

SWAG/OpenAPI specification has parameter attribute called format which can be used to specify acceptable format for given type. For example one can specify following:

schema:
    type: object
    properties:
        startDate:
            type: string
            format: date

where date could be an RFC3339 date ("yyyy-mm-dd"). This specification can (and should) be used for validation before passing data to underlying handler. Another examples are URL, email, phone number or zip code. These formats need special attention because they may have different format for different countries (or API requirements), therefore there should be ability to specify validator for format in addition to some standard validators (for formats defined in OpenAPI specification).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant