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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/json_world/link_definition.rb +6 -0
- data/lib/json_world/property_definition.rb +8 -6
- data/lib/json_world/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6435e6e014ae5822d8ec98e401345470c68478c9
|
4
|
+
data.tar.gz: 4c480dded8989f2012462755bb115b2967e8f67d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca5e0036a01596dabca1e5a1224e415ea59b1a401233edd0d108210593bbee390ea6aa268742056f4f2645be60a5b0778664a4a5951bebe1ebfb2bd9b4e05daa
|
7
|
+
data.tar.gz: dd686cbcd375e39565941be1345887b5309a937a1f4518efbd88a8025fb7125025b4f17ed1a55452938015b0002bcf77265f82818664f4442a469d910beaec67
|
data/CHANGELOG.md
CHANGED
@@ -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]
|
data/lib/json_world/version.rb
CHANGED