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

[AppConfig] Type mismatch for ConfigurationSettingId.label #27607

Closed
2 of 6 tasks
Eskibear opened this issue Oct 31, 2023 · 5 comments
Closed
2 of 6 tasks

[AppConfig] Type mismatch for ConfigurationSettingId.label #27607

Eskibear opened this issue Oct 31, 2023 · 5 comments
Assignees
Labels
App Configuration Azure.ApplicationModel.Configuration Client This issue points to a problem in the data-plane of the library.

Comments

@Eskibear
Copy link
Member

  • Package Name: @azure/app-configuration
  • Package Version: 1.4.1
  • Operating system: Any
  • nodejs
    • version: 18.x
  • browser
    • name/version:
  • typescript
    • version:
  • Is the bug related to documentation in

Describe the bug
In response, if a setting has no label, value of the label field is null. However in the type definition, the it's string or undefined.

To Reproduce
Steps to reproduce the behavior:

  1. create a configuration setting with no label in portal.
  2. use client to get the setting, observe the response

Expected behavior
If the value can be null, the type defintion of ConfigurationSettingId.label should explicitly allow null, be like label?: string | null.

Screenshots
image

Additional context

/**
* The label for this setting. Leaving this undefined means this
* setting does not have a label.
*/
label?: string;

Type ConfigurationSettingResponse extends ConfigurationSetting, extends ConfigurationSettingParam, finally extends ConfigurationSettingId...

@github-actions github-actions bot added App Configuration Azure.ApplicationModel.Configuration Client This issue points to a problem in the data-plane of the library. needs-team-triage Workflow: This issue needs the team to triage. labels Oct 31, 2023
@jeremymeng jeremymeng removed the needs-team-triage Workflow: This issue needs the team to triage. label Oct 31, 2023
@minhanh-phan
Copy link
Member

@Eskibear Thank you for reporting the issue. I agree that this is inconsistent type for label. Instead of updating the type of label to string | null | undefined because it will be redundant to have both null and undefined, we'll make changes to the response output. The response with label: null output will be label: undefined. So the type of label will not be changed, but the response output will, and we'll publish the mentioned fix soon. cc/ @HarshaNalluru

@Eskibear
Copy link
Member Author

Eskibear commented Nov 2, 2023

@minhanh-phan Thank you for the quick response!

I agree that we keep string | undefined and don't introduce a null to eliminate confusion, just as described in tslint rule 'no-null-keyword'.

My little concern is whether the change breaks user code. It would work if they loosely check it like if (setting.label), but it might break if there's strict check like if(setting.lable === null) in user code. But anyway, it will change something and I am glad to have the fix you mentioned, which eliminates the inconsistency.

cc/ @zhenlan @juniwang @avanigupta

@minhanh-phan
Copy link
Member

@Eskibear Thank you for raising up that point. That is a valid concern that we share. At the same time, based on app configuration public API, the value returned for label properties shouldn't be null, so the clients shouldn't depend on this behavior. We also suspect if there would be any customers that do a strict check for null. In this case, we're fixing a bug to make sure our implementation matches out API contract.

@minhanh-phan
Copy link
Member

We have released @azure/app-configuration 1.5.0 with the fix. Please give it a try and let us know if the issue has been resolved. Thank you for raising the issue!

@Eskibear
Copy link
Member Author

it works as expected.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
App Configuration Azure.ApplicationModel.Configuration Client This issue points to a problem in the data-plane of the library.
Projects
None yet
Development

No branches or pull requests

3 participants