-
Notifications
You must be signed in to change notification settings - Fork 13
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
✨ Implement DELETE /users/me/diagnosis_keys #134
Conversation
@IsArray() | ||
@ValidateNested({ each: true }) | ||
@Type(() => RandomIDDto) | ||
randomIDs: RandomIDDto[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shogo-mitomo How about making this a simple string
array instead of this JSON Array
? 🤔
randomIDs: string[]
This way the payload would be simple, instead of asking the client to add some string value
to the randomId
key as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yashmurty
Thanks!
I thought about that too, but the app team also said it was OK in this form, and since they've already implemented it for organizational users, I think it's OK as is now.
How do you think? 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shogo-mitomo
Yes, I remember the discussion.
I think if we have time constraints from app team, then it's okay to keep the already implemented style.
My only concern was that since we will make the repo as public, people might question this style/decision. (it's a small thing though, no big deal) 🤔
So I just wanted to ask you if we should change it. 🙇
Ultimately I think it's your decision. 🙏
@DaisukeHirata do you also have any comments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yashmurty @shogo-mitomo
I understand your concern. but I think it's okay as it is.
pro is we can easily add other items such as date if necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
anyway I think we can leave this as it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, no worries then! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From another perspective, I think there's also the idea of the consistency of response formats.
I personally don't prefer (just my personal preference) the format like one node is an object[] and another node is a string[]. It's tempting to want to unify it across applications. 😇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shogo-mitomo Sorry I couldn't understand this comment completely, could you add some example on what you're trying to express? 😇
Do we already have some inconsistent response formats in our APIs?
As a general rule I think for REST
APIs:
- List endpoints return
[]
- Get by ID endpoints return object
{}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List endpoints return []
Get by ID endpoints return object {}
This is not a problem at all!
I mean, for example,
curl -X GET https://api.com/foos
# => [{
# "id": 1,
# "tags": [{
# "id": 5,
# "name": "tag5"
# }, {
# "id": 6,
# "name": "tag6"
# }]
# }]
curl -X GET https://api.com/bars
# => [{
# "id": 1,
# "tags": ["tag1", "tag2"]
# }]
I think this kind of API design tends to confuse both front-end and back-end developers.
"Is this array a value or an object?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
Thanks for the clarification! 🙇
thanks a lot 🙏 |
No description provided.