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

MDS milliseconds timestamp constraints #645

Closed
tonial opened this issue May 11, 2021 · 3 comments
Closed

MDS milliseconds timestamp constraints #645

tonial opened this issue May 11, 2021 · 3 comments
Assignees
Labels
Schema Implications for JSON Schema or OpenAPI
Milestone

Comments

@tonial
Copy link
Contributor

tonial commented May 11, 2021

Is your feature request related to a problem? Please describe.

As an agency, we often see second timestamps instead of millisecond timestamp when a provider uses MDS for the first time and tries to send us data.

Describe the solution you'd like

In order to speed up bug detection on our side, we added a constraint that specifies that a timestamp should have 13 digits which allows dates between 2001-9-9 and 2286-11-20 (which is big enough).
Adding this into the Timestamp description and json schema could help to prevent this mistake.

Is this a breaking change

  • No, not breaking

Impacted Spec

All timestamps in all APIs

Describe alternatives you've considered

Additional context

@schnuerle schnuerle added this to the 1.2.0 milestone May 11, 2021
@schnuerle schnuerle added the Schema Implications for JSON Schema or OpenAPI label May 11, 2021
@schnuerle
Copy link
Member

Thank you @tonial. A reasonable request that could be updated in the next release. As the schema expert, what do you think @thekaveman ?

@thekaveman
Copy link
Collaborator

Yes, very reasonable request and should be as easy as modifying the common timestamp definition.

Right now, we have:

"timestamp": {
  "$id": "#/definitions/timestamp",
  "type": "number",
  "description": "Integer milliseconds since Unix epoch",
  "multipleOf": 1.0,
  "minimum": 0
},

Because this is a number type, we can't do a (string) length check. But an easy modification would be to change the minimum to correspond to @tonial's 13-digit starting point of 1000000000000.

Alternatively, a more realistic minimum could correspond to (for example) Jan 1, 2018 (the year MDS was first released), in UTC 1514764800000.

@schnuerle
Copy link
Member

Approved via PR #648. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Schema Implications for JSON Schema or OpenAPI
Projects
None yet
Development

No branches or pull requests

3 participants