-
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Should Enums be usable as Types? e.g.:
parameters:
- name: loc
type: [ Location ]
description: The location to check.instead of using int and linking to the enum in the description:
parameters:
- name: loc
type: [ int ]
description: The [Location](/api/enums/Location) to check.This means the signature of Card.IsLocation in the site would be displayed as Card.IsLocation(Card c, Location loc) instead of Card.IsLocation(Card c, int loc).
Pros:
- The allowed values are formalized and summarized nicely. Can also help static analyzers narrow down erroneous values.
- No need to redundantly link to the enum in the description, especially if the enum's name gets mentioned more than once. (Related: shorthand for linking to api entries)
Cons:
- Could confuse people expecting an "enum" to represent all allowed values when used as a type. For example, in the case of the Location enum, you could actually pass a combination of
LOCATION_constants, e.g. LOCATION_MZONE|LOCATION_SZONE.
feeshstick
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request