Skip to content

Commit

Permalink
Consistent use of property name schema examples: petType vs pet_type
Browse files Browse the repository at this point in the history
* Pet Schema in the MediaTypes Examples and Schema Object Examples uses the camelCase notation(petType),
* While Pets from the Discriminator Object use snake_case (pet_type).
It's inconsistent.

I chose the camelCase notation because it's used for propertyNames by the OpenAPI specification itself.
  • Loading branch information
tfesenko committed Aug 23, 2018
1 parent ae0ce6b commit 84ba266
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions versions/3.0.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2707,15 +2707,15 @@ MyResponseType:
- $ref: '#/components/schemas/Dog'
- $ref: '#/components/schemas/Lizard'
discriminator:
propertyName: pet_type
propertyName: petType
```

The expectation now is that a property with name `pet_type` _MUST_ be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload:
The expectation now is that a property with name `petType` _MUST_ be present in the response payload, and the value will correspond to the name of a schema defined in the OAS document. Thus the response payload:

```json
{
"id": 12345,
"pet_type": "Cat"
"petType": "Cat"
}
```

Expand All @@ -2731,7 +2731,7 @@ MyResponseType:
- $ref: '#/components/schemas/Lizard'
- $ref: 'https://gigantic-server.com/schemas/Monster/schema.json'
discriminator:
propertyName: pet_type
propertyName: petType
mapping:
dog: '#/components/schemas/Dog'
monster: 'https://gigantic-server.com/schemas/Monster/schema.json'
Expand All @@ -2751,12 +2751,12 @@ components:
Pet:
type: object
required:
- pet_type
- petType
properties:
pet_type:
petType:
type: string
discriminator:
propertyName: pet_type
propertyName: petType
mapping:
dog: Dog
Cat:
Expand Down Expand Up @@ -2789,7 +2789,7 @@ a payload like this:
```json
{
"pet_type": "Cat",
"petType": "Cat",
"name": "misty"
}
```
Expand All @@ -2798,7 +2798,7 @@ will indicate that the `Cat` schema be used. Likewise this schema:

```json
{
"pet_type": "dog",
"petType": "dog",
"bark": "soft"
}
```
Expand Down

0 comments on commit 84ba266

Please sign in to comment.