Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #158 from mirpedrol/fix-docs
Browse files Browse the repository at this point in the history
format code blocks and admonitions
  • Loading branch information
mirpedrol authored Feb 20, 2024
2 parents 8128304 + fef591e commit 187c018
Showing 1 changed file with 105 additions and 8 deletions.
113 changes: 105 additions & 8 deletions docs/migration_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ sed -i -e 's/http:\/\/json-schema.org\/draft-07\/schema/https:\/\/json-schema.or
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 `

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.

Expand All @@ -44,25 +45,121 @@ When you use `unique` in your schemas, you should update it to use `uniqueItems`
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 } } } } `

```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 } `

```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"] } } } } `

```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"] } `

```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"] } } } `

```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"] } } `

```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"]
}
}
```

0 comments on commit 187c018

Please sign in to comment.