Declare path parameters in API files (Batch 1)
What does this MR do and why?
Adds requires / optional declarations for path placeholders in 32 API
files. Without these declarations, the generated OpenAPI v3 spec emits
schema: {} (no type information) for each path placeholder — valid OpenAPI
3.0 but missing the type metadata the published API reference depends on.
Each declaration uses the type appropriate for that file's resource:
[String, Integer]for IDs that accept URL-encoded paths (projects/groups/namespaces)Integerfor numeric DB IDsStringfor slug-style identifiers
Each fixed file is also removed from
.rubocop_todo/api/path_parameter_declaration.yml, so the
API/PathParameterDeclaration cop becomes active on those files. The
companion batch 2 is
stacked on this MR and removes the remaining 32 entries (and the now-empty
todo file).
The diff to doc/api/openapi/openapi_v3.yaml (and the companion v2 spec) is
the regenerated output of bin/rake gitlab:openapi:v3:generate /
:v2:generate; no manual edits.
YAML reduction: 474 → 421 synthesized path parameters in this MR (-53).
How to set up and validate locally
grep -c "schema: {}" doc/api/openapi/openapi_v3.yaml
# => 421 after this MR (was 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)