-
Notifications
You must be signed in to change notification settings - Fork 37
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
Property definitions type for timestamp (and other non-json OPTIMADE types) #443
Comments
I'm not sure we need to add this (though it would perhaps be nice just for compatibility again with the older versions). You can express datetimes in JSON Schema using the "last_modified": {
"title": "Last Modified",
"type": "string",
"description": "Date and time representing when the entry was last modified.\n\n- **Type**: timestamp.\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response unless the query parameter `response_fields` is present and does not include this property.\n\n- **Example**:\n - As part of JSON response format: `\"2007-04-05T14:30:20Z\"` (i.e., encoded as an [RFC 3339 Internet Date/Time Format](https://tools.ietf.org/html/rfc3339#section-5.6) string.)",
"format": "date-time"
} Here's a full list of the string formats we could use: https://json-schema.org/understanding-json-schema/reference/string.html#built-in-formats (we are already using email and URL in the OpenAPI spec) Again, perhaps we can just add a note to say that this is the way to express these derived types? |
Right, but, an implementation that wants to interpret the property definition in context of an output format that has a native timestamp datatype needs to be able to understand that a property definition of, e.g., I'm halfway convinced we should simply add a mandatory |
I'm with you now -- this seems like something we could easily add now if we want to, if it is just constrained to our existing types? (i.e., we don't want to support implementation-specific types) |
I'm not sure how we missed this :-), but the definition of the
type
field in the property definitions go through each JSON data type and explain what it corresponds to in terms of OPTIMADE data types. But, that means it never says what to do for timestamps.To keep the property format valid JSON schema, the standard type field needs to be "string". But, this means we need to add another type field (
x-optimade-type
?) to spell out "datetime" somewhere.This will also be important to figure out for other new datatypes we add in the future, e.g., there is a proposal for a SMILES datatype #436.
The text was updated successfully, but these errors were encountered: