graphiti-api / graphiti

Stylish Graph APIs
https://www.graphiti.dev/
MIT License
960 stars 138 forks source link

Makes singleton resources finding with an id work #447

Closed doublevoid closed 3 months ago

doublevoid commented 1 year ago

Creating a resource, setting a primary endpoint, and then using ResourceName.find({id: id}) doesn't work if the controller is set up as a show action. You get ResourceName cannot be called directly from endpoint /api/v1/resource#show!

This is why. A workaround is to either go with self.validate_endpoints = false or change the action to be an index action, which bypasses the stripping of a would-be id.

This PR changes the behavior to only strip the id from path if the id is actually in path!

github-actions[bot] commented 3 months ago

:tada: This PR is included in version 1.5.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket: