Skip to content
Snippets Groups Projects
Commit 3180005e authored by Klaus Fischer's avatar Klaus Fischer
Browse files

Merge branch 'mr-schema-regex' into 'main'

Replace $schema enum by $schema pattern

See merge request !5
parents 4e3d4f57 7b29165c
No related branches found
No related tags found
1 merge request!5Replace $schema enum by $schema pattern
Showing
with 58 additions and 4 deletions
......@@ -3,6 +3,7 @@
*.iml
.idea/
dist/
examples/
# Dependencies
node_modules/
......@@ -11,3 +12,6 @@ node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
examples/
examples_fail/
......@@ -13,6 +13,7 @@ workflow:
stages:
- lint
- test
- build
- upload
......@@ -61,3 +62,21 @@ upload:release:
script:
- sed -i "s,SCHEMA_VERSION,$CI_COMMIT_TAG,g" dist/set-payload.schema.json
- rsync -Lvz -e "ssh -o CheckHostIP=no" ./dist/set-payload.schema.json fitko@dorado.uberspace.de:schema.fitko.de/fit-connect/set-payload/$CI_COMMIT_TAG/
test:
stage: test
image: $CI_REGISTRY/node:current-alpine
before_script:
- yarn
- yarn bundle
script:
- yarn test
test-failing:
stage: test
image: $CI_REGISTRY/node:current-alpine
before_script:
- yarn
- yarn bundle
script:
- yarn test_higher_version
#!/usr/bin/env sh
set -euxo pipefail
# set -euxo pipefail
node scripts/bundle.js spec/authentication-tags.schema.json dist/authentication-tags.schema.json
node scripts/bundle.js spec/problems.schema.json dist/problems.schema.json
node scripts/bundle.js spec/set-payload.schema.json dist/set-payload.schema.json
sh create_examples.sh
#!/usr/bin/env sh
# Create a directory for the examples
rm -rf examples
rm -rf examples_fail
mkdir -p examples
mkdir examples_fail
# Run over Templates and create examples
for template in templates/*.json; do
# Get the name of the template
template_name=$(basename $template)
# Get the name of the example
example_name=${template_name%.template}
# Create the example
set -- "1.0.0" "1.0.1" "1.0.2" "1.0.11" "1.1.0" "1.5.11"
for version in "$@"; do
cat $template | sed -e "s|SCHEMA_VERSION|$version|g" > ./examples/"$template_name"_"$version".json
done
set -- "2.0.0" "3.0.1" "2.0.2" "2.0.11" "2.1.0" "3.5.11"
for version in "$@"; do
cat $template | sed -e "s|SCHEMA_VERSION|$version|g" > ./examples_fail/"$template_name"_"$version".json
done
done
......@@ -2,7 +2,8 @@
"scripts": {
"bundle": "sh bundle.sh",
"lint": "ajv compile --spec=draft2020 -c ajv-formats -s dist/set-payload.schema.json",
"test": "ajv validate --errors=text --verbose --all-errors -d examples/**/*.json --spec=draft2020 -c ajv-formats -s dist/set-payload.schema.json"
"test": "ajv validate --errors=text --verbose --all-errors -d examples/**/*.json --spec=draft2020 -c ajv-formats -s dist/set-payload.schema.json",
"test_higher_version": "! ajv validate --errors=text --verbose --all-errors -d examples_fail/**/*.json --spec=draft2020 -c ajv-formats -s dist/metadata.schema.json"
},
"dependencies": {
"@apidevtools/json-schema-ref-parser": "9.0.9",
......
......@@ -6,9 +6,9 @@
"type": "object",
"properties": {
"$schema": {
"description": "URI des Schemas, dem dieser Security Event Token entspricht.",
"description": "URI des Schemas, dem dieser Security Event Token entspricht. Zulässig sind alle Schema-URLs mit enthaltener Version 1.x.y, wobei x und y beliebige Minor- und Patch-Versionen gemäß https://semver.org/ sein können.",
"type": "string",
"enum": [ "https://schema.fitko.de/fit-connect/set-payload/SCHEMA_VERSION/set-payload.schema.json" ]
"pattern": "^https:\\/\\/schema\\.fitko\\.de\\/fit-connect\\/set-payload\\/1\\.\\d+\\.\\d+\\/set-payload\\.schema\\.json$"
},
"jti": {
"description": "Die JWT ID (jti) ist eine eindeutige UUID für das SET.",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment