json_world 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +23 -0
- data/Gemfile +3 -0
- data/json_world.gemspec +0 -4
- data/lib/json_world/dsl.rb +4 -4
- data/lib/json_world/json_encodable.rb +1 -1
- data/lib/json_world/property_definition.rb +3 -4
- data/lib/json_world/version.rb +1 -1
- metadata +7 -64
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0a28523d5ccf2728d79bb13a96808779bede5a2eeb14e08e78b96fe415038bbb
|
4
|
+
data.tar.gz: 64ad54f93cf882046b2be75fac166ca3420e5a9a5496d244271fb71121b152a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f81fb14efaab68969d537a7e9bff76451aed0429c89af71167d8cf4111bcb33075025b57f0272e38da89dfdbfb40dcbba3d3c41c58f83b372991ddd7923699a6
|
7
|
+
data.tar.gz: d426d0e68637755b0827f10e5dfde3c676dce9bc60dce82c5514a14ca9f413e9423df836c2d7f41f91ba014460d3e1dcfea87a491e72b6156f9ce312fe268c01
|
data/CHANGELOG.md
CHANGED
@@ -1,34 +1,57 @@
|
|
1
|
+
## 0.3.0
|
2
|
+
|
3
|
+
- Fix keyword arguments error for Ruby 3 support.
|
4
|
+
|
5
|
+
## 0.2.6
|
6
|
+
|
7
|
+
- Use `#__send__` instead of `#send`
|
8
|
+
|
9
|
+
## 0.2.5
|
10
|
+
|
11
|
+
- Remove unnecessary dependency on json
|
12
|
+
|
1
13
|
## 0.2.4
|
14
|
+
|
2
15
|
- Support `$schema` property
|
3
16
|
|
4
17
|
## 0.2.3
|
18
|
+
|
5
19
|
- Add :target_schema option on link definition
|
6
20
|
|
7
21
|
## 0.2.2
|
22
|
+
|
8
23
|
- Support :media_type option on link definition
|
9
24
|
|
10
25
|
## 0.2.1
|
26
|
+
|
11
27
|
- Provides raw_options method to reuse args for property definition
|
12
28
|
|
13
29
|
## 0.2.0
|
30
|
+
|
14
31
|
- Support :links option on embedding other resource as property
|
15
32
|
|
16
33
|
## 0.1.4
|
34
|
+
|
17
35
|
- Rename as_json_schema_without_link with as_json_schema_without_links
|
18
36
|
|
19
37
|
## 0.1.3
|
38
|
+
|
20
39
|
- Support boolean type on property definition
|
21
40
|
|
22
41
|
## 0.1.2
|
42
|
+
|
23
43
|
- Remove links property from embedded object
|
24
44
|
- Fix bug that links are unexpectedly shared by other classes
|
25
45
|
|
26
46
|
## 0.1.1
|
47
|
+
|
27
48
|
- Support embedding other JSON-Schema compatible object via type
|
28
49
|
- Support rel property on LinkDefinition
|
29
50
|
|
30
51
|
## 0.1.0
|
52
|
+
|
31
53
|
- Rename included module name: PropertyDefinable -> DSL
|
32
54
|
|
33
55
|
## 0.0.1
|
56
|
+
|
34
57
|
- 1st Release
|
data/Gemfile
CHANGED
data/json_world.gemspec
CHANGED
@@ -15,8 +15,4 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.require_paths = ["lib"]
|
16
16
|
|
17
17
|
spec.add_dependency "activesupport"
|
18
|
-
spec.add_dependency "json"
|
19
|
-
spec.add_development_dependency "bundler", "~> 1.9"
|
20
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
21
|
-
spec.add_development_dependency "rspec", "3.2.0"
|
22
18
|
end
|
data/lib/json_world/dsl.rb
CHANGED
@@ -52,9 +52,9 @@ module JsonWorld
|
|
52
52
|
# @param [Hash{Symbol => Object}] options
|
53
53
|
def link(link_name, options = {})
|
54
54
|
link_definitions << JsonWorld::LinkDefinition.new(
|
55
|
-
|
55
|
+
link_name: link_name,
|
56
|
+
**options.merge(
|
56
57
|
parent: self,
|
57
|
-
link_name: link_name,
|
58
58
|
),
|
59
59
|
)
|
60
60
|
end
|
@@ -68,9 +68,9 @@ module JsonWorld
|
|
68
68
|
# @param [Hash{Symbol => Object}] options
|
69
69
|
def property(property_name, options = {})
|
70
70
|
property_definitions << JsonWorld::PropertyDefinition.new(
|
71
|
-
|
71
|
+
property_name: property_name,
|
72
|
+
**options.merge(
|
72
73
|
parent: self,
|
73
|
-
property_name: property_name,
|
74
74
|
)
|
75
75
|
)
|
76
76
|
end
|
@@ -17,7 +17,7 @@ module JsonWorld
|
|
17
17
|
names = names & Array(options[:only]) if options[:only]
|
18
18
|
names.inject({}) do |hash, property_name|
|
19
19
|
key = property_name
|
20
|
-
value =
|
20
|
+
value = __send__(property_name)
|
21
21
|
value = value.iso8601 if value.is_a?(Time)
|
22
22
|
hash.merge(key => value)
|
23
23
|
end
|
@@ -83,7 +83,7 @@ module JsonWorld
|
|
83
83
|
# @return [Array<Hash>, nil]
|
84
84
|
def items_as_json_schema
|
85
85
|
if @options[:items]
|
86
|
-
JsonWorld::PropertyDefinition.new(
|
86
|
+
JsonWorld::PropertyDefinition.new(**@options[:items]).as_json_schema
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
@@ -112,9 +112,8 @@ module JsonWorld
|
|
112
112
|
if @options[:properties]
|
113
113
|
@options[:properties].map do |property_name, options|
|
114
114
|
JsonWorld::PropertyDefinition.new(
|
115
|
-
|
116
|
-
|
117
|
-
)
|
115
|
+
property_name: property_name,
|
116
|
+
**options
|
118
117
|
)
|
119
118
|
end
|
120
119
|
end
|
data/lib/json_world/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_world
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -24,63 +24,7 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
|
28
|
-
name: json
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '1.9'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '1.9'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '10.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '10.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 3.2.0
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - '='
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 3.2.0
|
83
|
-
description:
|
27
|
+
description:
|
84
28
|
email:
|
85
29
|
- r7kamura@gmail.com
|
86
30
|
executables: []
|
@@ -106,7 +50,7 @@ homepage: https://github.com/r7kamura/json_world
|
|
106
50
|
licenses:
|
107
51
|
- MIT
|
108
52
|
metadata: {}
|
109
|
-
post_install_message:
|
53
|
+
post_install_message:
|
110
54
|
rdoc_options: []
|
111
55
|
require_paths:
|
112
56
|
- lib
|
@@ -121,9 +65,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
65
|
- !ruby/object:Gem::Version
|
122
66
|
version: '0'
|
123
67
|
requirements: []
|
124
|
-
|
125
|
-
|
126
|
-
signing_key:
|
68
|
+
rubygems_version: 3.3.7
|
69
|
+
signing_key:
|
127
70
|
specification_version: 4
|
128
71
|
summary: Provides DSL to define JSON Schema representation of your class.
|
129
72
|
test_files: []
|