-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Create a format
Registry
#845
Comments
Summary of existing formats used in the wild. https://github.com/Mermade/openapi-specification-extensions/blob/master/formats/combined.tsv It may be worth recommending that format strings only contain lower-case letters, digits and hyphens, or some other restriction, to draw attention to the fact it is not intended as an essay on the content of the property or an enum, pattern or template. |
Relevant: json-schema-org/json-schema-spec#563 |
Proposed candidates discussed in other issues (work-in-progress):
|
And there are a bunch more here #607 |
@MikeRalphson regarding "core" OAS formats:
@darrelmiller regarding #607:
|
What's the difference between "byte" and "binary"?
I would separate a possible |
The JSON-P API for Java use the following algorithm for long and a similar one for other extended numeric types: if (value >= 9007199254740992 || value <= -9007199254740992)
serializeAsString(value);
else
serializeAsNumber(value); IMO, it is bad idea but they claim it is the "industry standard" as well as the correct interpretation of the JSON RFC. |
I propose the fixed-point numeric
|
Don't you just love standards organizations that want money for their work? https://webstore.iec.ch/publication/59685 |
Use the draft, Luke ;) |
I don't see much gain in distilling formats down to simple regexes. The advantage of the "format" keyword is to be able to specify constraints that are not possible with a simple regexp, such as "date" which not only checks that digits and symbols are in the right place in the string, but also that the value represents a real date (for example "2021-13-13 25:00:00" passes a simple regexp but is not actually a valid date). FWIW, many json schema implementations do support plugging additional formats into them -- but this cannot be done with data, but with code, due to the nature of format validation -- so there is no standard for doing so, and will be different for every implementation/language/platform. |
Since OAS 3.1 is out now, with JSON Schema draft 2020-12 support including support for extension vocabularies, I would recommend closing this and focusing on adding vocabularies to meet the various needs. OAI can at some point designate certain vocabularies as preferred without breaking any compatibility guarantees at all. Or even make certain ones mandatory, which would still be backwards compatible but would require work to ensure that the newly mandatory vocabularies are supported. Presumably, only well-supported vocabularies would be blessed in that way, though. For those who do not know the saga of
This was a mess, so in draft 2019-09 (which introduced extension vocabularies), we made The point of vocabulary support is that, as a schema author, you can indicate what extension vocabularies MUST be present in order for your schema to be correctly processed. This is not possible with
I hope this gives a feel for why JSON Schema wants to move away from |
... Agreed. My comment more of an "in lieu of anything better..." idea. Support for vocabularies/dialects is a much better way to support something like this. |
@Bessonov if you have particular questions or concerns that led you to put a "confused" emoji on my comment, I'd be happy to address them. |
Hey @handrews , thanks for pinging! Github emoji 😕 description doesn't make any sense for me. I use it in terms of "unhappy", like ":(". In this particular case I'm unhappy with current state and described challenges. Not with your explanation ❤️ |
hi everyone 👋 And here https://json-schema.org/draft/2020-12/json-schema-validation.html#name-defined-formats |
Thanks for the pointers. Everyone: I put a PR together at #3167 feel free to give it a look and tell me what I missed :) |
Update: The main PR has been merged. There are a couple of follow up PRs you should jump on if you're interested in the specific topics: |
I've uploaded a more recent summary of formats in the wild from 2021. |
I was looking for a format to constrain IP addresses with a CIDR yesterday, I tried |
@Speeddymon could you open a new issue to request that please? The issue should be in this repository, and I recommend you include your use cases to help us understand the request. |
This was fixed in #3167 |
In reference to #607 and #811.
Instead of adding additional formats to the spec, we're considering two options - either a set of formats in a supporting guidelines document or a formal OAI format registry with a set of guidelines how to enter new formats to it. The registry will serve as an official repository for these formats and tools could use it as a reference. The @OAI/tdc is currently leaning towards the option of the repository.
This ticket is a reminder to tackle it and finalize the approach and the guidelines for either case.
The text was updated successfully, but these errors were encountered: