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

Mark Fields as Unlimited Using '-1' Instead of Null #52

Open
1 task done
ericwang401 opened this issue Nov 11, 2023 · 0 comments
Open
1 task done

Mark Fields as Unlimited Using '-1' Instead of Null #52

ericwang401 opened this issue Nov 11, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@ericwang401
Copy link
Collaborator

Is there an existing feature request for this?

  • I have searched the existing issues before opening this feature request.

Describe the feature you would like to see.

In the admin area for servers, administrators can give a server unlimited bandwidth by omitting any value (essentially null) from the bandwidth allocation field. This is a little tricky to implement internally as null is a very ambiguous value-can indicate that the request simply does not want to modify the bandwidth field.

It can also be extremely confusing if it is an optional field in an API request as null can mean if its optional or if its marked as unlimited, and this is virtually impossible to differentiate as a type in Typescript. For example, determine whether the type below indicates whether the admin wants the field to stay untouched or mark it as unlimited. (Don't say just use undefined because you should refrain from using undefined as much as possible).

type BandwidthAllocationParam = number | null | undefined

Describe the solution you'd like.

Instead of using null as an indicator for no limitation on a resource, it should be switched to -1 as it's a defined value and clearly indicates that a field is unlimited (because you cannot allocate negative resources).

Additional context to this request.

No response

@ericwang401 ericwang401 added the enhancement New feature or request label Nov 11, 2023
@ericwang401 ericwang401 changed the title Mark Fields as Unlimited Using '-1' intead of null Mark Fields as Unlimited Using '-1' Instead of Null Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant