kwalify_to_json_schema 0.6.0 → 0.6.1

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: 2bbbe823e0df66f54b21956a628b2a08dad03190f4d2884ee05abe1c6362fba8
4
- data.tar.gz: ef883dfea6e9cebcee6c0bd95d7470db46d428734dac428cd52f65230af7666a
3
+ metadata.gz: 24ea47c83c28031d1630aa6460ab29125ee794b7b1ddfff220e4ec544a7b3c43
4
+ data.tar.gz: 3147694baf5304f1ed35298c8626584befbabfeca7313a5d100c275ce3882f48
5
5
  SHA512:
6
- metadata.gz: 237ff9995ed857260b71851e3499640af68deafcbb65c8103d6e7227ce1a0c774b06d8b3d4cab7ed1f0f54bf74e4122e6dcfe543515db2dc70a2dc971e10e8a0
7
- data.tar.gz: d30502c9942dd6039c074b3c227b3829fa8624dca103541572487659eda84386ba91f7583742183dbe1f1d8ca6e79f74b8aadfc461e65a1aac07ac576742b0e2
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 .yaml"
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
- { "json" => Json, "yaml" => Yaml }[format] || Json
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.0
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: 2021-04-15 00:00:00.000000000 Z
11
+ date: 2022-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor