vertx-json-schema icon indicating copy to clipboard operation
vertx-json-schema copied to clipboard

Support for custom string formats

Open dallasanta opened this issue 2 years ago • 0 comments

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 avatar Nov 10 '23 10:11 dallasanta