Skip to content

Commit e0e0448

Browse files
committed
docs: adds change about annotations
Signed-off-by: Vincent Biret <[email protected]>
1 parent 14c04d2 commit e0e0448

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/upgrade-guide-2.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,19 @@ schema.AnyOf = [];
250250
// now a List<OpenApiSchema> instead of IList<OpenApiSchema>
251251
```
252252

253+
### Ephemeral object properties are now in Metadata
254+
255+
In version 1.X applications could add ephemeral properties to some of the models from the libraries. These properties would be carried along in an "Annotations" property, but not serialized. This is especially helpful when building integrations that build document in multiple phases and need additional context to complete the work. The property is now named metadata to avoid any confusion with other terms. The parent interface has also been renamed from `IOpenApiAnnotatable` to `IMetadataContainer`.
256+
257+
```csharp
258+
var schema = new OpenApiSchema();
259+
260+
// 1.X
261+
var info = schema.Annotations["foo"];
262+
// 2.X
263+
var info = schema.Metadata["foo"];
264+
```
265+
253266
### Updates to OpenApiSchema
254267

255268
The OpenAPI 3.1 specification changes significantly how it leverages JSON Schema. In 3.0 and earlier, OpenAPI used a "subset, superset" of JSON Schema draft-4. This caused many problems for developers trying to use JSON Schema validation libraries with the JSON Schema in their OpenAPI descriptions. In OpenAPI 3.1, the 2020-12 draft version of JSON Schema was adopted and a new JSON Schema vocabulary was adopted to support OpenAPI specific keywords. All attempts to constrain what JSON Schema keywords could be used in OpenAPI were removed.

0 commit comments

Comments
 (0)