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

fix: metadata capitalization #3413

Merged
merged 7 commits into from May 16, 2024
Merged

Conversation

sicoyle
Copy link
Contributor

@sicoyle sicoyle commented May 6, 2024

Description

We currently have consumerGroup, consumerID, and consumerId metadata fields on components. I think we should remove the consumerId metadata field as the capitalization difference is confusing, and there are very few components with this capitalization, so I'm wondering if this is an oversight and is fine to be corrected. I know that we do not strive for consistency in naming just for name sake, but I do think we should strive for capitalization consistency on fields with the same name across the board.

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #[issue number]

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation / Created issue in the https://github.com/dapr/docs/ repo: dapr/docs#[issue number]

berndverst and others added 2 commits April 30, 2024 16:10
Signed-off-by: Bernd Verst <github@bernd.dev>
Signed-off-by: Samantha Coyle <sam@diagrid.io>
@sicoyle sicoyle requested review from a team as code owners May 6, 2024 15:32
@@ -97,7 +97,7 @@ metadata:
description: |
Storage container name.
example: '"myeventhubstoragecontainer"'
- name: consumerId
- name: consumerID
Copy link
Contributor

Choose a reason for hiding this comment

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

All our fields are case-insensitive. If you want to update the metadata.yaml and the docs, that's all that needs to change :)

Copy link
Member

Choose a reason for hiding this comment

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

And additionally, keep in mind that metadata.yaml is not what controls the accepted values - this is just documentation.

Our Kit/Decode Metadata function which is based on mitchellh/mapstructure uses the WeakDecode function which accepts any casing. There are several other convenience features, which is why all metadata should always be specified as struct tags and then decoded using this special function.

Also FYI, consumerID is a special metadata which actually is NOT defined in components-contrib. This is hardcoded in Dapr runtime, so you might need to verify in that repo what casing is accepted. Unlike in contrib, they don't use our metadata handling code in runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ahh, okay. Docs do reflect the changes I'm making here, so that works out great and will require no doc updates: https://docs.dapr.io/reference/components-reference/supported-pubsub/setup-azure-eventhubs/

3346.patch Outdated Show resolved Hide resolved
@@ -97,7 +97,7 @@ metadata:
description: |
Storage container name.
example: '"myeventhubstoragecontainer"'
- name: consumerId
- name: consumerID
Copy link
Member

Choose a reason for hiding this comment

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

And additionally, keep in mind that metadata.yaml is not what controls the accepted values - this is just documentation.

Our Kit/Decode Metadata function which is based on mitchellh/mapstructure uses the WeakDecode function which accepts any casing. There are several other convenience features, which is why all metadata should always be specified as struct tags and then decoded using this special function.

Also FYI, consumerID is a special metadata which actually is NOT defined in components-contrib. This is hardcoded in Dapr runtime, so you might need to verify in that repo what casing is accepted. Unlike in contrib, they don't use our metadata handling code in runtime.

yaron2 and others added 4 commits May 14, 2024 08:20
Signed-off-by: Samantha Coyle <sam@diagrid.io>
Signed-off-by: Samantha Coyle <sam@diagrid.io>
Signed-off-by: Samantha Coyle <sam@diagrid.io>
@berndverst berndverst merged commit 70fd16a into dapr:main May 16, 2024
85 of 91 checks passed
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

Successfully merging this pull request may close these issues.

None yet

4 participants