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 +```