Skip to content

Commit dcace33

Browse files
committed
Add some examples for the smaller features, fix markdown
1 parent ffb4bbb commit dcace33

File tree

1 file changed

+86
-12
lines changed

1 file changed

+86
-12
lines changed

draft-release-notes.md

Lines changed: 86 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ A summary of the biggest changes.
2727
- Additional top-level field `$self` is added to allow users to define the base URI of the document, used to resolve relative references.
2828
If no `$self` field is defined, then the retrieval URI is used - just as it was in previous versions of OpenAPI.
2929
- Other URL/URI handling does not change between 3.1 and 3.2 (but bears a recap in case you're wondering how it all goes together):
30-
- Other URLs, such as to external documentation or a license, are resolved against the base URI.
31-
- Relative links inside `description` fields are resolved relative to their rendered context, such as your published API documentation page.
32-
- API endpoints are resolved against the URL in the Server Object, which itself might be relative and resolved against the base URI.
30+
- Other URLs, such as to external documentation or a license, are resolved against the base URI.
31+
- Relative links inside `description` fields are resolved relative to their rendered context, such as your published API documentation page.
32+
- API endpoints are resolved against the URL in the Server Object, which itself might be relative and resolved against the base URI.
3333

3434
### Data modeling and representation
3535

@@ -79,39 +79,113 @@ OpenAPI specification v3.2 brings consistent, modular, and extensible media type
7979

8080
### Additional features
8181

82-
That's not all! Here are the rest of the changes for this release.
82+
That's not all! Here are the rest of the changes for this release, each one is small but mighty!
8383

8484
#### Updated security schemes
8585

86-
- Support for OAuth2 Device Authorization flow with additional `deviceAuthorization` field in the `flows` object and for the individual flow, a new field `deviceAuthorizationUrl` alongside `tokenUrl`.
87-
- Additional security scheme field: `oauth2MetadataUrl` URL for auth server metadata.
86+
- Support for [OAuth2 Device Authorization flow](https://datatracker.ietf.org/doc/html/rfc8628) with additional `deviceAuthorization` field in the `flows` object and for the individual flow, a new field `deviceAuthorizationUrl` alongside `tokenUrl`. This flow is designed for devices that have limited inputs such as TVs, printers, and kiosks.
87+
- Additional security scheme field: `oauth2MetadataUrl` URL for auth server metadata, as described by the [OAuth2 Server Metadata Standard](https://datatracker.ietf.org/doc/html/rfc8414).
8888
- Additional `deprecated` field for security schemes (indicating that the scheme may still be supported, but that it should not be used).
8989
- Ability to reference a security scheme by URI rather than needing it declared in components.
9090

91+
```yaml
92+
components:
93+
securitySchemes:
94+
cakeStoreOAuth:
95+
type: oauth2
96+
description: OAuth2 security for Cake Store API
97+
flows:
98+
deviceAuthorization:
99+
deviceAuthorizationUrl: https://auth.cakestore.com/oauth/device/authorize
100+
tokenUrl: https://auth.cakestore.com/oauth/token
101+
scopes:
102+
read:cakes: Read access to cake catalog
103+
write:orders: Place cake orders from your device
104+
device:monitor: Monitor cake order status
105+
106+
```
107+
91108
#### Servers
92109

93110
- Clarify that server URLs should not include fragment or query.
94111
- Support new `name` field alongside `description`, `url` and `variables`.
95-
- Formal path templating support for variable substitution in server urls, alongside guidance that each variable can only be used once in a URL.
112+
- Formal ABNF syntax for the allowed variable substitution in server urls, alongside guidance that each variable can only be used once in a URL.
113+
114+
Use the name field to refer to servers easily:
115+
116+
```yaml
117+
servers:
118+
- name: Production
119+
url: https://api.cakestore.com/v1
120+
description: Production server for live cake orders
121+
- name: Staging
122+
url: https://staging-api.cakestore.com/v1
123+
description: Staging environment for testing new cake recipes and features
124+
- name: Local
125+
url: http://localhost:3000/v1
126+
description: Local development server running on your machine
127+
```
96128
97129
#### Better polymorphic support
98130
131+
Discriminator is a great way to match the correct schema to a payload. This release gives more robustness by adding support for a default type so that unknown objects can be handled safely.
132+
99133
- The discriminator `propertyName` can now be an optional field.
100-
- Additional `defaultMapping` field to indicate which schema to use if the `propertyName` is not set, or if the value is unrecognized.
134+
- New field `defaultMapping` to indicate which schema to use if the `propertyName` is not set, or if the value is unrecognized.
101135
- No change from previous versions: use `discriminator` to hint which entry in `anyOf` or `oneOf` is expected.
102136
- No change from previous versions: use `mapping` to link the discriminator property value to the Schema name if they aren't an exact match.
103137
- Implementations now SHOULD (rather than MAY) support templates/generics using `$dynamicRef`.
104138

105-
#### Path templating
106-
107-
**ABNF** (Augmented Backus–Naur Form) formalised for path templating, server variables, and runtime expressions in the Links object.
139+
Define the `mapping` and `discriminator` as before. The new field `defaultMapping` will be used if either the discriminator doesn't have a `propertyName` or when there is an object that doesn't match a `mapping` entry.
140+
141+
```yaml
142+
schemas:
143+
Cake:
144+
type: object
145+
discriminator:
146+
propertyName: cakeType
147+
defaultMapping: sponge
148+
mapping:
149+
sponge: '#/components/schemas/SpongeCake'
150+
chocolate: '#/components/schemas/ChocolateCake'
151+
fruit: '#/components/schemas/FruitCake'
152+
properties:
153+
cakeType:
154+
type: string
155+
enum: [sponge, chocolate, fruit]
156+
name:
157+
type: string
158+
```
159+
160+
#### Templates with formal syntax
161+
162+
The specification now includes **ABNF** (Augmented Backus–Naur Form) for path templating, server variables, and runtime expressions in the Links object.
163+
This sounds terribly formal but it means that there is a clear syntax for what is supported in each of those locations, that existing tooling can understand.
164+
165+
Next time you're wondering if you can do `/api/v{version}/users/{user-id}` in a path template, it'll be easy to check (spoiler: yes you can).
108166

109167
#### Flexible response metadata fields
110168

111169
- `description` field for responses are now optional (they used to be required but they could be empty).
112170
- Additional `summary` field for responses, useful when displaying responses in a list context.
113171

114-
#### Minor edits that are worth a mention
172+
```yaml
173+
/cakes:
174+
get:
175+
summary: List cakes
176+
responses:
177+
'200':
178+
summary: Cake list
179+
description: A list of cakes (this field is no longer required)
180+
content:
181+
application/json:
182+
schema:
183+
type: array
184+
items:
185+
type: string
186+
```
187+
188+
#### Minor updates that are worth a mention
115189

116190
- Streamlined to YAML examples (unless something specific to another format) to try to make it easier to follow.
117191
- Non-Schema examples no longer "override" Schema examples; tools are free to use the most appropriate example for any given use case.

0 commit comments

Comments
 (0)