Skip to content

Apiplatform Swagger "Call to a member function withParameters() on null" #7071

@OleeOlsen

Description

@OleeOlsen

Apiplatform 4.0.17
Symfony 7.0

I have a symfony project with apiplatform and lexi/jwt token. Now i implemented SymfonyCasts/reset-password-bundle. This works fine on the API. But the swagger from apiplatform ist broken. When i comment out the uriTemplate from Post then swagger works without my route.

I have implemented the following:https://api-platform.com/docs/core/dto/#implementing-a-write-operation-with-an-input-different-from-the-resource
The API works fine. Bue the Swagger won't work when is set uriTemplate.
What can I do?

This is my implementation:

new Post(             
name: 'reset_password',              
status: 202,              
messenger: 'input',              
input: ResetPasswordRequest::class,              
output: false,              
uriTemplate: '/user/reset_password',
)

This is the complet stacksrace:

{
  "title": "An error occurred",
  "detail": "Call to a member function withParameters() on null",
  "status": 500,
  "type": "/errors/500",
  "trace": [
    {
      "file": "/home/my/project/vendor/lexik/jwt-authentication-bundle/OpenApi/OpenApiFactory.php",
      "line": 40,
      "function": "__invoke",
      "class": "App\\OpenApi\\OpenApiFactory",
      "type": "->"
    },
    {
      "file": "/home/my/project/vendor/api-platform/core/src/OpenApi/State/OpenApiProvider.php",
      "line": 32,
      "function": "__invoke",
      "class": "Lexik\\Bundle\\JWTAuthenticationBundle\\OpenApi\\OpenApiFactory",
      "type": "->"
    },
    {
      "file": "/home/my/project/vendor/api-platform/core/src/State/CallableProvider.php",
      "line": 43,
      "function": "provide",
      "class": "ApiPlatform\\OpenApi\\State\\OpenApiProvider",
      "type": "->"
    },
    {
      "file": "/home/my/project/vendor/api-platform/core/src/State/Provider/ReadProvider.php",
      "line": 79,
      "function": "provide",
      "class": "ApiPlatform\\State\\CallableProvider",
      "type": "->"
    },
    {
      "file": "/home/my/project/vendor/api-platform/core/src/Symfony/Bundle/SwaggerUi/SwaggerUiProvider.php",
      "line": 41,
      "function": "provide",
      "class": "ApiPlatform\\State\\Provider\\ReadProvider",
      "type": "->"
    },
    {
      "file": "/home/my/project/vendor/api-platform/core/src/State/Provider/ContentNegotiationProvider.php",
      "line": 51,
      "function": "provide",
      "class": "ApiPlatform\\Symfony\\Bundle\\SwaggerUi\\SwaggerUiProvider",
      "type": "->"
    },
    {
      "file": "/home/my/project/vendor/api-platform/core/src/Symfony/Action/DocumentationAction.php",
      "line": 102,
      "function": "provide",
      "class": "ApiPlatform\\State\\Provider\\ContentNegotiationProvider",
      "type": "->"
    },
    {
      "file": "/home/my/project/vendor/api-platform/core/src/Symfony/Action/DocumentationAction.php",
      "line": 74,
      "function": "getOpenApiDocumentation",
      "class": "ApiPlatform\\Symfony\\Action\\DocumentationAction",
      "type": "->"
    },
    {
      "file": "/home/my/project/vendor/symfony/http-kernel/HttpKernel.php",
      "line": 183,
      "function": "__invoke",
      "class": "ApiPlatform\\Symfony\\Action\\DocumentationAction",
      "type": "->"
    },
    {
      "file": "/home/my/project/vendor/symfony/http-kernel/HttpKernel.php",
      "line": 76,
      "function": "handleRaw",
      "class": "Symfony\\Component\\HttpKernel\\HttpKernel",
      "type": "->"
    },
    {
      "file": "/home/my/project/vendor/symfony/http-kernel/Kernel.php",
      "line": 182,
      "function": "handle",
      "class": "Symfony\\Component\\HttpKernel\\HttpKernel",
      "type": "->"
    },
    {
      "file": "/home/my/project/vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php",
      "line": 35,
      "function": "handle",
      "class": "Symfony\\Component\\HttpKernel\\Kernel",
      "type": "->"
    },
    {
      "file": "/home/my/project/vendor/autoload_runtime.php",
      "line": 29,
      "function": "run",
      "class": "Symfony\\Component\\Runtime\\Runner\\Symfony\\HttpKernelRunner",
      "type": "->"
    },
    {
      "file": "/home/my/project/public/index.php",
      "line": 5,
      "function": "require_once"
    }
  ],
  "description": "Call to a member function withParameters() on null"
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions