You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aspnetcore/fundamentals/openapi/customize-openapi.md
+17-3
Original file line number
Diff line number
Diff line change
@@ -42,9 +42,23 @@ Transformers can be registered onto the document by calling the <xref:Microsoft.
42
42
43
43
### Execution order for transformers
44
44
45
-
Transformers execute in first-in first-out order based on registration. In the following snippet, the document transformer has access to the modifications made by the operation transformer:
* Schema transformers are executed when a schema is registered to the document. Schema transformers are executed in the order in which they were added.
48
+
All schemas are added to the document before any operation processing occurs, so all schema transformers are executed before any operation transformers.
49
+
* Operation transformers are executed when an operation is added to the document. Operation transformers are executed in the order in which they were added.
50
+
All operations are added to the document before any document transformers are executed.
51
+
* Document transformers are executed when the document is generated. This is the final pass over the document, and all operations and schemas have been add by this point.
52
+
* When an app is configured to generate multiple OpenAPI documents, transformers are executed for each document independently.
53
+
54
+
For example, in the following snippet:
55
+
*`SchemaTransformer2` is executed and has access to the modifications made by `SchemaTransformer1`.
56
+
* Both `OperationTransformer1` and `OperationTransformer2` have access to the modifications made by both schema transformers for the types involved in the operation they are called to process.
57
+
*`OperationTransformer2` is executed after `OperationTransformer1`, so it has access to the modifications made by `OperationTransformer1`.
58
+
* Both `DocumentTransformer1` and `DocumentTransformer2` are executed after all operations and schemas have been added to the document, so they have access to all modifications made by the operation and schema transformers.
59
+
*`DocumentTransformer2` is executed after `DocumentTransformer1`, so it has access to the modifications made by `DocumentTransformer1`.
0 commit comments