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

Support for custom string formats #119

Open
dallasanta opened this issue Nov 10, 2023 · 0 comments
Open

Support for custom string formats #119

dallasanta opened this issue Nov 10, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@dallasanta
Copy link

Describe the feature

According to the OpenAPI specification, string "format" is an open value (https://swagger.io/docs/specification/data-models/data-types/#string)

However, format is an open value, so you can use any formats, even not those defined by the OpenAPI Specification, such as:

That's also backed by the JSON Schema Specification Draft 2020-12](https://tools.ietf.org/html/draft-bhutton-json-schema-00#section-7.2.3)

Implementations MAY support custom format attributes.

The feature request is to support custom "format" fields, not only those defined in the above JSON Schema Specification and implemented on https://github.com/eclipse-vertx/vertx-json-schema/blob/4.4.6/src/main/java/io/vertx/json/schema/impl/Format.java

A regular expression pattern should not ideally be used for that as:

  • Users can find it hard to understand
  • Can't be reused - there's no way to use a $ref for a regular expression pattern in OpenAPI

Use cases

As an organization API provider
I want to be able to create custom string formats
So I can communicate to the API users the expected format
And I can run the correct validation

Contribution

Are you volunteering for implementing this feature? 👍

@dallasanta dallasanta added the enhancement New feature or request label Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant