-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SCV-89: Updating the schema validator so that it will use the latest …
…STAC version.
- Loading branch information
1 parent
87da23c
commit c41f774
Showing
25 changed files
with
628 additions
and
4,364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,3 +141,5 @@ $RECYCLE.BIN/ | |
|
||
# IntelliJ | ||
.idea/ | ||
|
||
stac-spec/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
npm install | ||
if [[ $? != 0 ]]; then | ||
echo 'npm install failed' | ||
exit 1 | ||
fi | ||
|
||
if [[ ! -d stac-spec ]]; then | ||
echo "Cloning stac-spec" | ||
git clone "https://github.com/radiantearth/stac-spec.git" | ||
if [[ $? != 0 ]]; then | ||
echo 'git clone failed' | ||
exit 1 | ||
fi | ||
fi | ||
cd stac-spec | ||
git checkout 37ff5fe75f3639e25d452f483a2c84a7c34374bf | ||
if [[ $? != 0 ]]; then | ||
echo 'git checkout failed' | ||
exit 1 | ||
fi | ||
cd .. | ||
|
||
compile_schema() { | ||
node bin/compile_schema.js $1 $2 | ||
if [[ $? != 0 ]]; then | ||
echo 'Compilation failed' | ||
exit 1 | ||
fi | ||
} | ||
|
||
compile_schema stac-spec/item-spec/json-schema/item.json search/docs/item.json | ||
compile_schema stac-spec/catalog-spec/json-schema/catalog.json search/docs/catalog.json | ||
compile_schema stac-spec/collection-spec/json-schema/collection.json search/docs/collection.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const $RefParser = require('@apidevtools/json-schema-ref-parser'); | ||
const fs = require('fs'); | ||
const { promisify } = require('util'); | ||
const writeFile = promisify(fs.writeFile); | ||
|
||
const args = process.argv.slice(2); | ||
|
||
if (args.length !== 2) { | ||
console.error('Expects two arguments: source schema file and output file'); | ||
process.exit(1); | ||
} | ||
|
||
const [sourceSchemaFile, outputFile] = args; | ||
|
||
(async () => { | ||
const derefed = await $RefParser.dereference(sourceSchemaFile, { | ||
dereference: { | ||
circular: 'ignore' | ||
} | ||
}); | ||
await writeFile(outputFile, JSON.stringify(derefed, null, 2)); | ||
})() | ||
.then(() => { | ||
console.log(`Output ${outputFile}`); | ||
}).catch((error) => { | ||
console.log(error); | ||
process.exit(1); | ||
}); |
Oops, something went wrong.