kwalify_to_json_schema 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/kwalify_to_json_schema/cli.rb +2 -2
- data/lib/kwalify_to_json_schema/serialization.rb +8 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24ea47c83c28031d1630aa6460ab29125ee794b7b1ddfff220e4ec544a7b3c43
|
4
|
+
data.tar.gz: 3147694baf5304f1ed35298c8626584befbabfeca7313a5d100c275ce3882f48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5606734e11c35ab09d8eb671d1839d66a72b09cc9620fca6c66bd5ae43d5e713dc0cbb9aeaf839bcea91635bb136656861c69dd2b9b9705d8b8de838bd4773b9
|
7
|
+
data.tar.gz: 1fe43731e2afac08c7a0bfe6813c57c33219c84583a4adee8c6cc4ee92f93183040aeb26c139abbe8e3fc1344c4d1ebd5c03a4e9afe9d848805816f88e60723e
|
@@ -24,7 +24,7 @@ module KwalifyToJsonSchema
|
|
24
24
|
CODE
|
25
25
|
|
26
26
|
desc "convert KWALIFY_SCHEMA_FILE, RESULT_FILE",
|
27
|
-
"Convert a Kwalify schema file to a JSON schema file. The result file extension will decide the format: .json or .
|
27
|
+
"Convert a Kwalify schema file to a JSON schema file. The result file extension will decide the format: .json, .yaml or .yml"
|
28
28
|
option(*Options.cli_option(Options::ID))
|
29
29
|
option(*Options.cli_option(Options::TITLE))
|
30
30
|
option(*Options.cli_option(Options::DESCRIPTION))
|
@@ -75,7 +75,7 @@ module KwalifyToJsonSchema
|
|
75
75
|
opts = options.dup
|
76
76
|
opts[Options::CUSTOM_PROCESSING] = custom_processing(options)
|
77
77
|
|
78
|
-
path = [kwalify_schema_dir, options["recursive"] ? "**" : nil, "*.yaml"].compact
|
78
|
+
path = [kwalify_schema_dir, options["recursive"] ? "**" : nil, "*.{yaml,yml}"].compact
|
79
79
|
Dir.glob(File.join(*path)).each { |kwalify_schema_file|
|
80
80
|
result_file = File.join(result_dir, File.basename(kwalify_schema_file, File.extname(kwalify_schema_file))) + ".#{options["format"]}"
|
81
81
|
KwalifyToJsonSchema.convert_file(kwalify_schema_file, result_file, opts)
|
@@ -18,14 +18,20 @@ module KwalifyToJsonSchema
|
|
18
18
|
serialization_for_format(format).serialize(object)
|
19
19
|
end
|
20
20
|
|
21
|
-
# @return a Hash giving serialization/deserialization module and methods for a given file extension (.json/.yaml)
|
21
|
+
# @return a Hash giving serialization/deserialization module and methods for a given file extension (.json/.yaml/.yml)
|
22
22
|
def self.serialization_for_file(file)
|
23
23
|
serialization_for_format(File.extname(file)[1..-1])
|
24
24
|
end
|
25
25
|
|
26
26
|
# @return a Hash giving serialization/deserialization module and methods for a format (json/yaml)
|
27
27
|
def self.serialization_for_format(format)
|
28
|
-
|
28
|
+
mod = {
|
29
|
+
"json" => Json,
|
30
|
+
"yaml" => Yaml,
|
31
|
+
"yml" => Yaml,
|
32
|
+
}[format]
|
33
|
+
raise "Unsupported format '#{format}'" unless mod
|
34
|
+
mod
|
29
35
|
end
|
30
36
|
|
31
37
|
class Language
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kwalify_to_json_schema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvain Gamot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|