Skip to content

Conversation

@benkingcode
Copy link
Contributor

I noticed when I set my url.namespace to api/v1/{tenant}, if the tenant param was bound to a model the generated URLs would contain the JSON serialization, like so;

"links": {
    "self": "http:\/\/api.example.test\/api\/v1\/{\"id\":1,\"name\":\"Tenant Name\",\"created_at\":\"2020-04-20T13:57:55.000000Z\",\"updated_at\":\"2020-04-20T13:57:55.000000Z\",\"slug\":\"test-slug\"}\/products\/1"
}

With this fix, bound models correctly use the route key;

"links": {
    "self": "http:\/\/api.example.test\/api\/v1\/test-slug\/products\/1"
}

Copy link
Member

@lindyhopchris lindyhopchris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for highlighting this - it definitely needs fixing and great to see you've added a test too!

Just one change which is I have a preference for checking for interfaces where they exist.

I'm not sure why the tests are failing so I'll investigate that seperately as I believe it is unrelated to the changes you've made.

@benkingcode
Copy link
Contributor Author

Cool, made your suggested change! The tests all passed locally for me so not sure why Travis is showing a failure.

@lindyhopchris lindyhopchris merged commit 881d18e into cloudcreativity:develop Apr 22, 2020
@lindyhopchris
Copy link
Member

Thanks! Looks like a temporary failure - knowing Laravel they probably had something breaking in their releases which they've then fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants