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 13, 2023
1 parent 9cac032 commit db5d756
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!-- Thank you for your Pull Request! -->
<!-- Please make sure your commit increments the package version in package.json, package-lock.json, and schema.json. -->
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
6 changes: 5 additions & 1 deletion scripts/generate-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ 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 HttpsGithubComNASAAMMOSSeqJsonSchemaTree.* {/, 'export interface SeqJson {');

return types;
}

Expand Down
8 changes: 7 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
from json import loads
from pathlib import Path
from setuptools import setup

this_directory = Path(__file__).parent
long_description = (this_directory / 'README.md').read_text()

with open(this_directory / 'package.json', 'r') as f:
package_json = f.read()

version = loads(package_json).get('version')

setup(
author='camargo',
author_email='[email protected]',
Expand All @@ -14,5 +20,5 @@
name='seq-json-schema',
packages=['seq-json-schema'],
url='https://github.com/NASA-AMMOS/seq-json-schema',
version='1.0.19'
version=version
)

0 comments on commit db5d756

Please sign in to comment.