json_world 0.1.0 → 0.1.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: 14f5a47f6065b24fc674da4eb191fbafe96cdffa
4
- data.tar.gz: 8289494f76a30d5e6413884d31628eb0485f4a08
3
+ metadata.gz: 6435e6e014ae5822d8ec98e401345470c68478c9
4
+ data.tar.gz: 4c480dded8989f2012462755bb115b2967e8f67d
5
5
  SHA512:
6
- metadata.gz: 5b39323039ca55a2604e7c3338557a7dfe5decd983f98b9fab78b4246740120b6438b2f57e628bb846269083af848e9a28ee3ac4d1ffd33ba0102f7726191afe
7
- data.tar.gz: 6c687f1136ab40740b48b45d53fa92c20f463e2f4b309779a43ee2b2f17165121182d6421c473fb957be3843e3d5f499363b6ecba971691f3306cf7dea7f74ce
6
+ metadata.gz: ca5e0036a01596dabca1e5a1224e415ea59b1a401233edd0d108210593bbee390ea6aa268742056f4f2645be60a5b0778664a4a5951bebe1ebfb2bd9b4e05daa
7
+ data.tar.gz: dd686cbcd375e39565941be1345887b5309a937a1f4518efbd88a8025fb7125025b4f17ed1a55452938015b0002bcf77265f82818664f4442a469d910beaec67
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.1
2
+ - Support embedding other JSON-Schema compatible object via type
3
+ - Support rel property on LinkDefinition
4
+
1
5
  ## 0.1.0
2
6
  - Rename included module name: PropertyDefinable -> DSL
3
7
 
@@ -19,6 +19,7 @@ module JsonWorld
19
19
  description: description,
20
20
  href: path,
21
21
  method: http_method,
22
+ rel: rel,
22
23
  schema: schema,
23
24
  title: title,
24
25
  }.reject do |_key, value|
@@ -44,6 +45,11 @@ module JsonWorld
44
45
  @options[:path]
45
46
  end
46
47
 
48
+ # @return [String, nil]
49
+ def rel
50
+ @options[:rel]
51
+ end
52
+
47
53
  # @return [Hash{Symbol => Object}, nil]
48
54
  def schema
49
55
  if @options[:parameters]
@@ -1,3 +1,5 @@
1
+ require "active_support/core_ext/object/try"
2
+
1
3
  module JsonWorld
2
4
  class PropertyDefinition
3
5
  # @return [Symbol]
@@ -10,14 +12,9 @@ module JsonWorld
10
12
  @property_name = property_name
11
13
  end
12
14
 
13
- # @return [Hash{Symbol => Object}]
14
- def as_nested_json_schema
15
- { property_name => as_json_schema }
16
- end
17
-
18
15
  # @return [Hash{Symbol => Object}]
19
16
  def as_json_schema
20
- {
17
+ @options[:type].try(:as_json_schema) || {
21
18
  description: description,
22
19
  example: example,
23
20
  format: format_type,
@@ -32,6 +29,11 @@ module JsonWorld
32
29
  end
33
30
  end
34
31
 
32
+ # @return [Hash{Symbol => Object}]
33
+ def as_nested_json_schema
34
+ { property_name => as_json_schema }
35
+ end
36
+
35
37
  # @return [false, true] True if explicitly this property is defined as optional
36
38
  def optional?
37
39
  !!@options[:optional]
@@ -1,3 +1,3 @@
1
1
  module JsonWorld
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_world
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura