-
-
Notifications
You must be signed in to change notification settings - Fork 130
Closed
Description
API Platform version(s) affected: 2.6.6
Description
A GET collection operation (not item operation as specified in error) is required to generate Typescript interfaces. If it's missing, this error occurs:
Error: Unable to find the URL for "https://localhost:9000/docs.jsonld#Entrypoint/entity", make sure your api resource has at least one GET item operation declared.
Why is this operation required ?
How to reproduce
Create an Api Resource without a GET collection operation and run this command:
NODE_TLS_REJECT_UNAUTHORIZED=0 npx @api-platform/client-generator --generator typescript https://localhost:9000/ src/
Workaround
Make the operation accessible to administrators using a security_access:
#[ApiResource(
collectionOperations: [
// this collection operation is required to generate Typescript Interfaces
'get' => ["security" => "is_granted('ROLE_ADMIN')"]
]
...
4rthem, nicotec and broncha
Metadata
Metadata
Assignees
Labels
No labels