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

feat: AIP-143 – Standardized codes #24

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

feat: AIP-143 – Standardized codes #24

wants to merge 3 commits into from

Conversation

lukesneeringer
Copy link
Contributor

No description provided.

@lukesneeringer lukesneeringer requested a review from a team as a code owner February 2, 2021 18:39
Base automatically changed from master to main February 10, 2021 22:08
## Guidance

For concepts where a standardized code exists and is in common use, fields
representing these concepts **should** use the standardized code for both input
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • @Alfus The important part here is that the string itself is the immutable, canonical code, and is used on the wire format. You do not need to create a separate enum, and if you do, then you fall out of synchronization quickly.
    • @hudlow What this does bring to mind is that we validate that enums are lower snake strings. But this guidance correctly says, do not bastardize canonical codes into lower snake.
    • @lukesneeringer It sounds like the IBM linter needs an exception here, allowing industry standard formats.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@hudlow Perhaps a specific note about not bastardizing strings into a company's string enum format.


- Fields representing standardized concepts **must** use the appropriate data
type for the standard code (usually `string`).
- Fields representing standardized concepts **should not** use enums, even if
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe distinguish the OpenAPI "choices" concept here.

case-insensitive unless this would introduce ambiguity (for example, accept
both `en-gb` and `en-GB`). When providing values to users, APIs **should**
use the canonical case (in the example above, `en-GB`).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe add a quick section about defaults, saying that defaults are permissible, and the sentinel value must be empty.

@google-cla google-cla bot added the cla: yes label May 18, 2021
Copy link

@mkistler mkistler left a comment

Choose a reason for hiding this comment

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

Looks good! 👍

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

Successfully merging this pull request may close these issues.

2 participants