grape-swagger 2.1.3 → 2.1.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: e83759346d523a9dc09d200cb5477b65ea4f84cc832cd90f1e74ff3dc5a08277
4
- data.tar.gz: 3c4a6fbabe58a5382332544358d23e0c5eb94cf2a9b53d02f221da1a749814e2
3
+ metadata.gz: 7d2c2cc9aaea81baa5c7796897dd104559e7e8aa57020097fe899e35a21287cd
4
+ data.tar.gz: f8451dde88f7b7af02ff90f59cdd66ed7d5d8ff34b318be91f1e2ac6767c865f
5
5
  SHA512:
6
- metadata.gz: 76b0e94bf1b75dde592f8602b253bbc701bbb6334d9456d340d342ed01d45f3d7153ef47998375a9a960fd29a24a9022bf5e371d280a336a0c24aee932b93f52
7
- data.tar.gz: 55b59bbfd070ee86285575e1be90259d93f0f57b18f55744f3711b32c210016afc7672a45e90d0509e3c854d1ca266c143f8bad85a19cb0d2babc33baa7cebb2
6
+ metadata.gz: a627ebc160edef37753bbfe3c049ece8426195d3a1d08a26a4fef7f6f2a0b8f0a49b250be74cca0d096e277c46a041c56a6f4e336ccf1aa0f09ec5a9037f6edb
7
+ data.tar.gz: 2ebf30ff9123454a77151a48a3f55f4d301a15e984c0dea2fd8ee92867a254d28581546796e629cbd94bb362e0902e4c80574b88be01b75df625c95bd7b0324c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ### 2.1.4 (2026-02-02)
2
+
3
+ #### Features
4
+
5
+ * [#970](https://github.com/ruby-grape/grape-swagger/pull/970): Migrate Danger to use danger-pr-comment workflow - [@dblock](https://github.com/dblock).
6
+ * [#972](https://github.com/ruby-grape/grape-swagger/pull/972): Add weekly scheduled workflow to test against Grape HEAD - [@numbata](https://github.com/numbata).
7
+
8
+ #### Fixes
9
+
10
+ * [#972](https://github.com/ruby-grape/grape-swagger/pull/972): Grape 3.1.0 and grape-swagger-entity 0.7.1 compatibility - [@numbata](https://github.com/numbata).
11
+
1
12
  ### 2.1.3 (2025-11-21)
2
13
 
3
14
  #### Features
data/CLAUDE.md ADDED
@@ -0,0 +1,88 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ grape-swagger is a Ruby gem that auto-generates Swagger 2.0 documentation for Grape APIs. It extends Grape APIs with `add_swagger_documentation` to register documentation endpoints that output OpenAPI/Swagger-compliant JSON.
8
+
9
+ **Key dependencies:** Grape >= 1.7 (supports up to 3.x), Ruby >= 3.1
10
+
11
+ ## Common Commands
12
+
13
+ ```bash
14
+ # Install dependencies
15
+ bundle install
16
+
17
+ # Run all tests + RuboCop
18
+ bundle exec rake
19
+
20
+ # Run tests only
21
+ bundle exec rspec
22
+
23
+ # Run a single test file
24
+ bundle exec rspec spec/swagger_v2/api_swagger_v2_spec.rb
25
+
26
+ # Run a specific test by line number
27
+ bundle exec rspec spec/swagger_v2/api_swagger_v2_spec.rb:42
28
+
29
+ # Run RuboCop linting
30
+ bundle exec rubocop
31
+
32
+ # Test with different model parsers
33
+ MODEL_PARSER=grape-swagger-entity bundle exec rspec
34
+ MODEL_PARSER=grape-swagger-representable bundle exec rspec
35
+
36
+ # Test with a specific Grape version
37
+ GRAPE_VERSION=2.2.0 bundle update && bundle exec rspec
38
+ ```
39
+
40
+ ## Architecture
41
+
42
+ ### Core Extension Flow
43
+
44
+ 1. **Entry point:** `lib/grape-swagger.rb` - Extends `GrapeInstance` with `SwaggerDocumentationAdder` mixin
45
+ 2. **Endpoint generation:** `lib/grape-swagger/endpoint.rb` - Extends `Grape::Endpoint` to build Swagger objects from route definitions
46
+ 3. **Documentation helpers:** `lib/grape-swagger/doc_methods.rb` - Central module for generating paths, definitions, tags
47
+
48
+ ### Pluggable Systems
49
+
50
+ **Model Parsers** (`lib/grape-swagger/model_parsers.rb`):
51
+ - Registry for handling different entity types (Grape::Entity, representable, custom)
52
+ - Access via `GrapeSwagger.model_parsers`
53
+ - Supports `insert_before` and `insert_after` for ordering
54
+
55
+ **Request Param Parsers** (`lib/grape-swagger/request_param_parser_registry.rb`):
56
+ - Three default parsers: Headers, Route, Body (in `request_param_parsers/`)
57
+ - Access via `GrapeSwagger.request_param_parsers`
58
+
59
+ ### Key Modules
60
+
61
+ - `SwaggerDocumentationAdder` - Adds `add_swagger_documentation` method to Grape APIs
62
+ - `SwaggerRouting` - Combines routes by resource path, handles namespace routing
63
+ - `GrapeSwagger::DocMethods` - Helpers in `doc_methods/` subdirectory for specific documentation tasks
64
+
65
+ ## Testing Patterns
66
+
67
+ - Tests use `Rack::Test::Methods` for HTTP testing
68
+ - Define an `app` method returning a `Grape::API` subclass in specs
69
+ - Use shared contexts like `include_context "#{MODEL_PARSER} swagger example"` for model parser testing
70
+ - Tests run with random order (seed: 40834)
71
+ - `MODEL_PARSER` env var controls which parser to test (mock, entity, representable)
72
+
73
+ ## Code Style
74
+
75
+ - Always include `# frozen_string_literal: true` at file start
76
+ - Max line length: 120 characters
77
+ - RuboCop enforced with some rules relaxed in `.rubocop_todo.yml`
78
+ - Naming cops disabled; Style cops mostly disabled
79
+ - Spec files excluded from most length/complexity checks
80
+
81
+ ## Contributing Workflow
82
+
83
+ 1. Create feature branch from master
84
+ 2. Write tests first (add to `spec/`)
85
+ 3. Implement feature
86
+ 4. Run `bundle exec rake` (must pass)
87
+ 5. Add entry to CHANGELOG.md under *Next Release*
88
+ 6. Submit PR
@@ -155,8 +155,8 @@ module Grape
155
155
  end
156
156
 
157
157
  def produces_object(route, format)
158
- return ['application/octet-stream'] if file_response?(route.attributes.success) &&
159
- !route.attributes.produces.present?
158
+ return ['application/octet-stream'] if file_response?(route.options[:success]) &&
159
+ !route.options[:produces].present?
160
160
 
161
161
  mime_types = GrapeSwagger::DocMethods::ProducesConsumes.call(format)
162
162
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GrapeSwagger
4
- VERSION = '2.1.3'
4
+ VERSION = '2.1.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-swagger
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - LeFnord
8
8
  - Tim Vandecasteele
9
+ autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 1980-01-02 00:00:00.000000000 Z
12
+ date: 2026-02-03 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: grape
@@ -30,6 +31,7 @@ dependencies:
30
31
  - - "<"
31
32
  - !ruby/object:Gem::Version
32
33
  version: '4.0'
34
+ description:
33
35
  email:
34
36
  - pscholz.le@gmail.com
35
37
  - tim.vandecasteele@gmail.com
@@ -38,6 +40,7 @@ extensions: []
38
40
  extra_rdoc_files: []
39
41
  files:
40
42
  - CHANGELOG.md
43
+ - CLAUDE.md
41
44
  - CONTRIBUTING.md
42
45
  - LICENSE.txt
43
46
  - README.md
@@ -75,6 +78,7 @@ licenses:
75
78
  - MIT
76
79
  metadata:
77
80
  rubygems_mfa_required: 'true'
81
+ post_install_message:
78
82
  rdoc_options: []
79
83
  require_paths:
80
84
  - lib
@@ -89,7 +93,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
93
  - !ruby/object:Gem::Version
90
94
  version: '0'
91
95
  requirements: []
92
- rubygems_version: 3.6.8
96
+ rubygems_version: 3.5.22
97
+ signing_key:
93
98
  specification_version: 4
94
99
  summary: Add auto generated documentation to your Grape API that can be displayed
95
100
  with Swagger.