apiVersion: core.oam.dev/v1beta1
kind: TraitDefinition
metadata:
  annotations:
    definition.oam.dev/description: "A list of StrategicMerge or JSON6902 patch to selected target"
  name: kustomize-patch
spec:
  schematic:
    cue:
      template: |
        patch: {
        	spec: {
        		patches: parameter.patches
        	}
        }
        parameter: {
        	// +usage=a list of StrategicMerge or JSON6902 patch to selected target
        	patches: [...#patchItem]
        }

        // +usage=Contains a strategicMerge or JSON6902 patch
        #patchItem: {
        	// +usage=Inline patch string, in yaml style
        	patch: string
        	// +usage=Specify the target the patch should be applied to
        	target: #selector
        }

        // +usage=Selector specifies a set of resources
        #selector: {
        	group?:              string
        	version?:            string
        	kind?:               string
        	namespace?:          string
        	name?:               string
        	annotationSelector?: string
        	labelSelector?:      string
        }
