Skip to content

Fix OpenAPI route generator for Response return contract #520

Description

@armanist

Summary

install:openapi currently generates route closures that are expected to return Quantum\Http\Response, but one generated closure can reference an undefined $response variable after contract migration.

Problem

In OpenApiCommand::openapiRoutes():

  • The generated docs route closure is migrated to function (): Quantum\Http\Response
  • But if it uses $response->html(...) without receiving/initializing $response, generated code fails at runtime (Undefined variable $response)

Expected behavior

Generated openapi routes should fully comply with the new response contract and return concrete Response objects without undefined variables.

Proposed fix

Update generated route snippets to use helpers that return response instances explicitly:

  • return response()->html(...)
  • return response()->json(...)

Acceptance criteria

  • install:openapi generated docs and spec closures both return Quantum\Http\Response
  • No undefined variable usage in generated routes
  • Generated module routes work under strict response-return middleware/route pipeline

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No fields configured for Bug.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions