Skip to content

Commit b736b80

Browse files
authored
Merge pull request #546 from microsoft/corranrogue9/flagsenum
Clarify the naming of EnumTypes and give guidance for the use of flags enums and non-flags enums simultaneously
2 parents 165393e + 400d7ca commit b736b80

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

graph/patterns/enums.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ but it is also open for future scenarios:
100100

101101
Additionally speaking, depending on the situation, a nullable enum can very likely be avoided by adding a `none` member.
102102

103+
If used, `EnumType` names should be singular if the are non-flags enums, and the names should be plural if they are flags enums.
104+
103105
#### Flag Enums or Collection of Enums
104106

105107
In case an enum can have multiple values at the same time the tentation is to model the property as a collection of Enums:
@@ -127,3 +129,5 @@ However, [Flagged Enums](https://docs.oasis-open.org/odata/odata-csdl-xml/v4.01/
127129
With such enum, customers can select multiple values in a single field:
128130

129131
`displayMethod = tip | alert`
132+
133+
In cases where two properties want to use the same *conceptual* `EnumType`, but one property is a collection while the other is single-values, the model should define *two* separate `EnumType`s, one being a non-flags enum with a singular name and the other marked as a flags enum with its name being the plural form of the non-flags enum.

0 commit comments

Comments
 (0)