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

✨ Implement DELETE /users/me/diagnosis_keys #134

Merged
merged 1 commit into from
May 15, 2020

Conversation

shogo-mitomo
Copy link
Member

No description provided.

@shogo-mitomo shogo-mitomo self-assigned this May 15, 2020
@shogo-mitomo shogo-mitomo added the enhancement New feature or request label May 15, 2020
@IsArray()
@ValidateNested({ each: true })
@Type(() => RandomIDDto)
randomIDs: RandomIDDto[]
Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

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? 🙏

Copy link
Member

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?

Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Member

Choose a reason for hiding this comment

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

Alright, no worries then! 👍

Copy link
Member Author

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. 😇

Copy link
Member

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 {}

Copy link
Member Author

Choose a reason for hiding this comment

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

@yashmurty

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?"

Copy link
Member

@yashmurty yashmurty left a 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! 🙇

@shogo-mitomo shogo-mitomo merged commit e7bfe38 into master May 15, 2020
@shogo-mitomo shogo-mitomo deleted the mitomo/delete_positive_flag branch May 15, 2020 06:29
@shogo-mitomo
Copy link
Member Author

thanks a lot 🙏

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 this pull request may close these issues.

3 participants