This repository has been archived by the owner on Aug 20, 2024. It is now read-only.
forked from nextflow-io/nf-schema
-
Notifications
You must be signed in to change notification settings - Fork 19
Update the JSON schema validator library + major refactor #141
Merged
Merged
Changes from all commits
Commits
Show all changes
104 commits
Select commit
Hold shift + click to select a range
e3f9d57
added some half working validators
nvnieuwk 3531eaf
some small fixes to the error handling
nvnieuwk ed558ae
better handle schema exceptions
nvnieuwk ac81155
fix issues with schema + even better errors (wow)
nvnieuwk 690f1a1
more error messages!
nvnieuwk 633206c
no repetition!
nvnieuwk b1ca7c2
enable format validation
nvnieuwk 6d77825
files are now validated as an array of inputs
nvnieuwk cc7434d
remove everit json schema lib and add org.json
nvnieuwk 3ec9980
small typo fix
nvnieuwk e3a1563
harrel56 part1
nvnieuwk ff7c2ba
add a double error check
nvnieuwk 685f270
error messages fixes
nvnieuwk 155903d
add format validators
nvnieuwk 8f4f623
remove print values
nvnieuwk d937d4f
add exists keyword
nvnieuwk 14721ad
update definitions to defs
nvnieuwk ee1aec9
remove old exists code
nvnieuwk 7f7bbed
implement schema keyword
nvnieuwk 0dba85b
fix for exists keyword and file-path-pattern
nvnieuwk 967373a
move isInteger to utils
nvnieuwk c54625f
cleaning up and fix a typo
nvnieuwk 352bafb
added uniqueEntries keyword
nvnieuwk b279de4
fetch values for error messages
nvnieuwk a3d3f93
implemented errorMessage
nvnieuwk e00f576
use jsonobject instead of string as schema input
nvnieuwk e5dd14d
remove unused debug message
nvnieuwk 9cb6d1f
custom error for samplesheet conversion
nvnieuwk 8dcbadd
custom error for samplesheet conversion
nvnieuwk fcba884
implement lenient mode
nvnieuwk 3a978fa
correctly name a file
nvnieuwk 78c78a8
stay true to the real copy of TypeEvaluator
nvnieuwk bf19c0e
first set of test fixes
nvnieuwk 045c715
fix even more tests
nvnieuwk 0bbe687
remove validation tests for samplesheet conversion
nvnieuwk f296a12
modularize the tests
nvnieuwk 3ba471c
fix: add explicit check for 0 value if false-y. Add tests to ensure n…
awgymer 0361ace
Merge branch 'master' into move-json-validator
nvnieuwk e4635c1
fix numerics tests
nvnieuwk 6bf0661
add a check for older drafts
nvnieuwk fe77d50
fix review comments
nvnieuwk 8faed2d
update changelog
nvnieuwk 81a7082
prettier
nvnieuwk d9a4775
add some missing tests
nvnieuwk 8b1f809
Merge branch 'master' into move-json-validator
nvnieuwk 7e10f7f
add array check to fileToMaps
nvnieuwk f102dd7
Update CHANGELOG.md
nvnieuwk ca0fb4d
some small fixes to samplesheet convertor
nvnieuwk ef8c916
Merge branch 'move-json-validator' of github.com:nvnieuwk/nf-validati…
nvnieuwk 58f94d1
update authors
nvnieuwk 34f95ff
Update plugins/nf-validation/src/test/nextflow/validation/Samplesheet…
nvnieuwk 0486620
Update plugins/nf-validation/src/test/nextflow/validation/ParamsHelpT…
nvnieuwk 2127fb8
Update plugins/nf-validation/src/test/nextflow/validation/ParamsSumma…
nvnieuwk 2634a43
made no-header support more flexible
nvnieuwk 083cbad
improve the efficiency of util functions
nvnieuwk b83d380
support deeply nested samplesheets
nvnieuwk 69314b6
update changelog
nvnieuwk e840ffd
add format casting
nvnieuwk 4f5575a
add warnings for unidentified headers
nvnieuwk 39322ad
Add some clarifying comments
nvnieuwk 94716f2
made the format casting algorithm a bit smarter
nvnieuwk cb6992d
remove old convertor code
nvnieuwk b10c091
remove fixed todo
nvnieuwk 318d512
remove unused imports
nvnieuwk 731d27f
add defaults
nvnieuwk 891adb7
fix for defaults in meta
nvnieuwk 00ba8c6
fix meta addition when meta is missing
nvnieuwk a85fe66
fix existing tests
nvnieuwk 84faee2
add deeply nested samplesheet tests
nvnieuwk 825219c
update the error message for fromSamplesheet
nvnieuwk 77f3128
revert last commit + add clear error
nvnieuwk d682362
first batch of docs fixes
nvnieuwk dcdb267
shorten the fromsamplesheet error a bit
nvnieuwk a371036
fix for null meta attributes
nvnieuwk 75dd0ef
Merge branch 'improve-samplesheet-convertor' into docs-v2.0
nvnieuwk d3c199c
second batch of docs fixes
nvnieuwk 8dba44e
third batch of docs fixes
nvnieuwk eadf4f2
check for default formats when using anyOf, allOf and oneOf
nvnieuwk 59363d5
wrote the migration docs
nvnieuwk 2fed4eb
prettier
nvnieuwk a250de6
add migration guide to changelog
nvnieuwk 25a2445
fix migration guide url
nvnieuwk 1deb52b
fix some custom error messages not showing up
nvnieuwk 29ef2ba
Merge branch 'improve-samplesheet-convertor' into docs-v2.0
nvnieuwk 1fccf08
Merge pull request #2 from nvnieuwk/improve-samplesheet-convertor
nvnieuwk 3cdd4e9
Added deprecated error messages
nvnieuwk 7cb0b66
Merge branch 'move-json-validator' into docs-v2.0
nvnieuwk 949a54b
Added deprecated to the docs
nvnieuwk 9cedf63
prettier
nvnieuwk 960ee35
Update docs/migration_guide.md
nvnieuwk a9c1dfc
Update docs/nextflow_schema/create_schema.md
nvnieuwk ad7463b
Update docs/nextflow_schema/sample_sheet_schema_specification.md
nvnieuwk f127f1f
Update docs/nextflow_schema/sample_sheet_schema_specification.md
nvnieuwk 7520cad
Update docs/nextflow_schema/sample_sheet_schema_specification.md
nvnieuwk e163089
Update docs/background.md
nvnieuwk 44a3404
Update docs/samplesheets/examples.md
nvnieuwk e1f343b
Update docs/samplesheets/examples.md
nvnieuwk efa83ce
Update docs/samplesheets/fromSamplesheet.md
nvnieuwk 6423d5a
Update docs/samplesheets/fromSamplesheet.md
nvnieuwk 674423a
Update docs/samplesheets/fromSamplesheet.md
nvnieuwk ee712e6
Update docs/samplesheets/fromSamplesheet.md
nvnieuwk 11666e5
Update docs/samplesheets/fromSamplesheet.md
nvnieuwk 65853ca
prettify suggestions
nvnieuwk cf0da97
Merge pull request #3 from nvnieuwk/docs-v2.0
nvnieuwk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,68 @@ | ||
--- | ||
title: Migration guide | ||
description: Guide to migrate pipelines using nf-validation pre v2.0.0 to after v2.0.0 | ||
hide: | ||
- toc | ||
--- | ||
|
||
# Migration guide | ||
|
||
This guide is intended to help you migrate your pipeline from older versions of the plugin to version 2.0.0 and later. | ||
|
||
## Major changes in the plugin | ||
|
||
Following list shows the major breaking changes introduced in version 2.0.0: | ||
|
||
1. The JSON schema draft has been updated from `draft-07` to `draft-2020-12`. See [JSON Schema draft 2020-12 release notes](https://json-schema.org/draft/2020-12/release-notes) and [JSON schema draft 2019-09 release notes](https://json-schema.org/draft/2019-09/release-notes) for more information. | ||
2. The `unique` keyword for samplesheet schemas has been removed. Please use [`uniqueItems`](https://json-schema.org/understanding-json-schema/reference/array#uniqueItems) or [`uniqueEntries`](nextflow_schema/nextflow_schema_specification.md#uniqueentries) now instead. | ||
3. The `dependentRequired` keyword now works as it's supposed to work in JSON schema. See [`dependentRequired`](https://json-schema.org/understanding-json-schema/reference/conditionals#dependentRequired) for more information | ||
|
||
A full list of changes can be found in the [changelog](../CHANGELOG.md). | ||
|
||
## Updating your pipeline | ||
|
||
If you aren't using any special features in your schemas, you can simply update your `nextflow_schema.json` file using the following command: | ||
|
||
```bash | ||
sed -i -e 's/http:\/\/json-schema.org\/draft-07\/schema/https:\/\/json-schema.org\/draft\/2020-12\/schema/g' -e 's/definitions/defs/g' nextflow_schema.json | ||
``` | ||
|
||
This will replace the old schema draft specification (`draft-07`) by the new one (`2020-12`), and the old keyword `definitions` by the new notation `defs`. | ||
|
||
!!! note | ||
Repeat this command for every JSON schema you use in your pipeline. e.g. for the default samplesheet schema: | ||
`bash sed -i -e 's/http:\/\/json-schema.org\/draft-07\/schema/https:\/\/json-schema.org\/draft\/2020-12\/schema/g' -e 's/definitions/defs/g' assets/schema_input.json ` | ||
|
||
If you are using any special features in your schemas, you will need to update your schemas manually. Please refer to the [JSON Schema draft 2020-12 release notes](https://json-schema.org/draft/2020-12/release-notes) and [JSON schema draft 2019-09 release notes](https://json-schema.org/draft/2019-09/release-notes) for more information. | ||
|
||
However here are some guides to the more common migration patterns: | ||
|
||
### Updating `unique` keyword | ||
|
||
When you use `unique` in your schemas, you should update it to use `uniqueItems` or `uniqueEntries` instead. | ||
|
||
If you used the `unique:true` field, you should update it to use `uniqueItems` like this: | ||
|
||
=== "Before v2.0" | ||
`json hl_lines="9" { "$schema": "http://json-schema.org/draft-07/schema", "type": "array", "items": { "type": "object", "properties": { "sample": { "type": "string", "unique": true } } } } ` | ||
|
||
=== "After v2.0" | ||
`json hl_lines="12" { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "array", "items": { "type": "object", "properties": { "sample": { "type": "string" } } }, "uniqueItems": true } ` | ||
|
||
If you used the `unique: ["field1", "field2"]` field, you should update it to use `uniqueEntries` like this: | ||
|
||
=== "Before v2.0" | ||
`json hl_lines="9" { "$schema": "http://json-schema.org/draft-07/schema", "type": "array", "items": { "type": "object", "properties": { "sample": { "type": "string", "unique": ["sample"] } } } } ` | ||
|
||
=== "After v2.0" | ||
`json hl_lines="12" { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "array", "items": { "type": "object", "properties": { "sample": { "type": "string" } } }, "uniqueEntries": ["sample"] } ` | ||
|
||
### Updating `dependentRequired` keyword | ||
|
||
When you use `dependentRequired` in your schemas, you should update it like this: | ||
|
||
=== "Before v2.0" | ||
`json hl_lines="12" { "$schema": "http://json-schema.org/draft-07/schema", "type": "object", "properties": { "fastq_1": { "type": "string", "format": "file-path" }, "fastq_2": { "type": "string", "format": "file-path" "dependentRequired": ["fastq_1"] } } } ` | ||
|
||
=== "After v2.0" | ||
`json hl_lines="14 15 16" { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "fastq_1": { "type": "string", "format": "file-path" }, "fastq_2": { "type": "string", "format": "file-path" } }, "dependentRequired": { "fastq_2": ["fastq_1"] } } ` |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've not changed anything in the docs for now. That's something I wanted to discuss with you and @mashehu. How will we handle the docs of pre 2.0 and after 2.0? A lot will change between these versions, but I think pre 2.0 will still be wildly used for a while. Maybe we should split up the docs for both versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add versioning to the docs, I think this will be the easiest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! Do we keep this for another PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, makes sense :)