Skip to content

Commit cfc2fda

Browse files
committed
Discriminator name should be 'kind'
1 parent 6bf55a7 commit cfc2fda

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

azure/Guidelines.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -509,9 +509,9 @@ This indicates to client libraries and customers that values of the enumeration
509509
If you can't avoid them, then follow the guideline below.
510510

511511
<a name="json-use-discriminator-for-polymorphism"></a>
512-
:white_check_mark: **DO** define a `kind` field indicating the kind of the resource and include any kind-specific fields in the body.
512+
:white_check_mark: **DO** define a discriminator field indicating the kind of the resource and include any kind-specific fields in the body.
513513

514-
Below is an example of JSON for a Rectangle and Circle:
514+
Below is an example of JSON for a Rectangle and Circle with a discriminator field named `kind`:
515515
**Rectangle**
516516
```json
517517
{
@@ -546,11 +546,13 @@ Below is an example of JSON for a Rectangle and Circle:
546546
```
547547
Both Rectangle and Circle have common fields: `kind`, `fillColor`, `lineColor`, and `subscription`. A Rectangle also has `x`, `y`, `width`, and `length` while a Circle has `x`, `y`, and `radius`. The `subscription` is a nested polymorphic type. A `free` subscription has no additional fields and a `paid` subscription has `expiration` and `invoice` fields.
548548

549+
The [Azure Naming Guidelines](./ConsiderationsForServiceDesign.md#common-names) recommend that the discriminator field be named `kind`.
550+
549551
<a name="json-polymorphism-kind-extensible"></a>
550-
:ballot_box_with_check: **YOU SHOULD** define the kind field of a polymorphic type to be an extensible enum.
552+
:ballot_box_with_check: **YOU SHOULD** define the discriminator field of a polymorphic type to be an extensible enum.
551553

552554
<a name="json-polymorphism-kind-immutable"></a>
553-
:warning: **YOU SHOULD NOT** allow an update (patch) to change the kind field of a polymorphic type.
555+
:warning: **YOU SHOULD NOT** allow an update (patch) to change the discriminator field of a polymorphic type.
554556

555557
<a name="json-polymorphism-versioning"></a>
556558
:warning: **YOU SHOULD NOT** return properties of a polymorphic type that are not defined for the api-version specified in the request.

0 commit comments

Comments
 (0)