From 05acf4ea14c29a5b740b76b630f5540d981e409e Mon Sep 17 00:00:00 2001 From: Agnivesh Chaubey Date: Sun, 31 Mar 2024 17:16:21 +0530 Subject: [PATCH 1/9] add description and examples for contentEncoding keyword --- .../2020-12/content/contentEncoding.markdown | 41 +++++++++++++++++++ layouts/shortcodes/instance-annotation.html | 6 +++ 2 files changed, 47 insertions(+) create mode 100644 layouts/shortcodes/instance-annotation.html diff --git a/content/2020-12/content/contentEncoding.markdown b/content/2020-12/content/contentEncoding.markdown index 0d5995d3..de9dbd2a 100644 --- a/content/2020-12/content/contentEncoding.markdown +++ b/content/2020-12/content/contentEncoding.markdown @@ -18,3 +18,44 @@ Annotations ----------- This keyword produces the content encoding name as the annotation value. + +## Explanation + +The `contentEncoding` keyword is an annotation used to specify the encoding used to store the contents of a string, particularly when it represents binary data. It indicates how the string value should be interpreted and decoded. This keyword is not directly involved in the validation process but provides metadata about the content. + +* The value of this property must be a string. +* `contentEncoding` doesn't enforce strict validation. However, it's recommended to use it correctly to ensure compatibility with applications that might interpret the encoding. +* It represents the type of binary encoding used for the string under question. Common encodings include base16, base32, and base64, as defined in [RFC 4648](https://www.rfc-editor.org/info/rfc4686). +* While the JSON Schema specification doesn't publish a predefined list of possible encodings, it's recommended to follow standard names such as those defined in [RFC 4648](https://www.rfc-editor.org/info/rfc4686). This ensures interoperability and clarity across implementations. + +## Examples + +{{}} +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "contentEncoding": "base64" +} +{{}} + +{{}} +"SGVsbG8gV29ybGQ=" // --> Hello World (base64 encoded) +{{}} + +{{}} +"eyJmb28iOi%iYmFyIn0K" +{{}} + +{{}} +[ "foo", "bar" ] +{{}} + +{{}} +{ + "valid": true, + "keywordLocation": "/", + "instanceLocation": "", + "annotations": { + "contentEncoding": "base64" + } +} +{{}} \ No newline at end of file diff --git a/layouts/shortcodes/instance-annotation.html b/layouts/shortcodes/instance-annotation.html new file mode 100644 index 00000000..4c3469fc --- /dev/null +++ b/layouts/shortcodes/instance-annotation.html @@ -0,0 +1,6 @@ +
+
+ Annotations +
+ {{ $code := trim .Inner "\n" }} {{ transform.Highlight ($code) "json" }} +
\ No newline at end of file From a8b51b650ed4e5c96f987c4546fcf44f2c3e101e Mon Sep 17 00:00:00 2001 From: Agnivesh Chaubey Date: Sun, 31 Mar 2024 17:48:30 +0530 Subject: [PATCH 2/9] add the proposed encoding formats --- content/2020-12/content/contentEncoding.markdown | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/content/2020-12/content/contentEncoding.markdown b/content/2020-12/content/contentEncoding.markdown index de9dbd2a..ff5eebce 100644 --- a/content/2020-12/content/contentEncoding.markdown +++ b/content/2020-12/content/contentEncoding.markdown @@ -19,6 +19,15 @@ Annotations This keyword produces the content encoding name as the annotation value. +## Proposed Content Encodings: + +| Encoding | Description | Reference | +|------------|-------------------------------------------------------------------------------------------------|-----------| +| `"base16"` | Encoding scheme for binary data using a 16-character hexadecimal alphabet | [RFC 4648 §8](https://datatracker.ietf.org/doc/html/rfc4648#section-8) | +| `"base32"` | Encoding scheme for binary data using a 32-character alphabet | [RFC 4648 §6](https://datatracker.ietf.org/doc/html/rfc4648#section-6) | +| `"base64"` | Common encoding scheme for representing binary data as a sequence of printable ASCII characters | [RFC 4648 §4](https://datatracker.ietf.org/doc/html/rfc4648#section-4) | + + ## Explanation The `contentEncoding` keyword is an annotation used to specify the encoding used to store the contents of a string, particularly when it represents binary data. It indicates how the string value should be interpreted and decoded. This keyword is not directly involved in the validation process but provides metadata about the content. @@ -42,7 +51,7 @@ The `contentEncoding` keyword is an annotation used to specify the encoding used {{}} {{}} -"eyJmb28iOi%iYmFyIn0K" +"This is not base64 encoded!" {{}} {{}} From c9e976a6142c3cb145479550e0d243f3115c1726 Mon Sep 17 00:00:00 2001 From: Agnivesh Chaubey Date: Sun, 31 Mar 2024 18:18:01 +0530 Subject: [PATCH 3/9] add title to schema --- content/2020-12/content/contentEncoding.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/2020-12/content/contentEncoding.markdown b/content/2020-12/content/contentEncoding.markdown index ff5eebce..9a402c71 100644 --- a/content/2020-12/content/contentEncoding.markdown +++ b/content/2020-12/content/contentEncoding.markdown @@ -39,7 +39,7 @@ The `contentEncoding` keyword is an annotation used to specify the encoding used ## Examples -{{}} +{{}} { "$schema": "https://json-schema.org/draft/2020-12/schema", "contentEncoding": "base64" From 78b368560879c4677e8f29c47c033194be7ac3a2 Mon Sep 17 00:00:00 2001 From: Agnivesh Chaubey Date: Thu, 18 Apr 2024 23:02:43 +0530 Subject: [PATCH 4/9] format the annotation output --- .../2020-12/content/contentEncoding.markdown | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/content/2020-12/content/contentEncoding.markdown b/content/2020-12/content/contentEncoding.markdown index 9a402c71..f9167e5c 100644 --- a/content/2020-12/content/contentEncoding.markdown +++ b/content/2020-12/content/contentEncoding.markdown @@ -59,12 +59,14 @@ The `contentEncoding` keyword is an annotation used to specify the encoding used {{}} {{}} -{ - "valid": true, - "keywordLocation": "/", - "instanceLocation": "", - "annotations": { - "contentEncoding": "base64" - } -} +[ + // ... + { + "valid": true, + "keywordLocation": "/contentEncoding", + "instanceLocation": "", + "annotation": "base64" + }, + // ... +] {{}} \ No newline at end of file From b410b08d998c3890c62693c3743cf7f3be4a9706 Mon Sep 17 00:00:00 2001 From: Agnivesh Chaubey Date: Thu, 18 Apr 2024 23:13:03 +0530 Subject: [PATCH 5/9] temp commit --- layouts/shortcodes/instance-annotation.html | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 layouts/shortcodes/instance-annotation.html diff --git a/layouts/shortcodes/instance-annotation.html b/layouts/shortcodes/instance-annotation.html deleted file mode 100644 index 4c3469fc..00000000 --- a/layouts/shortcodes/instance-annotation.html +++ /dev/null @@ -1,6 +0,0 @@ -
-
- Annotations -
- {{ $code := trim .Inner "\n" }} {{ transform.Highlight ($code) "json" }} -
\ No newline at end of file From 4ad4034bf107cb292f3c9a79215de3f24cfafb26 Mon Sep 17 00:00:00 2001 From: Agnivesh Chaubey Date: Mon, 22 Apr 2024 16:32:00 +0530 Subject: [PATCH 6/9] address the suggested changes --- content/2020-12/content/contentEncoding.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/2020-12/content/contentEncoding.markdown b/content/2020-12/content/contentEncoding.markdown index f9167e5c..b0ce5db5 100644 --- a/content/2020-12/content/contentEncoding.markdown +++ b/content/2020-12/content/contentEncoding.markdown @@ -19,13 +19,13 @@ Annotations This keyword produces the content encoding name as the annotation value. -## Proposed Content Encodings: +## Common Encodings | Encoding | Description | Reference | |------------|-------------------------------------------------------------------------------------------------|-----------| | `"base16"` | Encoding scheme for binary data using a 16-character hexadecimal alphabet | [RFC 4648 §8](https://datatracker.ietf.org/doc/html/rfc4648#section-8) | -| `"base32"` | Encoding scheme for binary data using a 32-character alphabet | [RFC 4648 §6](https://datatracker.ietf.org/doc/html/rfc4648#section-6) | -| `"base64"` | Common encoding scheme for representing binary data as a sequence of printable ASCII characters | [RFC 4648 §4](https://datatracker.ietf.org/doc/html/rfc4648#section-4) | +| `"base32"` | Encoding scheme for binary data using a 32-character hexadecimal alphabet | [RFC 4648 §6](https://datatracker.ietf.org/doc/html/rfc4648#section-6) | +| `"base64"` | Encoding scheme for binary data using a 64-character hexadecimal alphabet | [RFC 4648 §4](https://datatracker.ietf.org/doc/html/rfc4648#section-4) | ## Explanation @@ -34,7 +34,7 @@ The `contentEncoding` keyword is an annotation used to specify the encoding used * The value of this property must be a string. * `contentEncoding` doesn't enforce strict validation. However, it's recommended to use it correctly to ensure compatibility with applications that might interpret the encoding. -* It represents the type of binary encoding used for the string under question. Common encodings include base16, base32, and base64, as defined in [RFC 4648](https://www.rfc-editor.org/info/rfc4686). +* It represents the type of binary encoding used for the string under question. Some of the common encodings are listed [here](#common-encodings). * While the JSON Schema specification doesn't publish a predefined list of possible encodings, it's recommended to follow standard names such as those defined in [RFC 4648](https://www.rfc-editor.org/info/rfc4686). This ensures interoperability and clarity across implementations. ## Examples From 5d86d19b9a0eeaf41b3b101b19a5358aad415a5d Mon Sep 17 00:00:00 2001 From: Agnivesh Chaubey Date: Sun, 23 Mar 2025 20:45:01 +0530 Subject: [PATCH 7/9] extend shortcode to take 'keyword', 'dialect' and 'vocabulary' arguments Signed-off-by: Agnivesh Chaubey --- content/2020-12/applicator/allOf.markdown | 4 ++-- layouts/shortcodes/link.html | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 layouts/shortcodes/link.html diff --git a/content/2020-12/applicator/allOf.markdown b/content/2020-12/applicator/allOf.markdown index dce1789d..95a2d2a6 100644 --- a/content/2020-12/applicator/allOf.markdown +++ b/content/2020-12/applicator/allOf.markdown @@ -28,7 +28,7 @@ related: keyword: not --- -The `allOf` keyword is used to specify that a given instance must validate against all of the subschemas provided within an array. It's essentially a logical "AND" operation where all conditions must be met for validation to pass. +The {{}} keyword is used to specify that a given instance must validate against all of the subschemas provided within an array. It's essentially a logical "AND" operation where all conditions must be met for validation to pass. ## Examples @@ -129,7 +129,7 @@ The `allOf` keyword is used to specify that a given instance must validate again {{}} { "foo": "foo" } {{}} -* _Remember, if any subschema within the `allOf` keyword fails validation or has a boolean `false` value, the entire validation will always fail._ +* _Remember, if any subschema within the {{}} keyword fails validation or has a boolean `false` value, the entire validation will always fail._ {{}} { diff --git a/layouts/shortcodes/link.html b/layouts/shortcodes/link.html new file mode 100644 index 00000000..f7f6c411 --- /dev/null +++ b/layouts/shortcodes/link.html @@ -0,0 +1,17 @@ +{{- $keyword := .Get "keyword" | lower -}} +{{- $vocabulary := .Get "vocabulary" | lower -}} +{{- $dialect := .Get "dialect" | default .Page.Section | lower -}} + +{{- if or (not $keyword) (not $vocabulary) -}} + {{- errorf "keyword and vocabulary parameters are required for this shortcode." -}} +{{- end -}} + +{{- $url := "" -}} + +{{- if and $keyword $vocabulary -}} + {{- $url = printf "%s/%s/%s/%s/" $.Site.BaseURL $dialect $vocabulary $keyword -}} +{{- else -}} + {{- $url = .Page.Permalink -}} +{{- end -}} + +{{ $keyword -}} From f02d18c1ca670322635d63076665655a84f740b9 Mon Sep 17 00:00:00 2001 From: Agnivesh Chaubey Date: Thu, 27 Mar 2025 23:50:49 +0530 Subject: [PATCH 8/9] make vocabulary keyword as optional and use ref shortcode Signed-off-by: Agnivesh Chaubey --- layouts/shortcodes/link.html | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/layouts/shortcodes/link.html b/layouts/shortcodes/link.html index f7f6c411..3a2b7e8a 100644 --- a/layouts/shortcodes/link.html +++ b/layouts/shortcodes/link.html @@ -1,17 +1,13 @@ -{{- $keyword := .Get "keyword" | lower -}} -{{- $vocabulary := .Get "vocabulary" | lower -}} -{{- $dialect := .Get "dialect" | default .Page.Section | lower -}} +{{- $dialect := .Get "dialect" | default .Page.Section -}} +{{- $vocabulary := .Get "vocabulary" | default .Page.Parent.Params.title -}} +{{- $keyword := .Get "keyword" -}} -{{- if or (not $keyword) (not $vocabulary) -}} - {{- errorf "keyword and vocabulary parameters are required for this shortcode." -}} +{{- if (not $keyword) -}} +{{- errorf "keyword parameter is required for this shortcode." -}} {{- end -}} -{{- $url := "" -}} +{{ $vocabularyURL := $vocabulary | lower | printf "%s/%s" $dialect }} +{{ $keywordURL := (replace $keyword "$" "") | lower | printf "/%s/%s" $vocabularyURL }} -{{- if and $keyword $vocabulary -}} - {{- $url = printf "%s/%s/%s/%s/" $.Site.BaseURL $dialect $vocabulary $keyword -}} -{{- else -}} - {{- $url = .Page.Permalink -}} -{{- end -}} - -{{ $keyword -}} +{{ $keyword }} +(Vocabulary: {{ title $vocabulary }}) From e46b6a9bdf0d66b75ce23ba538992eb4715be497 Mon Sep 17 00:00:00 2001 From: Agnivesh Chaubey Date: Sat, 29 Mar 2025 17:10:58 +0530 Subject: [PATCH 9/9] add vocabulary name to tooltip Signed-off-by: Agnivesh Chaubey --- layouts/shortcodes/link.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/layouts/shortcodes/link.html b/layouts/shortcodes/link.html index 3a2b7e8a..ce40b6c5 100644 --- a/layouts/shortcodes/link.html +++ b/layouts/shortcodes/link.html @@ -9,5 +9,4 @@ {{ $vocabularyURL := $vocabulary | lower | printf "%s/%s" $dialect }} {{ $keywordURL := (replace $keyword "$" "") | lower | printf "/%s/%s" $vocabularyURL }} -{{ $keyword }} -(Vocabulary: {{ title $vocabulary }}) +{{ $keyword }}