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

Relax naming convention for date/time properties #811

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions chapters/json-guidelines.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -146,21 +146,18 @@ declaring possible values for a <<137,rule 137>> [`sort` parameter].


[#235]
== {SHOULD} name date/time properties with `_at` suffix
== {SHOULD} use naming convention for date/time properties

Dates and date-time properties should end with `_at` to distinguish them from
boolean properties which otherwise would have very similar or even identical
names:
Naming of date and data-time properties should comply with the following convention:
The name either (i) contains `date`, `day`, `time`, `timestamp` or similar type indicators,
or (ii) end with the `_at` suffix. The convention allows easy identification of date/time
typed properties and distinguishing them e.g. from boolean properties like `created` vs. `created_at`.
Examples of valid date/time property names:

- {created_at} rather than {created},
- {modified_at} rather than {modified},
- `occurred_at` rather than `occurred`, and
- `returned_at` rather than `returned`.
- `created_at`, `modified_at`, `occurred_at`, `returned_at` -- instead of `created`, `modified`, ...
- `campaign_start_time`, `arrival_date`, `checkout_time` -- instead of `campaign_start`, `arrival`, ...

**Hint:** Use `format: date-time` (or as `format: date`) as required in <<238>>.

**Note:** {created} and {modified} were mentioned in an earlier version of the
guideline and are therefore still accepted for APIs that predate this rule.
**Hint:** Use `format: date-time` or `format: date` as required in <<238>>.


[#216]
Expand Down
Loading