Fix Gitlab::GrapeOpenapi.generate arguments

What does this MR do and why?

Fixes Gitlab::GrapeOpenapi.generate arguments:

Gitlab::GrapeOpenapi.generate passes 2 arguments to Gitlab::GrapeOpenapi::Generator#initialize, which only accepts 1. This results in an ArgumentError being raised.

This commit fixes Gitlab::GrapeOpenapi.generate by making it accept only 1 argument.

References

Resolves: #583206

Screenshots or screen recordings

Before After

How to set up and validate locally

In the rails console:

Rails.application.eager_load!
api_classes = API::Base.descendants
entity_classes = Grape::Entity.descendants
spec = Gitlab::GrapeOpenapi.generate(api_classes: api_classes, entity_classes: entity_classes)
File.write(Rails.root.join('tmp', 'myfile.json'), JSON.pretty_generate(spec))

Confirm that:

  1. No error is raised
  2. <project-root>/tmp/myfile.json exists and has the expected structure

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #583206

Edited by Alberto Bignotti

Merge request reports

Loading