Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for custom resource URLs #4

Closed
judgeaxl opened this issue Mar 13, 2023 · 0 comments · Fixed by #5
Closed

Support for custom resource URLs #4

judgeaxl opened this issue Mar 13, 2023 · 0 comments · Fixed by #5
Labels
enhancement New feature or request

Comments

@judgeaxl
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Not all JSON:API servers implement resource routes using the type name as is. Most common deviation seem to be using pluralized routes and singular types, .e.g. "type": "author" vs /authors`.

For most part links are discovered through server responses, but if you want to create a new resource, or for your initial "get", there's no way at the moment to specify an alternate route.

Describe the solution you'd like

Instead I propose to add another property route to JsonApiResourceOptions which can be used to generate resource URLs where needed. If route is defined, use it for link generation, otherwise fall back to the type name as it does now.

Describe alternatives you've considered

While it might be tempting to add an optional strategy for automatic pluralization, I think it miss the point. JSON:API doesn't require routes to follow the type names, so it would only partially solve the problem.

Additional context

@dpimonov dpimonov added the enhancement New feature or request label Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants