Skip to content

Commit

Permalink
whitespace and quoting fixes in json and yaml examples
Browse files Browse the repository at this point in the history
  • Loading branch information
karenetheridge committed Dec 6, 2023
1 parent daeb992 commit f75f3bd
Showing 1 changed file with 68 additions and 69 deletions.
137 changes: 68 additions & 69 deletions versions/3.2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ components:
in: header
petstore_auth:
type: oauth2
flows:
flows:
implicit:
authorizationUrl: https://example.org/api/oauth/dialog
scopes:
Expand Down Expand Up @@ -696,7 +696,7 @@ The following may lead to ambiguous resolution:
"get": {
"description": "Returns all pets from the system that the user has access to",
"responses": {
"200": {
"200": {
"description": "A list of pets.",
"content": {
"application/json": {
Expand Down Expand Up @@ -836,7 +836,7 @@ parameters:
schema:
type: array
items:
type: string
type: string
style: simple
```

Expand Down Expand Up @@ -889,7 +889,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens
"schema": {
"type": "object",
"properties": {
"name": {
"name": {
"description": "Updated name of the pet",
"type": "string"
},
Expand All @@ -898,7 +898,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens
"type": "string"
}
},
"required": ["status"]
"required": ["status"]
}
}
}
Expand Down Expand Up @@ -944,11 +944,11 @@ parameters:
type: string
requestBody:
content:
'application/x-www-form-urlencoded':
application/x-www-form-urlencoded:
schema:
type: object
properties:
name:
name:
description: Updated name of the pet
type: string
status:
Expand All @@ -959,14 +959,14 @@ requestBody:
responses:
'200':
description: Pet updated.
content:
'application/json': {}
'application/xml': {}
content:
application/json: {}
application/xml: {}
'405':
description: Method Not Allowed
content:
'application/json': {}
'application/xml': {}
content:
application/json: {}
application/xml: {}
security:
- petstore_auth:
- write:pets
Expand Down Expand Up @@ -1271,36 +1271,36 @@ A request body with a referenced model definition.
"$ref": "#/components/schemas/User"
},
"examples": {
"user" : {
"summary": "User Example",
"externalValue": "https://foo.bar/examples/user-example.json"
}
"user" : {
"summary": "User Example",
"externalValue": "https://foo.bar/examples/user-example.json"
}
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/User"
},
"examples": {
"user" : {
"summary": "User example in XML",
"externalValue": "https://foo.bar/examples/user-example.xml"
}
"user" : {
"summary": "User example in XML",
"externalValue": "https://foo.bar/examples/user-example.xml"
}
}
},
"text/plain": {
"examples": {
"user" : {
"summary": "User example in Plain text",
"externalValue": "https://foo.bar/examples/user-example.txt"
"externalValue": "https://foo.bar/examples/user-example.txt"
}
}
}
},
"*/*": {
"examples": {
"user" : {
"summary": "User example in other format",
"externalValue": "https://foo.bar/examples/user-example.whatever"
"summary": "User example in other format",
"externalValue": "https://foo.bar/examples/user-example.whatever"
}
}
}
Expand All @@ -1310,29 +1310,29 @@ A request body with a referenced model definition.

```yaml
description: user to add to the system
content:
'application/json':
content:
application/json:
schema:
$ref: '#/components/schemas/User'
examples:
user:
summary: User Example
externalValue: 'https://foo.bar/examples/user-example.json'
'application/xml':
application/xml:
schema:
$ref: '#/components/schemas/User'
examples:
user:
summary: User example in XML
externalValue: 'https://foo.bar/examples/user-example.xml'
'text/plain':
text/plain:
examples:
user:
summary: User example in Plain text
externalValue: 'https://foo.bar/examples/user-example.txt'
'*/*':
examples:
user:
user:
summary: User example in other format
externalValue: 'https://foo.bar/examples/user-example.whatever'
```
Expand Down Expand Up @@ -1386,30 +1386,29 @@ This object MAY be extended with [Specification Extensions](#specificationExtens
{
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pet"
"$ref": "#/components/schemas/Pet"
},
"examples": {
"cat" : {
"summary": "An example of a cat",
"value":
{
"name": "Fluffy",
"petType": "Cat",
"color": "White",
"gender": "male",
"breed": "Persian"
}
"value": {
"name": "Fluffy",
"petType": "Cat",
"color": "White",
"gender": "male",
"breed": "Persian"
}
},
"dog": {
"summary": "An example of a dog with a cat's name",
"value" : {
"value" : {
"name": "Puma",
"petType": "Dog",
"color": "Black",
"gender": "Female",
"breed": "Mixed"
},
"frog": {
"frog": {
"$ref": "#/components/examples/frog-example"
}
}
Expand All @@ -1419,7 +1418,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens
```

```yaml
application/json:
application/json:
schema:
$ref: "#/components/schemas/Pet"
examples:
Expand Down Expand Up @@ -1458,24 +1457,24 @@ Content transferred in binary (octet-stream) MAY omit `schema`:
```yaml
# a PNG image as a binary file:
content:
image/png: {}
image/png: {}
```

```yaml
# an arbitrary binary file:
content:
application/octet-stream: {}
application/octet-stream: {}
```

Binary content transferred with base64 encoding:

```yaml
content:
image/png:
schema:
type: string
contentMediaType: image/png
contentEncoding: base64
image/png:
schema:
type: string
contentMediaType: image/png
contentEncoding: base64
```

Note that the `Content-Type` remains `image/png`, describing the semantics of the payload. The JSON Schema `type` and `contentEncoding` fields explain that the payload is transferred as text. The JSON Schema `contentMediaType` is technically redundant, but can be used by JSON Schema tools that may not be aware of the OpenAPI context.
Expand Down Expand Up @@ -1704,7 +1703,7 @@ A 200 response for a successful operation and a default response for others (imp
```yaml
'200':
description: a pet to be returned
content:
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
Expand Down Expand Up @@ -1752,9 +1751,9 @@ Response of an array of a complex type:

```yaml
description: A complex object array response
content:
content:
application/json:
schema:
schema:
type: array
items:
$ref: '#/components/schemas/VeryComplexType'
Expand Down Expand Up @@ -1890,7 +1889,7 @@ Content-Length: 187
"https://clientdomain.com/fast",
"https://clientdomain.com/medium",
"https://clientdomain.com/slow"
]
]
}
201 Created
Expand Down Expand Up @@ -1939,7 +1938,7 @@ transactionCallback:
requestBody:
description: Callback payload
content:
'application/json':
application/json:
schema:
$ref: '#/components/schemas/SomePayload'
responses:
Expand Down Expand Up @@ -1973,21 +1972,21 @@ requestBody:
'application/json':
schema:
$ref: '#/components/schemas/Address'
examples:
examples:
foo:
summary: A foo example
value: {"foo": "bar"}
bar:
summary: A bar example
value: {"bar": "baz"}
'application/xml':
examples:
application/xml:
examples:
xmlExample:
summary: This is an example in XML
externalValue: 'https://example.org/examples/address-example.xml'
'text/plain':
text/plain:
examples:
textExample:
textExample:
summary: This is a text example
externalValue: 'https://foo.bar/examples/address-example.txt'
```
Expand All @@ -1996,13 +1995,13 @@ In a parameter:

```yaml
parameters:
- name: 'zipCode'
in: 'query'
- name: zipCode
in: query
schema:
type: 'string'
format: 'zip-code'
type: string
format: zip-code
examples:
zip-example:
zip-example:
$ref: '#/components/examples/zip-example'
```

Expand All @@ -2012,7 +2011,7 @@ In a response:
responses:
'200':
description: your car appointment has been booked
content:
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
Expand Down Expand Up @@ -2060,7 +2059,7 @@ paths:
- name: id
in: path
required: true
description: the user identifier, as userId
description: the user identifier, as userId
schema:
type: string
get:
Expand Down Expand Up @@ -2088,7 +2087,7 @@ paths:
- name: userid
in: path
required: true
description: the user identifier, as userId
description: the user identifier, as userId
schema:
type: string
# linked operation
Expand Down Expand Up @@ -3337,7 +3336,7 @@ This object MAY be extended with [Specification Extensions](#specificationExtens

```yaml
type: oauth2
flows:
flows:
implicit:
authorizationUrl: https://example.com/api/oauth/dialog
scopes:
Expand All @@ -3348,7 +3347,7 @@ flows:
tokenUrl: https://example.com/api/oauth/token
scopes:
write:pets: modify pets in your account
read:pets: read your pets
read:pets: read your pets
```

#### <a name="securityRequirementObject"></a>Security Requirement Object
Expand Down

0 comments on commit f75f3bd

Please sign in to comment.