kwalify_to_json_schema 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c071ca240ae54308f08beacbb2ddf8ac8646662b435ffca2b20bb3959e09984
|
4
|
+
data.tar.gz: 8c0b65039cf2ee1ff6f96e44b9053da918a47e33db8f9479f3e845e51d5997e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00dc73a490152a8a715a577496eb25c0c61fc31313afc5475e4ec5471ffcac928a4029feda22583a8ff43f2a6a79d352a221bb67e1b5912b099ec467107602f6
|
7
|
+
data.tar.gz: aca9041623512921a06a012c27d874733b4cda5fcc18e19d7c7035629f8b39ae2de563fd0358ae6e75bc23bf4dd4d0e3aef10a78add72de0521e5fe242f42ac1
|
@@ -11,7 +11,7 @@ module KwalifyToJsonSchema
|
|
11
11
|
#
|
12
12
|
# File.write("json_schema.json", JSON.pretty_generate(json_schema))
|
13
13
|
class Converter
|
14
|
-
SCHEMA = "http://json-schema.org/
|
14
|
+
SCHEMA = "http://json-schema.org/%s/schema#"
|
15
15
|
|
16
16
|
# The options given used to initialized the converter
|
17
17
|
attr_reader :options
|
@@ -26,6 +26,7 @@ module KwalifyToJsonSchema
|
|
26
26
|
# | :description | string | nil | The JSON schema description. If not given the Kwalify description will be used if present|
|
27
27
|
# | :issues_to_description| boolean| false | To append the issuses to the JSON schema description |
|
28
28
|
# | :custom_processing | object | nil | To customize the conversion |
|
29
|
+
# | :schema_version | String | "draft-04" | JSON schema version. Changing this value only change the value of $schema field |
|
29
30
|
# --
|
30
31
|
def initialize(options_hash = {})
|
31
32
|
@options = Options.new(options_hash)
|
@@ -56,7 +57,7 @@ module KwalifyToJsonSchema
|
|
56
57
|
|
57
58
|
def root
|
58
59
|
{
|
59
|
-
"$schema" => SCHEMA,
|
60
|
+
"$schema" => SCHEMA % options.schema_version,
|
60
61
|
"$id" => options.id,
|
61
62
|
"title" => options.title,
|
62
63
|
}.reject { |k, v| v.nil? }
|
@@ -12,6 +12,7 @@ module KwalifyToJsonSchema
|
|
12
12
|
# | :description | string | nil | The JSON schema description. If not given the Kwalify description will be used if present|
|
13
13
|
# | :issues_to_description| boolean| false | To append the issuses to the JSON schema description |
|
14
14
|
# | :custom_processing | object | nil | To customize the conversion |
|
15
|
+
# | :schema_version | String | "draft-04" | JSON schema version. Changing this value only change the value of $schema field |
|
15
16
|
# --
|
16
17
|
# @param source Path to Kwalify YAML schema
|
17
18
|
# @param dest Path to resulting JSON schema
|
@@ -35,6 +36,7 @@ module KwalifyToJsonSchema
|
|
35
36
|
# | :description | string | nil | The JSON schema description. If not given the Kwalify description will be used if present|
|
36
37
|
# | :issues_to_description| boolean| false | To append the issuses to the JSON schema description |
|
37
38
|
# | :custom_processing | object | nil | To customize the conversion |
|
39
|
+
# | :schema_version | String | "draft-04" | JSON schema version. Changing this value only change the value of $schema field |
|
38
40
|
# --
|
39
41
|
# @param kwalify_schema Kwalify schema as YAML or JSON
|
40
42
|
# @param source_format format of the source schema
|
@@ -9,6 +9,7 @@ module KwalifyToJsonSchema
|
|
9
9
|
# | :description | string | nil | The JSON schema description. If not given the Kwalify description will be used if present|
|
10
10
|
# | :issues_to_description| boolean| false | To append the issuses to the JSON schema description |
|
11
11
|
# | :custom_processing | object | nil | To customize the conversion |
|
12
|
+
# | :schema_version | String | "draft-04" | JSON schema version. Changing this value only change the value of $schema field |
|
12
13
|
# --
|
13
14
|
DECLARATION = %q(
|
14
15
|
ID # The JSON schema identifier [string] (nil)
|
@@ -16,6 +17,7 @@ module KwalifyToJsonSchema
|
|
16
17
|
DESCRIPTION # The JSON schema description. If not given the Kwalify description will be used if present [string] (nil)
|
17
18
|
ISSUES_TO_DESCRIPTION # To append the issuses to the JSON schema description [boolean] (false)
|
18
19
|
CUSTOM_PROCESSING # To customize the conversion [object] (nil)
|
20
|
+
SCHEMA_VERSION # JSON schema version. Changing this value only change the value of $schema field[String] ("draft-04")
|
19
21
|
)
|
20
22
|
|
21
23
|
# The options as Hash
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kwalify_to_json_schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvain Gamot
|
@@ -80,7 +80,7 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 12.3.0
|
83
|
-
description: Allows to convert Kwalify schemas to JSON schemas
|
83
|
+
description: Allows to convert Kwalify schemas to JSON schemas
|
84
84
|
email: ''
|
85
85
|
executables:
|
86
86
|
- kwalify_to_json_schema
|