bullet_train-api 1.1.12 → 1.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/api/open_api_controller.rb +12 -14
- data/lib/bullet_train/api/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a26bfba5a9e08beab9b2e9ef020751627ba9f5e622708f74bf44798ea903434b
|
4
|
+
data.tar.gz: b40893d54092bb315a343891b69a0cc84a651c30775bd8840f0a3b917b791136
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2794b6b2cb7574361e60c9ef1e26b9cf1cf142c557f6bbebb60fe724b2c7c7ea0857b036ad432c0cfee1d9e286508db49ea63822d06ea71a0566407f60cbd082
|
7
|
+
data.tar.gz: 2b4f042745a52886ba79973b159fe3a70b216f55591d537746d1a0a62365454ad6be01f132ed198665b03ed24f85022eeecd7fa5788555ce2dccdd52c5f1ae03
|
@@ -25,31 +25,29 @@ module OpenApiHelper
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def automatic_paths_for(model, parent, except: [])
|
28
|
-
output = render("api/
|
28
|
+
output = render("api/#{@version}/open_api/shared/paths", except: except)
|
29
29
|
output = Scaffolding::Transformer.new(model.name, [parent&.name]).transform_string(output).html_safe
|
30
30
|
indent(output, 1)
|
31
31
|
end
|
32
32
|
|
33
33
|
def automatic_components_for(model, locals: {})
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
jbuilder = Jbuilder::Schema.renderer("app/views/api/#{@version}", locals: {
|
35
|
+
# If we ever get to the point where we need a real model here, we should implement an example team in seeds that we can source it from.
|
36
|
+
model.name.underscore.split("/").last.to_sym => model.new,
|
37
|
+
# Same here, if we ever need this to be a real object, this should be `test@example.com` with an `SecureRandom.hex` password.
|
38
|
+
:current_user => User.new
|
39
|
+
}.merge(locals))
|
40
|
+
|
41
|
+
schema_json = jbuilder.json(
|
42
|
+
model.new,
|
37
43
|
title: I18n.t("#{model.name.underscore.pluralize}.label"),
|
38
44
|
# TODO Improve this. We don't have a generic description for models we can use here.
|
39
45
|
description: I18n.t("#{model.name.underscore.pluralize}.label"),
|
40
|
-
|
41
|
-
paths: view_paths.map(&:path),
|
42
|
-
model: model,
|
43
|
-
locals: {
|
44
|
-
# If we ever get to the point where we need a real model here, we should implement an example team in seeds that we can source it from.
|
45
|
-
model.name.underscore.split("/").last.to_sym => model.new,
|
46
|
-
# Same here, if we ever need this to be a real object, this should be `test@example.com` with an `SecureRandom.hex` password.
|
47
|
-
:current_user => User.new
|
48
|
-
}.merge(locals))
|
46
|
+
)
|
49
47
|
|
50
48
|
attributes_output = JSON.parse(schema_json)
|
51
49
|
|
52
|
-
strong_params_module = "Api
|
50
|
+
strong_params_module = "Api::#{@version.upcase}::#{model.name.pluralize}Controller::StrongParameters".constantize
|
53
51
|
strong_parameter_keys = BulletTrain::Api::StrongParametersReporter.new(model, strong_params_module).report
|
54
52
|
if strong_parameter_keys.last.is_a?(Hash)
|
55
53
|
strong_parameter_keys += strong_parameter_keys.pop.keys
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_train-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 2.0.0
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 2.0.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: bullet_train
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|