gitlab-grape-openapi 0.1.0 → 0.1.1

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: 5548e70ecc3368b56d965a6bbbc6ae8d448a8a230f0ff453c05d91fc3dfc4714
4
- data.tar.gz: f535c2530fa0eed45b85b92805973d62dc294b3c7475fd6464229dea5113f1b2
3
+ metadata.gz: 8f0408d05e90c29d726e2992e29455b1244d6dc028a28c9e63be8c1d4cfc1a23
4
+ data.tar.gz: 10157f62f24d46cb7e768fb141fdf391db6015d342f72f766b4225faa53919df
5
5
  SHA512:
6
- metadata.gz: 8410aab600a941dca435dd2da070dc1c68141cc5fea001452081216fd3b8f0714a1a87d39811ae9b482c55fc2350953c5bbe6979189631ad96a9d8641b7f42e8
7
- data.tar.gz: d1ed6e54fc2819e34b8b2acfdd2ef9077647f5c11b4b3bf7de59dad8466a480f4240edb8e30b22fb1a6e8c747e088ed8d2632f3e92e92aa75555f69f7760895a
6
+ metadata.gz: feb73a721b4d65eb5078105c4c21d360a86aeb93538164d115bf358fc38dadea00b5e2c177b23d2e5adc5cbae5c6172306c0ca4bb78a78a5a0a27f7154ef9f80
7
+ data.tar.gz: d61316ee6a5e1c20ae95e9f35430cff097d3b484301d2622ac426ee4355382b992dac5ae71db0dd492acf1f41eaa50b421b6d2bc86b52a99fd3af04f68cbc0b5
data/README.md CHANGED
@@ -103,6 +103,7 @@ end
103
103
  | `excluded_api_classes` | `Array<String>` | `[]` | API class names to exclude from generation |
104
104
  | `tag_overrides` | `Hash` | `{}` | Map of tag names to their display overrides |
105
105
  | `annotations` | `Hash` | `{}` | Map of Grape route settings to OpenAPI extension names |
106
+ | `warnings` | `Boolean` | `false` | Emit stderr warnings for synthesized (undeclared) path params |
106
107
 
107
108
  ### Annotations
108
109
 
@@ -212,6 +213,59 @@ bundle exec rspec
212
213
  bundle exec rubocop
213
214
  ```
214
215
 
216
+ ### Releasing
217
+
218
+ Releases are driven by the
219
+ [gem-release CI component](https://gitlab.com/gitlab-org/components/gem-release)
220
+ and a merge request whose title contains `RELEASE`.
221
+
222
+ 1. Open a merge request from the
223
+ [Release template](.gitlab/merge_request_templates/Release.md). The
224
+ `/title RELEASE: v<NEW_VERSION>` quick action ensures the title
225
+ contains `RELEASE`, which is what exposes the release-creation and
226
+ `gem-publication` jobs.
227
+ 2. Bump the `VERSION` constant in
228
+ `lib/gitlab/grape_openapi/version.rb` and fill in the changelog per
229
+ the template.
230
+ 3. Get the MR reviewed and merged. **Do not run the `gem-publication`
231
+ job from the MR pipeline** — it is meant to stay un-run during
232
+ review (see below).
233
+ 4. After merge, follow the post-release steps in `CLAUDE.md` to bump
234
+ the `gitlab-grape-openapi` version in `gitlab-org/gitlab` and
235
+ regenerate the committed `openapi_v3.yaml`.
236
+
237
+ #### How publishing works
238
+
239
+ `GEM_HOST_API_KEY` is configured as an **inherited, protected**
240
+ variable on a parent group, so it is only exposed to pipelines running
241
+ on protected branches or protected tags. This is why running the
242
+ `gem-publication` job manually from the MR pipeline fails — the API key
243
+ is not available there.
244
+
245
+ The expected flow relies on the default branch being protected:
246
+
247
+ - During review, the MR-pipeline `gem-publication` job stays un-run
248
+ (it is `manual`, and would fail anyway without the key).
249
+ - When the version bump lands on the default branch (`main`), the
250
+ `gem-publication` job runs again — this time with the protected
251
+ `GEM_HOST_API_KEY` available — and publishes the gem to RubyGems.
252
+
253
+ The gem-release component's rules that re-trigger publication after
254
+ merge:
255
+
256
+ ```yaml
257
+ .gem-release-default-rules:
258
+ rules:
259
+ - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
260
+ changes: ["lib/**/version.rb"]
261
+ - if: '$CI_MERGE_REQUEST_TITLE =~ /RELEASE/ && "...dry_run..." == "true"'
262
+ - if: '$CI_MERGE_REQUEST_TITLE =~ /RELEASE/'
263
+ when: manual
264
+ ```
265
+
266
+ The first rule is the one that publishes: a `push` to the default
267
+ branch that changes `lib/**/version.rb`.
268
+
215
269
  ## Contributing
216
270
 
217
271
  This gem is maintained by GitLab's API Platform team for internal use.
@@ -4,7 +4,7 @@ module Gitlab
4
4
  module GrapeOpenapi
5
5
  class Configuration
6
6
  attr_accessor :api_version, :api_prefix, :excluded_api_classes, :servers, :security_schemes, :info,
7
- :tag_overrides, :annotations, :coercer_mappings
7
+ :tag_overrides, :annotations, :coercer_mappings, :warnings
8
8
 
9
9
  def initialize
10
10
  @api_prefix = "api"
@@ -18,6 +18,7 @@ module Gitlab
18
18
  @tag_overrides = {}
19
19
  @annotations = {}
20
20
  @coercer_mappings = {}
21
+ @warnings = false
21
22
  end
22
23
  end
23
24
  end
@@ -116,14 +116,19 @@ module Gitlab
116
116
  params
117
117
  end
118
118
 
119
- # Emit a one-line stderr diagnostic identifying the route and API
119
+ # Emit a one-line stderr warning identifying the route and API
120
120
  # class responsible for a `schema: {}` entry in the generated spec.
121
+ # Disabled by default and gated behind `config.warnings` so it does
122
+ # not pollute stderr in callers that treat any warning output as a
123
+ # failure (e.g. GitLab's `fail_on_warnings` static-analysis wrapper).
121
124
  # The output is grep-friendly: each line starts with the literal
122
125
  # `[gitlab-grape-openapi]` tag and includes the HTTP method, the
123
126
  # full normalized path, the placeholder name, and the API class
124
127
  # name. From the class name, the source file follows GitLab's
125
128
  # autoload conventions (`API::Foo::Bar` -> `lib/api/foo/bar.rb`).
126
129
  def report_synthesized_parameter(placeholder)
130
+ return unless config.warnings
131
+
127
132
  api_class = route.app.options[:for] if route.app.respond_to?(:options)
128
133
  warn "[gitlab-grape-openapi] synthesized path param: " \
129
134
  "#{http_method} #{normalized_path} placeholder=:#{placeholder} " \
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module GrapeOpenapi
5
- # Version of the gem
6
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
7
6
  end
8
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-grape-openapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - group::api
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-03 00:00:00.000000000 Z
11
+ date: 2026-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape