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

Constants: pulling the display name from x-ms-enum #3010

Closed
tombuildsstuff opened this issue Sep 4, 2023 · 0 comments · Fixed by #3611
Closed

Constants: pulling the display name from x-ms-enum #3010

tombuildsstuff opened this issue Sep 4, 2023 · 0 comments · Fixed by #3611
Assignees
Labels
data/swagger-issue An issue related to the Swagger/OpenAPI Definitions tool/importer-rest-api-specs Swagger Data Importer issues

Comments

@tombuildsstuff
Copy link
Contributor

Some Swaggers define a display name for integer (and potentially float) constants - as such we should look to use this for these two constant types:

https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/botservice/resource-manager/Microsoft.BotService/stable/2022-09-15/botservice.json#L2187-L2210

Note: we shouldn't do this for string constants, since the string value will be a good enough identifier

@tombuildsstuff tombuildsstuff added tool/importer-rest-api-specs Swagger Data Importer issues data/swagger-issue An issue related to the Swagger/OpenAPI Definitions labels Sep 4, 2023
@tombuildsstuff tombuildsstuff self-assigned this Jan 11, 2024
tombuildsstuff added a commit that referenced this issue Jan 11, 2024
… 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`
tombuildsstuff added a commit that referenced this issue Jan 11, 2024
… 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`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data/swagger-issue An issue related to the Swagger/OpenAPI Definitions tool/importer-rest-api-specs Swagger Data Importer issues
Projects
None yet
1 participant