Skip to content

Commit

Permalink
Add $id field to schema with versioned URL
Browse files Browse the repository at this point in the history
  • Loading branch information
camargo committed Jun 12, 2023
1 parent 9cac032 commit f71e018
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nasa-jpl/seq-json-schema",
"version": "1.0.19",
"version": "1.0.20",
"license": "MIT",
"type": "module",
"repository": {
Expand All @@ -19,7 +19,7 @@
},
"devDependencies": {
"ajv": "^8.12.0",
"json-schema-to-typescript": "^13.0.1",
"json-schema-to-typescript": "^13.0.2",
"prettier": "^2.8.8"
}
}
2 changes: 1 addition & 1 deletion schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$id": "SeqJson",
"$id": "https://github.com/NASA-AMMOS/seq-json-schema/tree/v1.0.20",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$defs": {
"activate": {
Expand Down
9 changes: 8 additions & 1 deletion scripts/generate-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@ import { writeFileSync } from 'fs';
* @return {string}
*/
function patchTypes(types) {
// Remove the 'Request1' object since the library does not generate the
// Remove the 'Request1' object since the library does not generate the
// correct type for the request 'oneOf' in the schema.
// See: https://github.com/bcherny/json-schema-to-typescript/issues/381
types = types.replace(/ \& Request1/, '');
types = types.replace(
`export type Request1 =\n | {\n [k: string]: unknown;\n }\n | {\n [k: string]: unknown;\n };\n`,
'',
);

// Update the main interface so the base type is named 'SeqJson'.
types = types.replace(
/export interface HttpsGithubComNASAAMMOSSeqJsonSchemaBlob.*SchemaJson {/,
'export interface SeqJson {',
);

return types;
}

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
name='seq-json-schema',
packages=['seq-json-schema'],
url='https://github.com/NASA-AMMOS/seq-json-schema',
version='1.0.19'
version='1.0.20'
)

0 comments on commit f71e018

Please sign in to comment.