question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[constants] Brainstorm for how we should deal with a required, extensible enum of 1, with no client default

See original GitHub issue

Long title, but repeating here: what do you guys think we should do when we encounter when we have an extensible enum of 1 that is a required parameter for a function and it does not have an x-ms-client-default specified in the swagger?

My 2 cents after talking with @lmazuel (thanks for your help!): m4 should set the x-ms-client-default to the single enum value.

Potential drawbacks: the main drawback to this is that if an enum gets added (which it can get added, because it’s an extensible enum), it could be breaking. However, if they add an x-ms-client-default with the original default value to the swagger, the change would not be breaking.

Conclusion (on my and @lmazuel 's side): since it’s easy to make it not breaking, and since as a customer it’s cumbersome to have to specify a parameter that really only has one possible value, m4 should make the one possible value the parameter’s x-ms-client-default

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
daviwilcommented, Jul 28, 2020

Thanks for looking into this! Let’s discuss this issue at the AutoRest meeting today to see if we can come up with a reasonable solution.

0reactions
iscai-msftcommented, Jul 28, 2020

@daviwil sorry for the late reply, I stopped counting after ~25 examples, and I just made my way to around apimanagement, so I think there are a lot of cases that already have this.

I don’t think in this case it’s enough to catch more of these from entering the specs repo since there are so many already in existence, and I think it’s too much work to add x-ms-defaults for the existing cases.

Here’s some examples:

  1. https://github.com/Azure/azure-rest-api-specs/blob/master/specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/advisor.json#L155
  2. https://github.com/Azure/azure-rest-api-specs/blob/master/specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/preview/2019-05-05-preview/AlertsManagement.json#L1304
Read more comments on GitHub >

github_iconTop Results From Across the Web

Extensible Enums - Business Central - Microsoft Learn
The list of named constants is called the enumeration list. Enums can be used as table fields, local and global variables, and parameters....
Read more >
Extending Enums in Java - Baeldung
In this tutorial, we'll discuss extending enums in Java, including adding new constant values and new functionalities.
Read more >
Enum - Java Programming Tutorial
An enum can be used to define a set of enum constants. The constants are implicitly static final , which cannot be modified....
Read more >
How to make the most of Java enums - Oracle Blogs
Enumerations—or “enums” for short—are a restricted Java data type that lets a developer define a variable to be a set of predefined constants....
Read more >
Build Enumerations of Constants With Python's Enum
In this tutorial, you'll learn how to create and use enumerations of semantically related constants in Python. To do this, you'll use the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found