generated from camaraproject/Template_API_Repository
-
Notifications
You must be signed in to change notification settings - Fork 29
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
String format/pattern recommendation #330
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -1337,14 +1337,15 @@ This part describes the list of possible messages returned by the API. It also i | |||||||
This part captures a detailed description of all the data structures used in the API specification. For each of these data, the specification must contain: | ||||||||
- Name of the data object, used to reference it in other sections. | ||||||||
- Data type (String, Integer, Object…). | ||||||||
- If the format of a string is date-time following sentence must be present in the description: `It must follow [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) and must have time zone. Recommended format is yyyy-MM-dd'T'HH:mm:ss.SSSZ (i.e. which allows 2023-07-03T14:27:08.312+02:00 or 2023-07-03T12:27:08.312Z)` | ||||||||
- If the data type is string it is recommended to use appropriate modifier property `format` and/or `pattern` whenever possible. The [OpenAPI Initiative Formats Registry](https://spec.openapis.org/registry/format/) contains the list of formats used in OpenAPI specifications. | ||||||||
- If the format of a string is `date-time`, the following sentence must be present in the description: `It must follow [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6) and must have time zone. Recommended format is yyyy-MM-dd'T'HH:mm:ss.SSSZ (i.e. which allows 2023-07-03T14:27:08.312+02:00 or 2023-07-03T12:27:08.312Z)` | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
- If the data type is an object, list of required properties. | ||||||||
- List of properties within the object data, including: | ||||||||
- Property name | ||||||||
- Property description | ||||||||
- Property type (String, Integer, Object …) | ||||||||
- Other properties by type: | ||||||||
- String ones: min and max longitude | ||||||||
- String ones: min and max length | ||||||||
- Integer ones: Format (int32, int64…), min value. | ||||||||
|
||||||||
|
||||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is inherited from the current text, but ISO 8601 defines date format as YYYY-MM-DD. RFC 3339 expresses formats in ABNF, so does not define an equivalent formatting string, but YYYY-MM-DD is not wrong for RFC 3339.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yyyy-MM-dd'T'HH:mm:ss.SSSZ
template is typical for java, so it is somehow developer friendly.As the change would require updating OAS using
date-time
I would prefer to keep it as it is.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I didn't realise this was a Java notation. As far as I can tell, whether the letter placeholder is upper or lower case makes no difference to the allowed values. Adding a reference to the Java definition at some point in the future might help interpret this string.
As
format: date
is used by some APIs, I will add a line for that as well.