Validate configuration against json schema #17
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fail early and clearly in case some configuration provided to the cli or any services is invalid.
What's changed
loadConfig<T>
function is now asynchronousloadConfig<T>
to a dedicated new functionloadYamlFile<T>
What's new
livebundle-utils
schemaValidate
tolivebundle-utils
, using ajv to validate an object against a given schema.loadConfig<T>
function, now accepting two more propertiesschema
andrefSchemas
to be used to provide a schema (and optional reference schemas) to validate configuration against.loadConfig<T>
to provide the proper schemas.tsconfig.json
andtsconfig.build.json
. Needed to allow direct import of json files.Remarks
$id
) are only used to identify the schemas (and required to properly use schema references). It is totally OK for these URIs not to really exist. According to JSON schema specifiation, validators should not expect to be able to download the schemas from these URIs."include": ["src/**/*"]
to"include": ["./src/**/*", "./src/**/*.json"]
in modulestsconfig.build.json
might seem unnecessary. It is however needed. See this issue for reference.Closes #16