impossible to check if dataset exists without parsing message string of the response
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- api, backend-api-design
Research direction
Start by comparing the v3 and v4 GET /Datasets/{pid} responses with the documented dataset and invalid-endpoint cases. Define a stable way for clients to distinguish a missing dataset from another 404 without parsing a version-dependent message, then verify that behavior across the cited API versions and examples.
Written by the indexing model from the issue text.
Description
Summary
In the loopback implementation of scicat there were endpoint /exists to check if dataset exists.
After switching to nestjs it was recommended to use /datasets/{pid} so when dataset does not exist it returns 200 with empty content. However, in the resent implementation the REST API behaviour unfortunately was changed and after implementing https://github.com/SciCatProject/scicat-backend-next/issues/553 (similarly https://github.com/SciCatProject/scicat-backend-next/issues/842) it returns 404 with same content message.
That causes troubles for client to check which is the case if dataset does not exist or if other 404 error has been sent (e.g. wrong endpoint string). The only possible way is to parse response message which can easily change in the future e.g. v3 message is different then v4.
Steps to Reproduce
To reproduce the issue e.g in scicat 4.16.0
import requests
# v3
r = requests.get(
url="http://localhost:3000/api/v3/Datasets/1111111",
)
print(r.content)
#
# b'{"message":"dataset: 111111111 not found","error":"Not Found","statusCode":404}'
#
# v4
r = requests.get(
url="http://localhost:3000/api/v4/Datasets/1111111",
)
print(r.content)
#
# b'{"message":"dataset: null not found","error":"Not Found","statusCode":404}'
#
#endpoint is wrong
r = requests.get(
url="http://localhost:3000/api/v4/Dataset/1111111",
)
print(r.content)
#
# b'{"message":"Cannot GET /api/v3/dataset/111111111?access_token=eyJ6g","error":"Not Found","statusCode":404}
#
Expected behavior
I would expect that to check is dataset exists you don't have to parse a message string which changing from version to version.
I would expect that REST API don't know change in the same version API (it was done between 4.5.0 and 4.16.0 in v3)
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 37
- Avg merge
- 17h 32m
- Merged PRs (30d)
- 38
Contributor guide
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 SciCatProject/backend
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
SciCatProject/backend#1998 ·
-
SciCatProject/backend#2961 · 1 reaction · 5 assignees ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
SciCatProject/backend#2923 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
SciCatProject/backend#2901 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
SciCatProject/backend#2900 ·
All issues in SciCatProject/backend
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·