From 0874f6b3c9b5e30ded81877ec4255776859b3621 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 16 Dec 2025 12:58:41 -0500 Subject: [PATCH] docs: adds a copy example for the overlay --- overlay/example-copy-schema.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 overlay/example-copy-schema.md diff --git a/overlay/example-copy-schema.md b/overlay/example-copy-schema.md new file mode 100644 index 0000000..541f58f --- /dev/null +++ b/overlay/example-copy-schema.md @@ -0,0 +1,26 @@ +--- +layout: default +parent: Overlays +nav_order: 2 +title: 'Example: copy a schema' +has_toc: false +--- + +# Example: copy a schema + +Ever needed to copy a schema so you don't need to maintain a copy which could become stale in your overlay document? This example copies the Foo component schema as a new Bar component schema. + +```yaml +overlay: 1.0.0 +info: + title: Copy a schema component + version: 1.1.0 +actions: + - target: '$.components.schemas' + description: Ensure the target schema is present + update: + Bar: {} + - target: '$.components.schemas['Bar']' + copy: '$.components.schemas['Foo']' + description: Copy the Foo Schema to Bar +```