Closed ekergreis closed 5 months ago
I have this error too. Using api-platform/core 3.1.22 is working, but if upgrading to api-platform/core 3.2, I get the error.
When on api-platform/core 3.1.22 and the admin is calling /api, I get this returned: { "@context": "\/api\/contexts\/Entrypoint", "@id": "\/api", "@type": "Entrypoint", "accPostings": "\/api\/acc_postings", "accSales": "\/api\/acc_sales", "basket": "\/api\/baskets", "basketItem": "\/api\/basket_items", "florainfo": "\/api\/florainfos", "florainfoBarcodes": "\/api\/florainfo_barcodes", "florainfoImageQueue": "\/api\/florainfo_image_queues", "florainfoProperties": "\/api\/florainfo_properties", "inventory": "\/api\/inventories", "inventoryGroups": "\/api\/inventory_groups", "inventoryLabel": "\/api\/inventory_labels", "labelTypes": "\/api\/labeltypes", "plantGroups": "\/api\/plant_groups", "plantImages": "\/api\/plant_images\/extended", "plantOwners": "\/api\/plant_owners", "planter": "\/api\/planters", "priceGroups": "\/api\/price_groups", "printLabels": "\/api\/print_labels", "role": "\/api\/allroles", "roles": "\/api\/roles", "rootTypes": "\/api\/root_types", "sizes": "\/api\/sizes", "statistics": "\/api\/statistics", "sumUpPayout": "\/api\/sum_up_payouts", "sumUpTransaction": "\/api\/sum_up_transactions", "textLabel": "\/api\/text_labels", "userRole": "\/api\/user_roles", "users": "\/api\/users" }
But, on version 3.2.6 I get:
{ "resourceNameCollection": [ "ApiPlatform\State\ApiResource\Error", "ApiPlatform\Symfony\Validator\Exception\ValidationException", "App\Entity\AccPostings", "App\Entity\AccSales", "App\Entity\Basket", "App\Entity\BasketItem", "App\Entity\Florainfo", "App\Entity\FlorainfoBarcodes", "App\Entity\FlorainfoImageQueue", "App\Entity\FlorainfoProperties", "App\Entity\Inventory", "App\Entity\InventoryGroups", "App\Entity\InventoryLabel", "App\Entity\LabelTypes", "App\Entity\PlantGroups", "App\Entity\PlantImages", "App\Entity\PlantOwners", "App\Entity\Planter", "App\Entity\PriceGroups", "App\Entity\PrintLabels", "App\Entity\Role", "App\Entity\Roles", "App\Entity\RootTypes", "App\Entity\Sizes", "App\Entity\Statistics", "App\Entity\SumUpPayout", "App\Entity\SumUpTransaction", "App\Entity\TextLabel", "App\Entity\UserRole", "App\Entity\Users" ] }
Clearly, the response is different, but why? Is it an error on my end/my implementation of something? If so, how do I find out what?
Thanks By reverting to API Platform 3.1.22, my Api Platform Admin application is working again without errors.
Call to / with API Platform 3.1.22:
Call to / with API Platform 3.2.4:
It would indeed be interesting to understand the cause of this change ?
It somehow has to do with the enabled formats for the api-platform resources. I do not know what exactly, but in 3.1, the returned data is in application/ld+json, where as in 3.2, it is application/json
I re-ran the recipe for api-platform/core. This added a section to my api-platform config file, with this:
'docs_formats' => [
'jsonld' => ['application/ld+json'],
'html' => ['text/html'],
'jsonopenapi' => ['application/vnd.openapi+json'],
],
This fixed this error for me. And I found that if not the jsonld format was the first, the error would still be there.
So, I think that the dataprovider used by the admin, needs the api-docs, and that they come in jsonld format. And when it is not specified in the call to get them which format you want, api-platform/core will use the first available format. And somehow, from 3.2, the first one when using default values, is no longer jsonld.
Thank you. It's OK with Api Platform 3.2.6 by adding the following configuration to the config/package/api_platform.yaml file :
api_platform:
docs_formats:
jsonld: ['application/ld+json']
html: ['text/html']
jsonopenapi: ['application/vnd.openapi+json']
The JSON-LD format doesn't seem to be the default for API documentation anymore but it's required by HydraAdmin component
Hello,
I have developed an back-end application with Symfony 6.3 and Api Platform 3.2.4, and a front-end using Api Platform Admin 3.4.4. Everything was working correctly, but I had to reinstall the front-end project, and now I'm encountering an error: "Cannot fetch API documentation: status: 200."
In the browser explorer, the requests to my back-end application are successful (status code 200 with result). The Api Platform Swagger is accessible, and I have also configured CORS (with nelmio/cors-bundle).
I don't understand where this error could be coming from. Any insights would be appreciated.
Thank you.