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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e55d0effeb9188d21a24323a9e88cb1fce4fc6a6fd81da33e806241c2d6b95be
4
- data.tar.gz: 3013839e3dcae27fe9598a62d9f8a12bc3786d0d955c6aabc825ddae02f1aee9
3
+ metadata.gz: a26bfba5a9e08beab9b2e9ef020751627ba9f5e622708f74bf44798ea903434b
4
+ data.tar.gz: b40893d54092bb315a343891b69a0cc84a651c30775bd8840f0a3b917b791136
5
5
  SHA512:
6
- metadata.gz: 18cdb451e66b3f3d3f5fe61e9278907a6b5af226b7a40c3a47de1dd150aea8e1905d86edbbb484d4ac8a4a19bf2e463134f74d6fb626fbd8bef454fcfc909828
7
- data.tar.gz: ae74c9a6939b05d6e06aea4da6525bf8700f1cd1a1ecd9901a234dab235d1666db518f6a277ba6a0e44338d6ecf50922e97caf8f9d4e2fb01f5b6817e2a3e4b2
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/v1/open_api/shared/paths", except: except)
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
- extend JbuilderSchema
35
-
36
- schema_json = jbuilder_schema("api/v1/#{model.name.underscore.pluralize}/_#{model.name.underscore.split("/").last}",
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
- format: :json,
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::V1::#{model.name.pluralize}Controller::StrongParameters".constantize
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
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module Api
3
- VERSION = "1.1.12"
3
+ VERSION = "1.1.13"
4
4
  end
5
5
  end
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.12
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: '0'
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: '0'
110
+ version: 2.0.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: bullet_train
113
113
  requirement: !ruby/object:Gem::Requirement