Laravel L5 Swagger "Package Unable to render this definition"

427 Views Asked by At

Upgraded from Laravel 8 to 9 and I received this message on swagger docs.

"Unable to render this definition The provided definition does not specify a valid version field".

Please indicate a valid Swagger or OpenAPI version field.

Supported version fields are swagger: "2.0" and those that match OpenAPI : 3.0.n (for example, OpenAPI : 3.0.0)."

Some suggested adding

  • openapi="3.0.0"

line but where can I add? When I add in

  • @OA\Info()

it still throws an error like

  • Unexpected field "openapi" for @OA\Info()
1

There are 1 best solutions below

2
DerManoMann On

Well, it is an invalid property on @OA\Info.

Are you sure you do not have a second annotation with that field somewhere?

It might be interesting to try run swagger-php on the command line against your codebase and see what that returns. Something like

./bin/openapi app

Also, what happens if you remove @OA\Info altogether. I would expect an error about it missing...?