Skip to content

Commit 0eac661

Browse files
committed
Specify format: 'date-time' for date properties
1 parent f6eb76c commit 0eac661

File tree

6 files changed

+52
-16
lines changed

6 files changed

+52
-16
lines changed

build/compile-validators.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import path from 'node:path';
1414
import url from 'node:url';
1515

1616
import Ajv from 'ajv';
17+
import addFormats from "ajv-formats"
18+
1719
import mkdirp from 'mkdirp';
1820
import standaloneCode from 'ajv/dist/standalone/index.js';
1921

@@ -59,7 +61,8 @@ const schemas = {
5961
PublicJwk
6062
};
6163

62-
const ajv = new Ajv({ code: { source: true, esm: true } });
64+
const ajv = new Ajv({ code: { source: true, esm: true }, allowDate: 'string' });
65+
addFormats(ajv);
6366

6467
for (const schemaName in schemas) {
6568
ajv.addSchema(schemas[schemaName], schemaName);

json-schemas/hooks/hooks-write.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
"type": "string"
3636
},
3737
"dateCreated": {
38-
"type": "string"
38+
"type": "string",
39+
"format": "date-time"
3940
},
4041
"schema": {
4142
"type": "string"

json-schemas/records/records-query.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"type": "string"
3535
},
3636
"dateCreated": {
37-
"type": "string"
37+
"type": "string",
38+
"format": "date-time"
3839
},
3940
"filter": {
4041
"type": "object",
@@ -71,10 +72,12 @@
7172
"additionalProperties": false,
7273
"properties": {
7374
"from": {
74-
"type": "string"
75+
"type": "string",
76+
"format": "date-time"
7577
},
7678
"to": {
77-
"type": "string"
79+
"type": "string",
80+
"format": "date-time"
7881
}
7982
}
8083
}

json-schemas/records/records-write.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,19 @@
121121
"type": "number"
122122
},
123123
"dateCreated": {
124-
"type": "string"
124+
"type": "string",
125+
"format": "date-time"
125126
},
126127
"dateModified": {
127-
"type": "string"
128+
"type": "string",
129+
"format": "date-time"
128130
},
129131
"published": {
130132
"type": "boolean"
131133
},
132134
"datePublished": {
133-
"type": "string"
135+
"type": "string",
136+
"format": "date-time"
134137
},
135138
"dataFormat": {
136139
"type": "string"

package-lock.json

Lines changed: 32 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
"@types/readable-stream": "2.3.15",
6161
"@types/secp256k1": "4.0.3",
6262
"abstract-level": "1.0.3",
63-
"ajv": "8.11.0",
63+
"ajv": "8.12.0",
64+
"ajv-formats": "^2.1.1",
6465
"blockstore-core": "3.0.0",
6566
"cross-fetch": "3.1.5",
6667
"date-fns": "2.28.0",

0 commit comments

Comments
 (0)