-
Notifications
You must be signed in to change notification settings - Fork 56
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
tools/importer-rest-api-specs
: support for pulling the Display Name for an Integer Constant if defined
#3611
tools/importer-rest-api-specs
: support for pulling the Display Name for an Integer Constant if defined
#3611
Conversation
… for an Integer Constant if defined This commit fixes #3010 by checking for a Display Name within the `x-ms-enum` block and pulling from that if a (Display) Name is defined for an Integer constant. Whilst I considered doing this for Float and String constants too, I've intentionally omitted those since Float constants are rare (so we can apply this same fix if needed down the line) - and for String constants there's little benefit to changing at this point, since we normalize a key from the value for the constant. Ultimately this should ensure that when we import the constant `EmailChannelAuthMethod` for `BotService` that we output this as: > `Password`: `0` > `Graph`: `1` Which is far more descriptive than: > `0`: `0` > `1`: `1`
Breaking ChangesNo Breaking Changes were found 👍 |
Summary of ChangesNo Breaking or Non-Breaking Changes were found 👍 |
New Resource ID Segments containing Static IdentifiersNo new Resource ID Segments containing Static Identifiers were identified in the set of changes 🤙. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a minor comment
items := v.([]interface{}) | ||
displayNameOverrides := make(map[interface{}]string) | ||
for _, itemRaw := range items { | ||
item := itemRaw.(map[string]interface{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to check that this isn't nil or is it fine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The extension is defined in this manner, and everything we're importing matches it - so I think this is fine as-is for now. If this is an issue we can fix it at that point, but that's likely going to be bad data - so would want resolving upstream anyway - as such this is fine 👍
This commit fixes #3010 by checking for a Display Name within the
x-ms-enum
block and pulling from that if a (Display) Name is defined for an Integer constant.Whilst I considered doing this for Float and String constants too, I've intentionally omitted those since Float constants are rare (so we can apply this same fix if needed down the line) - and for String constants there's little benefit to changing at this point, since we normalize a key from the value for the constant.
Ultimately this should ensure that when we import the constant
EmailChannelAuthMethod
forBotService
that we output this as:Which is far more descriptive than:
There's a couple of changes to the existing data, but it's nothing major: