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

Use UUID format for query params with _id suffix #207

Open
mrded opened this issue Mar 17, 2022 · 3 comments
Open

Use UUID format for query params with _id suffix #207

mrded opened this issue Mar 17, 2022 · 3 comments

Comments

@mrded
Copy link
Contributor

mrded commented Mar 17, 2022

I think we need a linter to ensure query params with ids:

  • Use UUID format for query params with _id suffix
  • Use _id suffix for UUID formatted query params

eg: /example?foo_id=f5d14962-7b36-44e9-972d-9a764a9c2a3f

@cmars
Copy link
Contributor

cmars commented Mar 17, 2022

This seems reasonable.. my only reservation is whether there is a case where something might be called an ID, but it's not a UUID?

@cmars
Copy link
Contributor

cmars commented Mar 19, 2022

Thinking about this some more:

Use _id suffix for UUID formatted query params

Some values that are UUIDs might not be identifiers for anything. A UUID could be used for a nonce, for example.

Use UUID format for query params with _id suffix

I'm not sure that all IDs are always going to be UUIDs. We might have an _id that is truly an identifier, but it cannot be a UUID because it references an entity in an external system or process, and that system or process does not use UUIDs. Issues might not use UUIDs for public identifiers, from past discussions.

The counter-examples I point out are probably not in the majority of cases, but we can't be a source of friction in API development either. I would be OK with this as long as it is very easy for us to add exceptions on a case-by-case basis -- kind of like how we do with the tenancy.

Could we make those exceptions even clearer and more readable?

@cmars
Copy link
Contributor

cmars commented Apr 7, 2022

This is the sort of thing we'd like to warn about, or allow nuance to easily develop here.

Maybe the upcoming DSL will make us more confident to introduce this rule, if it is easy to refine it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants