Declare path parameters in API files (Batch 2)

What does this MR do and why?

Stacks on top of batch 1. Adds requires / optional declarations for path placeholders in the remaining 32 API files.

Same convention as batch 1: [String, Integer] for URL-encoded path IDs, Integer for numeric DB IDs, String for slug-style identifiers.

Combined with batch 1 this empties the cop's grandfather list: .rubocop_todo/api/path_parameter_declaration.yml is deleted and the API/PathParameterDeclaration cop now runs fully unfiltered against lib/**/api/**/*.rb and ee/lib/**/api/**/*.rb.

Important caveat: combined with batch 1, the two MRs eliminate 116 of the 474 synthesized path parameters in master's OpenAPI v3 spec — roughly 24% of the total. The remaining 358 are not source-code bugs: they come from API classes mounted (mount ::API::Foo) under a parent that declares the placeholder, where the child class itself doesn't repeat the declaration and the generator does not follow the mount chain back to the parent. Driving those to zero needs the generator fix in gitlab-org/ruby/gems/gitlab-grape-openapi!19 (merged).

YAML reduction: 421 → 358 in this MR (-63). Combined with batch 1: 474 → 358 (-116).

How to set up and validate locally

grep -c "schema: {}" doc/api/openapi/openapi_v3.yaml
# => 358 after this MR (was 421 after batch 1, 474 on master)

bundle exec rubocop --only API/PathParameterDeclaration lib/api ee/lib/api
# => 0 offenses

bin/rake gitlab:openapi:v3:generate
bin/rake gitlab:openapi:v2:generate
# Both should report "up to date" after running.

References

Related to: #593537 (closed)

Edited by Alberto Bignotti

Merge request reports

Loading
Loading