json_schema-artesano 0.0.1.beta.1 → 0.0.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
  SHA1:
3
- metadata.gz: f64ae69feb786b7aebba6d914cfabe466ab8951d
4
- data.tar.gz: 6664232be5861daf3e8884420c3b3afdcf1631a8
3
+ metadata.gz: 0858d7cc3b24a1c137601e0af91aad4d2dd97b7e
4
+ data.tar.gz: 6d841275638d3736a2835756677d2576ed262218
5
5
  SHA512:
6
- metadata.gz: 5edbf1326b78a52761bbdac3e61500c6f37faa605f08b21188fa93dd4f850b9aa4d6653c04cb3d2d58066dbe037879214b2659639dfa51fc08e768b0c0988e7c
7
- data.tar.gz: fd2b26a4e91e2ef3f3f5b11139d9d6dc25438ca7e00509eaa441d2ae1e785d635efb12790e46f552bc1dab61142eecb8b330f55e99c0b8354e7aa44accd1e197
6
+ metadata.gz: a6fd9081a6fb74c631a2ecfa267e26cbf134cdc86f71be4e2c67ab17d9487fb4bcf4e822a28582f2fc416aee1c8d1fde86e7aba3e2513d897aad30d4624e0867
7
+ data.tar.gz: 7b88e96b61f2107f4100c5f51b83f9537fb06c0234cdb377d0da054452697a15e2a6ba9c06b3966f80f7121ad139e21edf2bb86ac94c7c9211008d6fe61692df
@@ -1,13 +1,6 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [Unreleased]
5
- ## [0.0.1.beta.1] - 2017-10-09 (Alfonso Mancilla)
6
- ### Changed
7
- - Process oneOf, anyOf and allOf first, then primivites, object and array.
8
- ### Fixed
9
- - Minor speel / grammar improvements to README.
10
-
11
4
  ## [0.0.1] - 2017-09-17 (Alfonso Mancilla)
12
5
  ### Added
13
6
  - Proof of concept strategies: Null, DataType and Static.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # JsonSchema::Artesano
2
2
 
3
- If you give a **sketch, materials and tools** to an artesano (artisan), they will use the tools to transform the materials into a product that (hopefully) matches the sketch.
3
+ If you give a **sketch, materials and tools** to an Artesano (Artesan), he will use the tools to transform the materials into a product that (hopefully) matches the sketch.
4
4
 
5
5
  Similary, if you give a **JSON Schema (sketch) and a strategy (tool)** to `JsonSchema::Artesano`, it will give you data (or objects, or whatever else you ask for) conformed to the schema.
6
6
 
@@ -35,32 +35,33 @@ module JsonSchema
35
35
  return tool.shape_enum(material)
36
36
  end
37
37
 
38
- # OneOf
39
- if material.one_of.any?
40
- item = tool.select_oneof( material.one_of )
41
- return transform(item)
42
- end
43
-
44
- # AnyOf
45
- if material.any_of.any?
46
- items = tool.select_anyof( material.any_of )
47
- items = [items] unless items.is_a?(Array)
48
-
49
- return tool.shape_array( transform_array(items) )
50
- end
51
-
52
- # AllOf
53
- if material.all_of.any?
54
- array = material.all_of
55
- return tool.shape_array( transform_array(array) )
56
- end
57
-
58
38
  case material.type[0]
59
39
  when *PRIMITIVE_MATERIALS
60
40
  tool.shape_primitive(material)
61
41
  when 'object'
42
+ # OneOf
43
+ if material.one_of.any?
44
+ item = tool.select_oneof( material.one_of )
45
+ return tool.shape_object( transform_object(item) )
46
+ end
47
+
48
+ # Plain
62
49
  tool.shape_object( transform_object(material) )
63
50
  when 'array'
51
+ # AnyOf
52
+ if material.any_of.any?
53
+ items = tool.select_anyof( material.any_of )
54
+ items = [items] unless items.is_a?(Array)
55
+
56
+ return tool.shape_array( transform_array(items) )
57
+ end
58
+
59
+ # AllOf
60
+ if material.all_of.any?
61
+ array = material.all_of
62
+ return tool.shape_array( transform_array(array) )
63
+ end
64
+
64
65
  tool.shape_array( transform_array(material) )
65
66
  else
66
67
  # Null
@@ -1,5 +1,5 @@
1
1
  module JsonSchema
2
2
  module Artesano
3
- VERSION = '0.0.1.beta.1'.freeze
3
+ VERSION = '0.0.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_schema-artesano
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.beta.1
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alfonso Mancilla
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-09 00:00:00.000000000 Z
11
+ date: 2017-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json_schema
@@ -106,9 +106,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ">"
109
+ - - ">="
110
110
  - !ruby/object:Gem::Version
111
- version: 1.3.1
111
+ version: '0'
112
112
  requirements: []
113
113
  rubyforge_project:
114
114
  rubygems_version: 2.6.13