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
This project provides a .NET implementation of the [OpenAPI Overlay Specification](https://spec.openapis.org/overlay/latest.html), allowing you to dynamically apply overlays (patches) to existing OpenAPI documents (v3.0+), following the official OpenAPI Overlay 1.0.0 specification.
@@ -75,13 +74,28 @@ var jsonResult = textWriter.ToString();
75
74
// or use flush async if the underlying writer is a stream writer to a file or network stream
76
75
```
77
76
77
+
## Experimental features
78
+
79
+
This library implements the following experimental features:
80
+
81
+
### Copy
82
+
83
+
The [copy proposal](https://github.com/OAI/Overlay-Specification/pull/150) to the Overlay specification works similarly to the update action, except it sources its value from another node. This library adds a property under an experimental flag, serializes and deserializes the value, and applies a copy overlay to an OpenAPI document.
84
+
85
+
```json
86
+
{
87
+
"target": "$.info.title",
88
+
"description": "Copy description to title",
89
+
"x-copy": "$.info.description"
90
+
}
91
+
```
92
+
78
93
## Release notes
79
94
80
95
The OpenAPI Overlay Libraries releases notes are available from the [CHANGELOG](CHANGELOG.md)
81
96
82
97
## Debugging
83
98
84
-
85
99
## Contributing
86
100
87
101
This project welcomes contributions and suggestions. Make sure you open an issue before sending any pull request to avoid any misunderstanding.
@@ -36,6 +37,15 @@ public class OverlayAction : IOverlaySerializable, IOverlayExtensible
36
37
/// </summary>
37
38
publicJsonNode?Update{get;set;}
38
39
40
+
/// <summary>
41
+
/// A string value that indicates that the target object or array MUST be copied to the location indicated by this string, which MUST be a JSON Pointer.
42
+
/// This field is mutually exclusive with the <see cref="Remove"/> and <see cref="Update"/> fields.
43
+
/// This field is experimental and not part of the OpenAPI Overlay specification v1.0.0.
44
+
/// This field is an implementation of <see href="https://github.com/OAI/Overlay-Specification/pull/150">the copy proposal</see>.
#pragma warning disable BOO001// Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
68
+
if(Copy!=null)
69
+
{
70
+
writer.WriteProperty("x-copy",Copy);
71
+
}
72
+
#pragma warning restore BOO001// Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
#pragma warning disable BOO001// Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
overlayDiagnostic.Errors.Add(newOpenApiError(GetPointer(index),$"The number of matches for 'target' ({parseResult.Matches.Count}) and 'x-copy' ({copyParseResult.Matches.Count}) must be the same"));
#pragma warning restore BOO001// Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
Copy file name to clipboardExpand all lines: src/lib/Reader/V1/OverlayActionDeserializer.cs
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,10 @@ internal static partial class OverlayV1Deserializer
16
16
}
17
17
}
18
18
},
19
-
{"update",(o,v)=>o.Update=v.CreateAny()}
19
+
{"update",(o,v)=>o.Update=v.CreateAny()},
20
+
#pragma warning disable BOO001// Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
21
+
{"x-copy",(o,v)=>o.Copy=v.GetScalarValue()},
22
+
#pragma warning restore BOO001// Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
0 commit comments