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

data attribute filter accepts date-time #473

Open
flinden68 opened this issue Nov 13, 2024 · 5 comments
Open

data attribute filter accepts date-time #473

flinden68 opened this issue Nov 13, 2024 · 5 comments
Labels
enhancement New feature or request triage

Comments

@flinden68
Copy link

Thema / Theme

Objecten API

Omschrijving / Description

Momenteel kunnen we voor bijvoorbeeld LTE alleen maar een date of numeric waarde gebruiken.
Maar in ons object hebben we te maken met date-time en dan faalt het LTE filter als je de huidige datum gebruikt om alle objecten op wilt halen voor vandaag en ouder.

Toegevoegde waarde / Added value

Hierdoor kan je beter filteren op basis van een date-time

Aanvullende opmerkingen / Additional context

No response

@flinden68 flinden68 added enhancement New feature or request triage labels Nov 13, 2024
@alextreme
Copy link
Member

JSON doesn't have a native datetime format so this will be quite complicated, we would recommend to store the date separately if it is necessary to filter on it

@sdegroot
Copy link

@alextreme what do you mean there is no native date time format? If you mean that dates are serialised either as numeric timestamps or string values (RFC 3339 / ISO 8601) then yes.

However, JSON Schema very much allows to enforce those standards upon a property using the "format" attribute.
See https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-validation-00#rfc.section.7.3

Unfortunately, the validator used in objects-api/objecttypes-api does not adhere to the standards and simply ignores the format field. I discussed this several months ago with @joeribekker but haven't heard back about this.

@flinden68 is this what you meant?

@flinden68
Copy link
Author

@sdegroot yes, because we pass on the date also a date format as string, should be that hard also accept a date-time formatted string

@alextreme
Copy link
Member

@sdegroot https://json-schema.org/understanding-json-schema/reference/string#format

The format keyword allows for basic semantic identification of certain kinds of string values that are commonly used. For example, because JSON doesn't have a "DateTime" type, dates need to be encoded as strings. format allows the schema author to indicate that the string value should be interpreted as a date. By default, format is just an annotation and does not effect validation.

Optionally, validator implementations can provide a configuration option to enable format to function as an assertion rather than just an annotation. That means that validation will fail if, for example, a value with a date format isn't in a form that can be parsed as a date. This can allow values to be constrained beyond what the other tools in JSON Schema, including Regular Expressions can do.

@sdegroot
Copy link

Ah, so it is optional. I would highly suggest enabling this as it will increase data quality -a lot- :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage
Projects
None yet
Development

No branches or pull requests

3 participants