jbuilder-schema 2.3.1 → 2.4.0

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: 7e54563767a015e7b3cb32a86f99155d08c90d317ad6c89f79d7634b3a428993
4
- data.tar.gz: d65a34bc554e7d1416b5e9cb0fd0d32b1c26454506ec5148ad7343f001c0bce4
3
+ metadata.gz: d21f87d24f37c97ea05dfcdef1688249098d973c62bfec84a98495ae6c57976f
4
+ data.tar.gz: c13ab2aeb505785a8915547ce0cf84c7987e0dc0def4e2b20ce5a47be92749d8
5
5
  SHA512:
6
- metadata.gz: 11a516b42e9d28a515e504a59b5f51916d5e8ba74211dda0bad5eea11e0fae80af546e442e4b71274efce5bb555d2c5d6fd453ee342a966c03fa2f50f72e6fe0
7
- data.tar.gz: a1f2a4c564bdb28b6a8ef72b5fc345fcaac03885cc8819763b9a61139b2ab468472a9ec7494b7a3c2bcab311092a754e8f30521ebbcd2c1807bc515814d371f1
6
+ metadata.gz: 2aef6970a39b78310a23e6dbbe441ef64ddb03133968cedec87e0e97ecf8b8b83a1a1842d27ff29aa378f8d751963d041233794a1579bc6ecb722e218f0e3cf2
7
+ data.tar.gz: '028fb5e6a97b3a714365c1bcdf94b1f584710839685e81f7c4dd2bc514a68fcccbbcf046ddcc890559573f65696407c02023e8321f642861df3ae9d6b6419b91'
data/Gemfile CHANGED
@@ -12,3 +12,13 @@ gem "sqlite3"
12
12
  gem "standard", "~> 1.3"
13
13
 
14
14
  gem "mocha"
15
+
16
+ rails_version = ENV.fetch("RAILS_VERSION", "7.0")
17
+
18
+ rails_constraint = if rails_version == "main"
19
+ {github: "rails/rails"}
20
+ else
21
+ "~> #{rails_version}.0"
22
+ end
23
+
24
+ gem "rails", rails_constraint
@@ -37,7 +37,9 @@ class Jbuilder::Schema::Renderer
37
37
  options[:locals].merge! @default_locals if @default_locals
38
38
  options[:locals][:__jbuilder_schema_options] = {json: json, object: object, title: title, description: description}
39
39
 
40
- @view_renderer.render(options)
40
+ @view_renderer.render(options).then do |result|
41
+ result.respond_to?(:unwrap_target!) ? result.unwrap_target! : result
42
+ end
41
43
  end
42
44
 
43
45
  # Thin wrapper around the regular Jbuilder JSON output render, which also parses it into a hash.
@@ -54,8 +54,22 @@ class Jbuilder::Schema
54
54
  @ignore_nil = false
55
55
  end
56
56
 
57
+ class TargetWrapper
58
+ def initialize(object)
59
+ @object = object
60
+ end
61
+
62
+ # Rails 7.1 calls `to_s` on our `target!` (the return value from our templates).
63
+ # To get around that and let our inner Hash through, we add this override.
64
+ # `unwrap_target!` is added for backwardscompatibility so we get the inner Hash on Rails < 7.1.
65
+ def to_s
66
+ @object
67
+ end
68
+ alias unwrap_target! to_s
69
+ end
70
+
57
71
  def target!
58
- schema!
72
+ TargetWrapper.new(schema!)
59
73
  end
60
74
 
61
75
  def schema!
@@ -1,4 +1,4 @@
1
1
  # We can't use the standard `Jbuilder::Schema::VERSION =` because
2
2
  # `Jbuilder` isn't a regular module namespace, but a class …which also loads Active Support.
3
3
  # So we use trickery, and assign the proper version once `jbuilder/schema.rb` is loaded.
4
- JBUILDER_SCHEMA_VERSION = "2.3.1"
4
+ JBUILDER_SCHEMA_VERSION = "2.4.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jbuilder-schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuri Sidorov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-06 00:00:00.000000000 Z
11
+ date: 2023-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jbuilder
@@ -31,9 +31,6 @@ dependencies:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 5.0.0
34
- - - "<"
35
- - !ruby/object:Gem::Version
36
- version: 7.1.0
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
@@ -41,9 +38,6 @@ dependencies:
41
38
  - - ">="
42
39
  - !ruby/object:Gem::Version
