Skip to content

Ability to provide message when specifying pattern for a query parameter in openapi yml files #2662

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

Closed
vardhanjai123 opened this issue Jul 30, 2021 · 2 comments

Comments

@vardhanjai123
Copy link

I am specifying something like this in openapi yml file.
- name: "City" in: "query" schema: type: string pattern: '(\s*\S\s*)+' description: "City component of the address" required: true
When the value of city parameter does not matches regex, right now, it shows a message by itself.

I have usecase wherein, I want to provide a message by myself.
I want something like this in future
- name: "City" in: "query" schema: type: string pattern: '(\s*\S\s*)+' message: "City field requires atleast one non-whitespace character" description: "City component of the address" required: true

Is it possible to achieve something like this?

@MikeRalphson
Copy link
Member

When you say "it shows a message by itself", are you thinking about a specific tool?

We delegate the schemaObject definition to the JSON Schema spec, so keywords to extend/override validation messages are probably best discussed there. I found the following related issue: json-schema-org/json-schema-spec#1075

@OAI OAI deleted a comment Aug 18, 2021
@MikeRalphson
Copy link
Member

Closing due to inactivity - but please feel free to reopen the issue if necessary.

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

No branches or pull requests

2 participants