hephaestus 0.6.2 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ee150804d80090a603c52698b45937f96bbd8bf52d13f295f68471831b2e69b
4
- data.tar.gz: de6060aa80ddfd82cc2d122cb8c0b941c1fd6fa70fce4d44190aec6ff91ad779
3
+ metadata.gz: 2d7d756704650efcb7d0eea9e659c7a0001c8734753f1cbea499ca7bb1a50126
4
+ data.tar.gz: 9b514a9719ded67a3f00f8aa94ba84923effa9a99bc1cb4c071a953035907898
5
5
  SHA512:
6
- metadata.gz: 8b022f681eccc353d032f1f5799b8412d13d69dbcfdbc080d526d2f8f40817c44653f77ef9f901449c1b6fcd658f187bf6092fb54e32e3df8b60ad8b321e7720
7
- data.tar.gz: 8c95113092f22e23f201c17d0bef1ff71cfb7ad10f5ef44acd6370f847f69970e980ceae58e8f697bbd9427fdc5bd9196b68d68b5c84885987701520275baf7a
6
+ metadata.gz: ca22f649c758b8b66ccf6e088dc2200023501f03bf08e9623054aac5469eed5f49f42b8214290f243e52df01f3f63ba2da17fb953aec3b1d8079c5320a509f8f
7
+ data.tar.gz: 707e1dcafec434dcea74880164f28a0095cca745beda6658bf38c13a30b98a36a9ba6a5b29ead4ab09b8f58557174a9b02757b1564f359c278ca9bbdf842affa
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # [v0.6.4] - 09-07-2024
2
+ ## What's Changed
3
+ * Updates for OpenAPI dependency by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/23
4
+
5
+
6
+ **Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.6.3...v0.6.4
7
+ # [v0.6.3] - 05-07-2024
8
+ ## What's Changed
9
+ * Changes to support Rack 3 param parsing by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/21
10
+
11
+
12
+ **Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.6.2...v0.6.3
1
13
  # [v0.6.2] - 19-06-2024
2
14
  ## What's Changed
3
15
  * Use Ruby test suite by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/18
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Hephaestus
5
- VERSION = "0.6.2"
5
+ VERSION = "0.6.4"
6
6
  RAILS_VERSION = "~> 7.0"
7
7
  RUBY_VERSION = File
8
8
  .read("#{File.dirname(__FILE__)}/../../.ruby-version")
@@ -29,16 +29,16 @@ module PlugApp
29
29
 
30
30
  case validated_request.error
31
31
  when OpenapiFirst::Schema::ValidationError
32
- error_arr = format_arr(validated_request.error.errors.map(&:error))
32
+ error_arr = format_arr(validated_request.error.errors.map(&:message))
33
33
  Rails.logger.error(error_arr) if print_user_api_errors?
34
34
  [PlugApp::HTTP::BAD_REQUEST_I, { "Content-Type" => "application/json" }, [error_arr]]
35
35
  else
36
- case validated_request.error.error_type
36
+ case validated_request.error.type
37
37
  when :not_found
38
38
  [PlugApp::HTTP::NOT_FOUND_I, { "Content-Type" => "application/json" }, [format_str("Not Found")]]
39
39
  else
40
40
  error_message = if validated_request.error.errors.present?
41
- format_arr(validated_request.error.errors.map(&:error))
41
+ format_arr(validated_request.error.errors.map(&:message))
42
42
  else
43
43
  format_str(validated_request.error.message)
44
44
  end
@@ -14,6 +14,7 @@ module PlugApp
14
14
 
15
15
  HTTP_REQUEST_BODY = "http.request.body"
16
16
  PLUG_APP_PATH_PREFIX = "/app/"
17
+ RACK_REQUEST_BODY = "rack.input"
17
18
 
18
19
  sig { params(app: T.untyped).void }
19
20
  def initialize(app)
@@ -23,24 +24,22 @@ module PlugApp
23
24
 
24
25
  sig { params(env: T.untyped).returns(T.untyped) }
25
26
  def call(env)
26
- request = ActionDispatch::Request.new(env.dup)
27
-
28
27
  OpenTelemetry::Trace.current_span.add_attributes({
29
28
  OpenTelemetry::VERSION => PlugApp::Application::GIT_SHA,
30
29
  OpenTelemetry::SemanticConventions::Trace::HTTP_REQUEST_CONTENT_LENGTH => env["CONTENT_LENGTH"].to_i,
31
- HTTP_REQUEST_BODY => filtered_params(request),
30
+ HTTP_REQUEST_BODY => filtered_params(env),
32
31
  })
33
32
 
34
33
  app.call(env)
35
34
  end
36
35
 
37
- def filtered_params(request)
38
- params = request.params
39
- if request.path.starts_with?(PLUG_APP_PATH_PREFIX)
40
- {}
41
- else
42
- @filterer.filter(params)
43
- end.to_json
36
+ def filtered_params(env)
37
+ body = env[RACK_REQUEST_BODY]&.read
38
+ return "{}" if body.blank? || body == "{}"
39
+
40
+ @filterer.filter(JSON.parse(body)).to_json
41
+ ensure
42
+ env[RACK_REQUEST_BODY]&.try(:rewind)
44
43
  end
45
44
  end
46
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hephaestus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-19 00:00:00.000000000 Z
11
+ date: 2024-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,7 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.0'
41
+ force_ruby_platform: false
41
42
  - !ruby/object:Gem::Dependency
42
43
  name: rails
43
44
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +53,7 @@ dependencies:
52
53
  - - "~>"
53
54
  - !ruby/object:Gem::Version
54
55
  version: '7.0'
56
+ force_ruby_platform: false
55
57
  - !ruby/object:Gem::Dependency
56
58
  name: rainbow
57
59
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +68,7 @@ dependencies:
66
68
  - - "~>"
67
69
  - !ruby/object:Gem::Version
68
70
  version: '3.0'
71
+ force_ruby_platform: false
69
72
  - !ruby/object:Gem::Dependency
70
73
  name: minitest
71
74
  requirement: !ruby/object:Gem::Requirement
@@ -97,7 +100,7 @@ dependencies:
97
100
  description: 'Hephaestus is a Rails generator to create plugs for Yetto.
98
101
 
99
102
  '
100
- email:
103
+ email:
101
104
  executables:
102
105
  - hephaestus
103
106
  extensions: []
@@ -127,7 +130,6 @@ files:
127
130
  - lib/hephaestus/version.rb
128
131
  - templates/.dockerignore
129
132
  - templates/.env.sample
130
- - templates/.github/.DS_Store
131
133
  - templates/.github/dependabot.yml
132
134
  - templates/.github/workflows/automerge.yml
133
135
  - templates/.github/workflows/deploy.yml
@@ -231,7 +233,7 @@ homepage: http://github.com/yettoapp/hephaestus
231
233
  licenses:
232
234
  - MIT
233
235
  metadata: {}
234
- post_install_message:
236
+ post_install_message:
235
237
  rdoc_options:
236
238
  - "--charset=UTF-8"
237
239
  require_paths:
@@ -247,8 +249,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
249
  - !ruby/object:Gem::Version
248
250
  version: 3.4.7
249
251
  requirements: []
250
- rubygems_version: 3.5.9
251
- signing_key:
252
+ rubygems_version: 3.5.3
253
+ signing_key:
252
254
  specification_version: 4
253
255
  summary: Generate a Rails app that can be used to create plugs for Yetto.
254
256
  test_files: []
Binary file