-
Notifications
You must be signed in to change notification settings - Fork 9
Intended date/time format for schema #17
Comments
@iadgovuser1 , great question. @froi or @RicardoAReyes , can you help clarify? Thanks! |
Hi @iadgovuser1, thanks for reaching out. In schema version 1.0.1 the date fields were just strings without the format specified. The intent of version 2.0.0 was always to give it a format to improve data quality. I believe that the intent was to accept both formats as stated in the description. Thanks for catching this oversight! We will be discussing what approach to take, although I think we will update the schema to permit both formats. Ex. "date": {
"type": "object",
"description": "A date object describing the release.",
"properties": {
"created": {
"anyOf": [{
"type": "string",
"format": "date"
},
{
"type": "string",
"format": "date-time"
}
],
"description": "The date the release was created, in YYYY-MM-DD or ISO 8601 format."
},
"lastModified": {
"anyOf": [{
"type": "string",
"format": "date"
},
{
"type": "string",
"format": "date-time"
}
],
"description": "The date the release was modified, in YYYY-MM-DD or ISO 8601 format."
},
"metadataLastUpdated": {
"anyOf": [{
"type": "string",
"format": "date"
},
{
"type": "string",
"format": "date-time"
}
],
"description": "The date the metadata of the release was last updated, in YYYY-MM-DD or ISO 8601 format."
}
},
"additionalProperties": false
} We will get back to you. |
@froi Thanks for the quick response. For now I've updated my code so it will validate against the current schema requirement (date only), but allowing both in the future would be great. |
I forgot to mention the project I'm using the schema with: https://github.com/nsacyber/CodeGov This is what I use to generate https://nsacyber.github.io/code.json Right now the schema is embedded in the code, but I might switch to dynamically retrieving the schema from https://github.com/GSA/code-gov-data/blob/master/schemas/schema-2.0.0.json |
Hi, @iadgovuser1 . I'm moving this to code-gov-data where we are now hosting the schema discussions. Thanks! |
https://github.com/GSA/code-gov-web/blob/master/src/assets/schemas/2.0.0.json#L243 has comments of "in YYYY-MM-DD or ISO 8601 format" for the dates. Is the intent to allow both date and date time formats or just a date format? The JSON Schema spec at http://json-schema.org/latest/json-schema-validation.html#rfc.section.7.3.1 shows "date" as being the same thing as "full-date" (date is same thing as full-date according to https://tools.ietf.org/html/rfc3339#section-5.6 ). Neither includes time. The current "date" value specified in the code.gov schema means just a date without time which explains why I'm getting errors with the library I'm using (https://github.com/JamesNK/Newtonsoft.Json.Schema/).
I'm taking dates from GitHub API calls and assigning them to certain code.gov schema fields but the schema isn't validating. Seems like the GitHub API uses the equivalent to date-time as far JSON Schema spec and RFC3339 is concerned.
Fix would be to either change code.gov schema to use date-time or I'd change my code to output a date string that's valid with what's currently in the schema (date). Former would probably be too big of a change than the later, but just wanted to ask what the intent was (date versus date-time). Seems like the intent is that code.gov schema wants date without time.
The text was updated successfully, but these errors were encountered: