Incorrect `links` URL
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start with the routes.rb example and the resource link generation for the person model. Reproduce the response showing /api/v3 URLs and trace how those links are assembled relative to the /v3 routes. Done means resource and relationship links omit the /api prefix while still resolving to the declared routes.
Written by the indexing model from the issue text.
Description
We need to omit the api out of the links URLs (eg: http://localhost:3001/api/v3/people). Our valid URL should look like this: http://localhost:3001/v3/people.
Here's a sample of how our routes.rb file is built:
Our routes.rb:
Rails.application.routes.draw do
scope module: :api do
namespace :v3 do
jsonapi_resources :people
jsonapi_resources :providers
end
end
end
According to the rake routes task on our person model:
v3_people GET /v3/people(.:format) api/v3/people#index
POST /v3/people(.:format) api/v3/people#create
v3_person GET /v3/people/:id(.:format) api/v3/people#show
PATCH /v3/people/:id(.:format) api/v3/people#update
PUT /v3/people/:id(.:format) api/v3/people#update
DELETE /v3/people/:id(.:format) api/v3/people#destroy
But the response output looks like this:
{
"data": {
"id": "1",
"type": "people",
"links": {
"self": "http://localhost:3001/api/v3/people/1"
},
"attributes": {
"full-name": "Chad Taylor",
"first-name": "Chad",
"last-name": "Taylor",
"uuid": "dab4e5e6-ba50-42b4-9633-50a952d2e811"
},
"relationships": {
"providers": {
"links": {
"self": "http://localhost:3001/api/v3/people/1/relationships/providers",
"related": "http://localhost:3001/api/v3/people/1/providers"
}
}
}
}
}
If we can get the /api omitted from the links, all will be golden.
Thanks in advance.
- Dominant language
- Ruby
- Stars
- 2.3k
- Forks
- 546
- PR merge metrics
- No merged PRs in 30d
Getting set up
We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JSONAPI-Resources/jsonapi-resources
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 3/5 1-2 days Newbie friendliness 50/100
JSONAPI-Resources/jsonapi-resources#1488 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
JSONAPI-Resources/jsonapi-resources#1479 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
JSONAPI-Resources/jsonapi-resources#1477 · 3 comments · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
All issues in JSONAPI-Resources/jsonapi-resources
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
TheOdinProject/curriculum#31423 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
oxidize-rb/rb-sys#807 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day