symfonyapi-platform.com

API Platform with Symfony won't show my resource entity


I am currently coding along the SymfonyCasts tutorial for API Platform. https://symfonycasts.com/screencast/api-platform Right after creating my first entity in the tutorial's second chapter, the API browser application won't list my entity. So when calling the /api route in my browser, instead of the desired endpoints, I just get the "No operations defined in spec!" message.

I do not have access to the code included in the course, so I created a Symfony application from scratch. Please see the code on https://github.com/danschdev/shouts/tree/api-platform

No matter if I mark the entity as an API Platform resource directly in the entity creation dialog, or manually as described in the tutorial, the result stays the same. What might be missing? I also took a look at the api_platform.yaml file, which looks fine to me.


Solution

  • With the configuration you have maybe you should try to add line in api_platform.yaml config file :

    api_platform:
        metadata_backward_compatibility_layer: false
    

    In version 2.7 the default value is true, and if you want to use the new metadata system, it's necessary to set the metadata_backward_compatibility_layer to false

    See more details here : Upgrade guide