43
40
  version: 5.0.0
44
- - - "<"
45
- - !ruby/object:Gem::Version
46
- version: 7.1.0
47
41
  description: Generate JSON Schema from Jbuilder files
48
42
  email:
49
43
  - hey@yurisidorov.com
@@ -53,7 +47,6 @@ extra_rdoc_files: []
53
47
  files:
54
48
  - ".standard.yml"
55
49
  - Gemfile
56
- - Gemfile.lock
57
50
  - LICENSE.txt
58
51
  - README.md
59
52
  - Rakefile
data/Gemfile.lock DELETED
@@ -1,215 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- jbuilder-schema (2.3.1)
5
- jbuilder
6
- rails (>= 5.0.0, < 7.1.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- actioncable (7.0.8)
12
- actionpack (= 7.0.8)
13
- activesupport (= 7.0.8)
14
- nio4r (~> 2.0)
15
- websocket-driver (>= 0.6.1)
16
- actionmailbox (7.0.8)
17
- actionpack (= 7.0.8)
18
- activejob (= 7.0.8)
19
- activerecord (= 7.0.8)
20
- activestorage (= 7.0.8)
21
- activesupport (= 7.0.8)
22
- mail (>= 2.7.1)
23
- net-imap
24
- net-pop
25
- net-smtp
26
- actionmailer (7.0.8)
27
- actionpack (= 7.0.8)
28
- actionview (= 7.0.8)
29
- activejob (= 7.0.8)
30
- activesupport (= 7.0.8)
31
- mail (~> 2.5, >= 2.5.4)
32
- net-imap
33
- net-pop
34
- net-smtp
35
- rails-dom-testing (~> 2.0)
36
- actionpack (7.0.8)
37
- actionview (= 7.0.8)
38
- activesupport (= 7.0.8)
39
- rack (~> 2.0, >= 2.2.4)
40
- rack-test (>= 0.6.3)
41
- rails-dom-testing (~> 2.0)
42
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
43
- actiontext (7.0.8)
44
- actionpack (= 7.0.8)
45
- activerecord (= 7.0.8)
46
- activestorage (= 7.0.8)
47
- activesupport (= 7.0.8)
48
- globalid (>= 0.6.0)
49
- nokogiri (>= 1.8.5)
50
- actionview (7.0.8)
51
- activesupport (= 7.0.8)
52
- builder (~> 3.1)
53
- erubi (~> 1.4)
54
- rails-dom-testing (~> 2.0)
55
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
56
- activejob (7.0.8)
57
- activesupport (= 7.0.8)
58
- globalid (>= 0.3.6)
59
- activemodel (7.0.8)
60
- activesupport (= 7.0.8)
61
- activerecord (7.0.8)
62
- activemodel (= 7.0.8)
63
- activesupport (= 7.0.8)
64
- activestorage (7.0.8)
65
- actionpack (= 7.0.8)
66
- activejob (= 7.0.8)
67
- activerecord (= 7.0.8)
68
- activesupport (= 7.0.8)
69
- marcel (~> 1.0)
70
- mini_mime (>= 1.1.0)
71
- activesupport (7.0.8)
72
- concurrent-ruby (~> 1.0, >= 1.0.2)
73
- i18n (>= 1.6, < 2)
74
- minitest (>= 5.1)
75
- tzinfo (~> 2.0)
76
- ast (2.4.2)
77
- base64 (0.1.1)
78
- builder (3.2.4)
79
- concurrent-ruby (1.2.2)
80
- crass (1.0.6)
81
- date (3.3.3)
82
- erubi (1.12.0)
83
- globalid (1.2.1)
84
- activesupport (>= 6.1)
85
- i18n (1.14.1)
86
- concurrent-ruby (~> 1.0)
87
- jbuilder (2.11.5)
88
- actionview (>= 5.0.0)
89
- activesupport (>= 5.0.0)
90
- json (2.6.3)
91
- language_server-protocol (3.17.0.3)
92
- lint_roller (1.1.0)
93
- loofah (2.21.3)
94
- crass (~> 1.0.2)
95
- nokogiri (>= 1.12.0)
96
- mail (2.8.1)
97
- mini_mime (>= 0.1.1)
98
- net-imap
99
- net-pop
100
- net-smtp
101
- marcel (1.0.2)
102
- method_source (1.0.0)
103
- mini_mime (1.1.5)
104
- mini_portile2 (2.8.4)
105
- minitest (5.20.0)
106
- mocha (2.1.0)
107
- ruby2_keywords (>= 0.0.5)
108
- net-imap (0.4.0)
109
- date
110
- net-protocol
111
- net-pop (0.1.2)
112
- net-protocol
113
- net-protocol (0.2.1)
114
- timeout
115
- net-smtp (0.4.0)
116
- net-protocol
117
- nio4r (2.5.9)
118
- nokogiri (1.15.4)
119
- mini_portile2 (~> 2.8.2)
120
- racc (~> 1.4)
121
- parallel (1.23.0)
122
- parser (3.2.2.4)
123
- ast (~> 2.4.1)
124
- racc
125
- racc (1.7.1)
126
- rack (2.2.8)
127
- rack-test (2.1.0)
128
- rack (>= 1.3)
129
- rails (7.0.8)
130
- actioncable (= 7.0.8)
131
- actionmailbox (= 7.0.8)
132
- actionmailer (= 7.0.8)
133
- actionpack (= 7.0.8)
134
- actiontext (= 7.0.8)
135
- actionview (= 7.0.8)
136
- activejob (= 7.0.8)
137
- activemodel (= 7.0.8)
138
- activerecord (= 7.0.8)
139
- activestorage (= 7.0.8)
140
- activesupport (= 7.0.8)
141
- bundler (>= 1.15.0)
142
- railties (= 7.0.8)
143
- rails-dom-testing (2.2.0)
144
- activesupport (>= 5.0.0)
145
- minitest
146
- nokogiri (>= 1.6)
147
- rails-html-sanitizer (1.6.0)
148
- loofah (~> 2.21)
149
- nokogiri (~> 1.14)
150
- railties (7.0.8)
151
- actionpack (= 7.0.8)
152
- activesupport (= 7.0.8)
153
- method_source
154
- rake (>= 12.2)
155
- thor (~> 1.0)
156
- zeitwerk (~> 2.5)
157
- rainbow (3.1.1)
158
- rake (13.0.6)
159
- regexp_parser (2.8.1)
160
- rexml (3.2.6)
161
- rubocop (1.56.4)
162
- base64 (~> 0.1.1)
163
- json (~> 2.3)
164
- language_server-protocol (>= 3.17.0)
165
- parallel (~> 1.10)
166
- parser (>= 3.2.2.3)
167
- rainbow (>= 2.2.2, < 4.0)
168
- regexp_parser (>= 1.8, < 3.0)
169
- rexml (>= 3.2.5, < 4.0)
170
- rubocop-ast (>= 1.28.1, < 2.0)
171
- ruby-progressbar (~> 1.7)
172
- unicode-display_width (>= 2.4.0, < 3.0)
173
- rubocop-ast (1.29.0)
174
- parser (>= 3.2.1.0)
175
- rubocop-performance (1.19.1)
176
- rubocop (>= 1.7.0, < 2.0)
177
- rubocop-ast (>= 0.4.0)
178
- ruby-progressbar (1.13.0)
179
- ruby2_keywords (0.0.5)
180
- sqlite3 (1.6.6)
181
- mini_portile2 (~> 2.8.0)
182
- standard (1.31.1)
183
- language_server-protocol (~> 3.17.0.2)
184
- lint_roller (~> 1.0)
185
- rubocop (~> 1.56.2)
186
- standard-custom (~> 1.0.0)
187
- standard-performance (~> 1.2)
188
- standard-custom (1.0.2)
189
- lint_roller (~> 1.0)
190
- rubocop (~> 1.50)
191
- standard-performance (1.2.0)
192
- lint_roller (~> 1.1)
193
- rubocop-performance (~> 1.19.0)
194
- thor (1.2.2)
195
- timeout (0.4.0)
196
- tzinfo (2.0.6)
197
- concurrent-ruby (~> 1.0)
198
- unicode-display_width (2.5.0)
199
- websocket-driver (0.7.6)
200
- websocket-extensions (>= 0.1.0)
201
- websocket-extensions (0.1.5)
202
- zeitwerk (2.6.12)
203
-
204
- PLATFORMS
205
- ruby
206
-
207
- DEPENDENCIES
208
- jbuilder-schema!
209
- mocha
210
- rake (~> 13.0)
211
- sqlite3
212
- standard (~> 1.3)
213
-
214
- BUNDLED WITH
215
- 2.4.10