diff --git a/crd-generator/test/src/test/java/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.java b/crd-generator/test/src/test/java/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.java index da4871e799e..8d05c1cb7de 100644 --- a/crd-generator/test/src/test/java/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.java +++ b/crd-generator/test/src/test/java/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.java @@ -15,6 +15,9 @@ */ package io.fabric8.crd.generator.approvaltests; +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; +import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator; +import com.spun.util.tests.TestUtils; import io.fabric8.crd.generator.CRDGenerator; import io.fabric8.crd.generator.CRDInfo; import io.fabric8.crd.generator.approvaltests.annotated.Annotated; @@ -25,15 +28,19 @@ import io.fabric8.crd.generator.approvaltests.map.ContainingMaps; import io.fabric8.crd.generator.approvaltests.nocyclic.NoCyclic; import io.fabric8.kubernetes.client.CustomResource; +import io.sundr.utils.Strings; import org.approvaltests.Approvals; +import org.approvaltests.namer.StackTraceNamer; +import org.approvaltests.writers.FileApprovalWriter; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import java.io.File; -import java.io.IOException; -import java.nio.file.Files; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -46,12 +53,27 @@ class CRDGeneratorApprovalTest { @TempDir File tempDir; + private boolean minimizeQuotes; + + @BeforeEach + void setUp() { + Approvals.settings().allowMultipleVerifyCallsForThisClass(); + minimizeQuotes = ((YAMLFactory) CRDGenerator.YAML_MAPPER.getFactory()).isEnabled(YAMLGenerator.Feature.MINIMIZE_QUOTES); + ((YAMLFactory) CRDGenerator.YAML_MAPPER.getFactory()).disable(YAMLGenerator.Feature.MINIMIZE_QUOTES); + } + + @AfterEach + void tearDown() { + if (minimizeQuotes) { + ((YAMLFactory) CRDGenerator.YAML_MAPPER.getFactory()).enable(YAMLGenerator.Feature.MINIMIZE_QUOTES); + } + } + @ParameterizedTest(name = "{1}.{2} parallel={3}") @MethodSource("crdApprovalTests") - void approvalTest( - Class>[] crClasses, String expectedCrd, String version, boolean parallel) - throws IOException { - Approvals.settings().allowMultipleVerifyCallsForThisMethod(); + @DisplayName("CRD Generator V1 Approval Tests") + void v1ApprovalTest( + Class>[] crClasses, String expectedCrd, String version, boolean parallel) { final Map> result = new CRDGenerator() .withParallelGenerationEnabled(parallel) .inOutputDir(tempDir) @@ -68,8 +90,8 @@ void approvalTest( .isNotNull(); Approvals.verify( - new String(Files.readAllBytes(new File(result.get(expectedCrd).get(version).getFilePath()).toPath())), - Approvals.NAMES.withParameters(expectedCrd, version)); + new FileApprovalWriter(new File(result.get(expectedCrd).get(version).getFilePath())), + new Namer(expectedCrd, version)); } static Stream crdApprovalTests() { @@ -92,10 +114,10 @@ static Stream crdApprovalTests() { } private static final class TestCase { - private Class>[] crClasses; - private String expectedCrd; - private String version; - private boolean parallel; + private final Class>[] crClasses; + private final String expectedCrd; + private final String version; + private final boolean parallel; public TestCase(String expectedCrd, String version, boolean parallel, Class>... crClasses) { this.expectedCrd = expectedCrd; @@ -105,4 +127,18 @@ public TestCase(String expectedCrd, String version, boolean parallel, Class * ApprovalTests - Best Configuration Practices */ public class PackageSettings { - /** - * Disable Diff-Reporter - */ @SuppressWarnings("unused") - public static ApprovalFailureReporter UseReporter = new QuietReporter(); public String ApprovalBaseDirectory = "../resources"; } diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.annotateds.samples.fabric8.io.v1.approved.txt b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.annotateds.samples.fabric8.io.v1.approved.txt deleted file mode 100644 index 82da118d7de..00000000000 --- a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.annotateds.samples.fabric8.io.v1.approved.txt +++ /dev/null @@ -1,78 +0,0 @@ -# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: annotateds.samples.fabric8.io -spec: - group: samples.fabric8.io - names: - kind: Annotated - plural: annotateds - singular: annotated - scope: Cluster - versions: - - name: v1 - schema: - openAPIV3Schema: - properties: - spec: - properties: - anEnum: - enum: - - non - - oui - type: string - defaultValue: - default: my-value - type: string - defaultValue2: - default: my-value2 - type: string - emptySetter: - type: boolean - emptySetter2: - type: boolean - from-field: - description: from-field-description - type: string - from-getter: - description: from-getter-description - type: integer - kubernetesValidationRule: - type: string - x-kubernetes-validations: - - message: kubernetesValidationRule must start with prefix 'prefix-' - rule: self.startwith('prefix-') - kubernetesValidationRules: - type: string - x-kubernetes-validations: - - rule: first.rule - - rule: second.rule - - reason: FieldValueForbidden - rule: third.rule - max: - maximum: 5.0 - type: integer - min: - minimum: -5.0 - type: integer - nullable: - nullable: true - type: string - singleDigit: - pattern: "\\b[1-9]\\b" - type: string - sizedField: - type: integer - unnamed: - type: string - required: - - emptySetter - - emptySetter2 - - from-getter - type: object - status: - type: object - type: object - served: true - storage: true diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.annotateds.samples.fabric8.io.v1.approved.yml b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.annotateds.samples.fabric8.io.v1.approved.yml new file mode 100644 index 00000000000..1e91b99c582 --- /dev/null +++ b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.annotateds.samples.fabric8.io.v1.approved.yml @@ -0,0 +1,78 @@ +# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! +apiVersion: "apiextensions.k8s.io/v1" +kind: "CustomResourceDefinition" +metadata: + name: "annotateds.samples.fabric8.io" +spec: + group: "samples.fabric8.io" + names: + kind: "Annotated" + plural: "annotateds" + singular: "annotated" + scope: "Cluster" + versions: + - name: "v1" + schema: + openAPIV3Schema: + properties: + spec: + properties: + anEnum: + enum: + - "non" + - "oui" + type: "string" + defaultValue: + default: "my-value" + type: "string" + defaultValue2: + default: "my-value2" + type: "string" + emptySetter: + type: "boolean" + emptySetter2: + type: "boolean" + from-field: + description: "from-field-description" + type: "string" + from-getter: + description: "from-getter-description" + type: "integer" + kubernetesValidationRule: + type: "string" + x-kubernetes-validations: + - message: "kubernetesValidationRule must start with prefix 'prefix-'" + rule: "self.startwith('prefix-')" + kubernetesValidationRules: + type: "string" + x-kubernetes-validations: + - rule: "first.rule" + - rule: "second.rule" + - reason: "FieldValueForbidden" + rule: "third.rule" + max: + maximum: 5.0 + type: "integer" + min: + minimum: -5.0 + type: "integer" + nullable: + nullable: true + type: "string" + singleDigit: + pattern: "\\b[1-9]\\b" + type: "string" + sizedField: + type: "integer" + unnamed: + type: "string" + required: + - "emptySetter" + - "emptySetter2" + - "from-getter" + type: "object" + status: + type: "object" + type: "object" + served: true + storage: true diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.annotateds.samples.fabric8.io.v1beta1.approved.txt b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.annotateds.samples.fabric8.io.v1beta1.approved.txt deleted file mode 100644 index d3fcf7cd9e9..00000000000 --- a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.annotateds.samples.fabric8.io.v1beta1.approved.txt +++ /dev/null @@ -1,78 +0,0 @@ -# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: annotateds.samples.fabric8.io -spec: - group: samples.fabric8.io - names: - kind: Annotated - plural: annotateds - singular: annotated - scope: Cluster - validation: - openAPIV3Schema: - properties: - spec: - properties: - anEnum: - enum: - - non - - oui - type: string - defaultValue: - default: my-value - type: string - defaultValue2: - default: my-value2 - type: string - emptySetter: - type: boolean - emptySetter2: - type: boolean - from-field: - description: from-field-description - type: string - from-getter: - description: from-getter-description - type: integer - kubernetesValidationRule: - type: string - x-kubernetes-validations: - - message: kubernetesValidationRule must start with prefix 'prefix-' - rule: self.startwith('prefix-') - kubernetesValidationRules: - type: string - x-kubernetes-validations: - - rule: first.rule - - rule: second.rule - - reason: FieldValueForbidden - rule: third.rule - max: - maximum: 5.0 - type: integer - min: - minimum: -5.0 - type: integer - nullable: - nullable: true - type: string - singleDigit: - pattern: "\\b[1-9]\\b" - type: string - sizedField: - type: integer - unnamed: - type: string - required: - - emptySetter - - emptySetter2 - - from-getter - type: object - status: - type: object - type: object - versions: - - name: v1 - served: true - storage: true diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.annotateds.samples.fabric8.io.v1beta1.approved.yml b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.annotateds.samples.fabric8.io.v1beta1.approved.yml new file mode 100644 index 00000000000..cd8b20e6c53 --- /dev/null +++ b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.annotateds.samples.fabric8.io.v1beta1.approved.yml @@ -0,0 +1,78 @@ +# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! +apiVersion: "apiextensions.k8s.io/v1beta1" +kind: "CustomResourceDefinition" +metadata: + name: "annotateds.samples.fabric8.io" +spec: + group: "samples.fabric8.io" + names: + kind: "Annotated" + plural: "annotateds" + singular: "annotated" + scope: "Cluster" + validation: + openAPIV3Schema: + properties: + spec: + properties: + anEnum: + enum: + - "non" + - "oui" + type: "string" + defaultValue: + default: "my-value" + type: "string" + defaultValue2: + default: "my-value2" + type: "string" + emptySetter: + type: "boolean" + emptySetter2: + type: "boolean" + from-field: + description: "from-field-description" + type: "string" + from-getter: + description: "from-getter-description" + type: "integer" + kubernetesValidationRule: + type: "string" + x-kubernetes-validations: + - message: "kubernetesValidationRule must start with prefix 'prefix-'" + rule: "self.startwith('prefix-')" + kubernetesValidationRules: + type: "string" + x-kubernetes-validations: + - rule: "first.rule" + - rule: "second.rule" + - reason: "FieldValueForbidden" + rule: "third.rule" + max: + maximum: 5.0 + type: "integer" + min: + minimum: -5.0 + type: "integer" + nullable: + nullable: true + type: "string" + singleDigit: + pattern: "\\b[1-9]\\b" + type: "string" + sizedField: + type: "integer" + unnamed: + type: "string" + required: + - "emptySetter" + - "emptySetter2" + - "from-getter" + type: "object" + status: + type: "object" + type: "object" + versions: + - name: "v1" + served: true + storage: true diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.children.sample.fabric8.io.v1.approved.txt b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.children.sample.fabric8.io.v1.approved.txt deleted file mode 100644 index 2ae0d789efa..00000000000 --- a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.children.sample.fabric8.io.v1.approved.txt +++ /dev/null @@ -1,41 +0,0 @@ -# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: children.sample.fabric8.io -spec: - group: sample.fabric8.io - names: - kind: Child - plural: children - singular: child - scope: Namespaced - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - properties: - spec: - properties: - baseInt: - type: integer - supported: - additionalProperties: - type: string - type: object - unsupported: - additionalProperties: - type: object - type: object - unsupported2: - additionalProperties: - type: object - type: object - type: object - status: - type: object - type: object - served: true - storage: true - subresources: - status: {} \ No newline at end of file diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.children.sample.fabric8.io.v1.approved.yml b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.children.sample.fabric8.io.v1.approved.yml new file mode 100644 index 00000000000..3a98b4a861a --- /dev/null +++ b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.children.sample.fabric8.io.v1.approved.yml @@ -0,0 +1,41 @@ +# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! +apiVersion: "apiextensions.k8s.io/v1" +kind: "CustomResourceDefinition" +metadata: + name: "children.sample.fabric8.io" +spec: + group: "sample.fabric8.io" + names: + kind: "Child" + plural: "children" + singular: "child" + scope: "Namespaced" + versions: + - name: "v1alpha1" + schema: + openAPIV3Schema: + properties: + spec: + properties: + baseInt: + type: "integer" + supported: + additionalProperties: + type: "string" + type: "object" + unsupported: + additionalProperties: + type: "object" + type: "object" + unsupported2: + additionalProperties: + type: "object" + type: "object" + type: "object" + status: + type: "object" + type: "object" + served: true + storage: true + subresources: + status: {} diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.children.sample.fabric8.io.v1beta1.approved.txt b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.children.sample.fabric8.io.v1beta1.approved.txt deleted file mode 100644 index 5824f453b80..00000000000 --- a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.children.sample.fabric8.io.v1beta1.approved.txt +++ /dev/null @@ -1,41 +0,0 @@ -# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: children.sample.fabric8.io -spec: - group: sample.fabric8.io - names: - kind: Child - plural: children - singular: child - scope: Namespaced - subresources: - status: {} - validation: - openAPIV3Schema: - properties: - spec: - properties: - baseInt: - type: integer - supported: - additionalProperties: - type: string - type: object - unsupported: - additionalProperties: - type: object - type: object - unsupported2: - additionalProperties: - type: object - type: object - type: object - status: - type: object - type: object - versions: - - name: v1alpha1 - served: true - storage: true \ No newline at end of file diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.children.sample.fabric8.io.v1beta1.approved.yml b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.children.sample.fabric8.io.v1beta1.approved.yml new file mode 100644 index 00000000000..7d81a211544 --- /dev/null +++ b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.children.sample.fabric8.io.v1beta1.approved.yml @@ -0,0 +1,41 @@ +# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! +apiVersion: "apiextensions.k8s.io/v1beta1" +kind: "CustomResourceDefinition" +metadata: + name: "children.sample.fabric8.io" +spec: + group: "sample.fabric8.io" + names: + kind: "Child" + plural: "children" + singular: "child" + scope: "Namespaced" + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + spec: + properties: + baseInt: + type: "integer" + supported: + additionalProperties: + type: "string" + type: "object" + unsupported: + additionalProperties: + type: "object" + type: "object" + unsupported2: + additionalProperties: + type: "object" + type: "object" + type: "object" + status: + type: "object" + type: "object" + versions: + - name: "v1alpha1" + served: true + storage: true diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.complexkinds.samples.fabric8.io.v1.approved.txt b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.complexkinds.samples.fabric8.io.v1.approved.txt deleted file mode 100644 index 7a3ca65680e..00000000000 --- a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.complexkinds.samples.fabric8.io.v1.approved.txt +++ /dev/null @@ -1,199 +0,0 @@ -# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: complexkinds.samples.fabric8.io -spec: - group: samples.fabric8.io - names: - kind: ComplexKind - plural: complexkinds - singular: complexkind - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .status.message - name: Message - priority: 0 - type: string - - jsonPath: .status.state - name: State - priority: 0 - type: string - name: v1 - schema: - openAPIV3Schema: - properties: - spec: - properties: - actuatorPort: - type: integer - configMapName: - type: string - metricsPath: - type: string - metricsPort: - type: integer - services: - items: - properties: - metadata: - description: The metadata of this Service - properties: - annotations: - additionalProperties: - type: string - type: object - creationTimestamp: - type: string - deletionGracePeriodSeconds: - type: integer - deletionTimestamp: - type: string - finalizers: - items: - type: string - type: array - generateName: - type: string - generation: - type: integer - labels: - additionalProperties: - type: string - type: object - name: - type: string - namespace: - type: string - resourceVersion: - type: string - selfLink: - type: string - uid: - type: string - type: object - spec: - description: The spec of this Service - nullable: true - properties: - allocateLoadBalancerNodePorts: - type: boolean - clusterIP: - type: string - clusterIPs: - items: - type: string - type: array - externalIPs: - items: - type: string - type: array - externalName: - type: string - externalTrafficPolicy: - type: string - healthCheckNodePort: - type: integer - internalTrafficPolicy: - type: string - ipFamilies: - items: - type: string - type: array - ipFamilyPolicy: - type: string - loadBalancerClass: - type: string - loadBalancerIP: - type: string - loadBalancerSourceRanges: - items: - type: string - type: array - publishNotReadyAddresses: - type: boolean - selector: - additionalProperties: - type: string - type: object - sessionAffinity: - type: string - type: - type: string - type: object - type: object - type: array - statefulSet: - properties: - metadata: - description: The metadata of this StatefulSet - properties: - annotations: - additionalProperties: - type: string - type: object - creationTimestamp: - type: string - deletionGracePeriodSeconds: - type: integer - deletionTimestamp: - type: string - finalizers: - items: - type: string - type: array - generateName: - type: string - generation: - type: integer - labels: - additionalProperties: - type: string - type: object - name: - type: string - namespace: - type: string - resourceVersion: - type: string - selfLink: - type: string - uid: - type: string - type: object - spec: - description: The spec of this StatefulSet - properties: - minReadySeconds: - type: integer - podManagementPolicy: - type: string - replicas: - type: integer - revisionHistoryLimit: - type: integer - serviceName: - type: string - type: object - type: object - type: object - status: - properties: - message: - type: string - state: - enum: - - CREATED - - ERROR - - ROLLING_UPDATE - - RUNNING - - SCALING - - STARTING - type: string - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.complexkinds.samples.fabric8.io.v1.approved.yml b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.complexkinds.samples.fabric8.io.v1.approved.yml new file mode 100644 index 00000000000..f672df01f8f --- /dev/null +++ b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.complexkinds.samples.fabric8.io.v1.approved.yml @@ -0,0 +1,199 @@ +# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! +apiVersion: "apiextensions.k8s.io/v1" +kind: "CustomResourceDefinition" +metadata: + name: "complexkinds.samples.fabric8.io" +spec: + group: "samples.fabric8.io" + names: + kind: "ComplexKind" + plural: "complexkinds" + singular: "complexkind" + scope: "Namespaced" + versions: + - additionalPrinterColumns: + - jsonPath: ".status.message" + name: "Message" + priority: 0 + type: "string" + - jsonPath: ".status.state" + name: "State" + priority: 0 + type: "string" + name: "v1" + schema: + openAPIV3Schema: + properties: + spec: + properties: + actuatorPort: + type: "integer" + configMapName: + type: "string" + metricsPath: + type: "string" + metricsPort: + type: "integer" + services: + items: + properties: + metadata: + description: "The metadata of this Service" + properties: + annotations: + additionalProperties: + type: "string" + type: "object" + creationTimestamp: + type: "string" + deletionGracePeriodSeconds: + type: "integer" + deletionTimestamp: + type: "string" + finalizers: + items: + type: "string" + type: "array" + generateName: + type: "string" + generation: + type: "integer" + labels: + additionalProperties: + type: "string" + type: "object" + name: + type: "string" + namespace: + type: "string" + resourceVersion: + type: "string" + selfLink: + type: "string" + uid: + type: "string" + type: "object" + spec: + description: "The spec of this Service" + nullable: true + properties: + allocateLoadBalancerNodePorts: + type: "boolean" + clusterIP: + type: "string" + clusterIPs: + items: + type: "string" + type: "array" + externalIPs: + items: + type: "string" + type: "array" + externalName: + type: "string" + externalTrafficPolicy: + type: "string" + healthCheckNodePort: + type: "integer" + internalTrafficPolicy: + type: "string" + ipFamilies: + items: + type: "string" + type: "array" + ipFamilyPolicy: + type: "string" + loadBalancerClass: + type: "string" + loadBalancerIP: + type: "string" + loadBalancerSourceRanges: + items: + type: "string" + type: "array" + publishNotReadyAddresses: + type: "boolean" + selector: + additionalProperties: + type: "string" + type: "object" + sessionAffinity: + type: "string" + type: + type: "string" + type: "object" + type: "object" + type: "array" + statefulSet: + properties: + metadata: + description: "The metadata of this StatefulSet" + properties: + annotations: + additionalProperties: + type: "string" + type: "object" + creationTimestamp: + type: "string" + deletionGracePeriodSeconds: + type: "integer" + deletionTimestamp: + type: "string" + finalizers: + items: + type: "string" + type: "array" + generateName: + type: "string" + generation: + type: "integer" + labels: + additionalProperties: + type: "string" + type: "object" + name: + type: "string" + namespace: + type: "string" + resourceVersion: + type: "string" + selfLink: + type: "string" + uid: + type: "string" + type: "object" + spec: + description: "The spec of this StatefulSet" + properties: + minReadySeconds: + type: "integer" + podManagementPolicy: + type: "string" + replicas: + type: "integer" + revisionHistoryLimit: + type: "integer" + serviceName: + type: "string" + type: "object" + type: "object" + type: "object" + status: + properties: + message: + type: "string" + state: + enum: + - "CREATED" + - "ERROR" + - "ROLLING_UPDATE" + - "RUNNING" + - "SCALING" + - "STARTING" + type: "string" + type: "object" + type: "object" + served: true + storage: true + subresources: + status: {} diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.complexkinds.samples.fabric8.io.v1beta1.approved.txt b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.complexkinds.samples.fabric8.io.v1beta1.approved.txt deleted file mode 100644 index 5aa1169b6a2..00000000000 --- a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.complexkinds.samples.fabric8.io.v1beta1.approved.txt +++ /dev/null @@ -1,199 +0,0 @@ -# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: complexkinds.samples.fabric8.io -spec: - additionalPrinterColumns: - - JSONPath: .status.message - name: Message - priority: 0 - type: string - - JSONPath: .status.state - name: State - priority: 0 - type: string - group: samples.fabric8.io - names: - kind: ComplexKind - plural: complexkinds - singular: complexkind - scope: Namespaced - subresources: - status: {} - validation: - openAPIV3Schema: - properties: - spec: - properties: - actuatorPort: - type: integer - configMapName: - type: string - metricsPath: - type: string - metricsPort: - type: integer - services: - items: - properties: - metadata: - description: The metadata of this Service - properties: - annotations: - additionalProperties: - type: string - type: object - creationTimestamp: - type: string - deletionGracePeriodSeconds: - type: integer - deletionTimestamp: - type: string - finalizers: - items: - type: string - type: array - generateName: - type: string - generation: - type: integer - labels: - additionalProperties: - type: string - type: object - name: - type: string - namespace: - type: string - resourceVersion: - type: string - selfLink: - type: string - uid: - type: string - type: object - spec: - description: The spec of this Service - nullable: true - properties: - allocateLoadBalancerNodePorts: - type: boolean - clusterIP: - type: string - clusterIPs: - items: - type: string - type: array - externalIPs: - items: - type: string - type: array - externalName: - type: string - externalTrafficPolicy: - type: string - healthCheckNodePort: - type: integer - internalTrafficPolicy: - type: string - ipFamilies: - items: - type: string - type: array - ipFamilyPolicy: - type: string - loadBalancerClass: - type: string - loadBalancerIP: - type: string - loadBalancerSourceRanges: - items: - type: string - type: array - publishNotReadyAddresses: - type: boolean - selector: - additionalProperties: - type: string - type: object - sessionAffinity: - type: string - type: - type: string - type: object - type: object - type: array - statefulSet: - properties: - metadata: - description: The metadata of this StatefulSet - properties: - annotations: - additionalProperties: - type: string - type: object - creationTimestamp: - type: string - deletionGracePeriodSeconds: - type: integer - deletionTimestamp: - type: string - finalizers: - items: - type: string - type: array - generateName: - type: string - generation: - type: integer - labels: - additionalProperties: - type: string - type: object - name: - type: string - namespace: - type: string - resourceVersion: - type: string - selfLink: - type: string - uid: - type: string - type: object - spec: - description: The spec of this StatefulSet - properties: - minReadySeconds: - type: integer - podManagementPolicy: - type: string - replicas: - type: integer - revisionHistoryLimit: - type: integer - serviceName: - type: string - type: object - type: object - type: object - status: - properties: - message: - type: string - state: - enum: - - CREATED - - ERROR - - ROLLING_UPDATE - - RUNNING - - SCALING - - STARTING - type: string - type: object - type: object - versions: - - name: v1 - served: true - storage: true diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.complexkinds.samples.fabric8.io.v1beta1.approved.yml b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.complexkinds.samples.fabric8.io.v1beta1.approved.yml new file mode 100644 index 00000000000..6ce62ab09e7 --- /dev/null +++ b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.complexkinds.samples.fabric8.io.v1beta1.approved.yml @@ -0,0 +1,199 @@ +# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! +apiVersion: "apiextensions.k8s.io/v1beta1" +kind: "CustomResourceDefinition" +metadata: + name: "complexkinds.samples.fabric8.io" +spec: + additionalPrinterColumns: + - JSONPath: ".status.message" + name: "Message" + priority: 0 + type: "string" + - JSONPath: ".status.state" + name: "State" + priority: 0 + type: "string" + group: "samples.fabric8.io" + names: + kind: "ComplexKind" + plural: "complexkinds" + singular: "complexkind" + scope: "Namespaced" + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + spec: + properties: + actuatorPort: + type: "integer" + configMapName: + type: "string" + metricsPath: + type: "string" + metricsPort: + type: "integer" + services: + items: + properties: + metadata: + description: "The metadata of this Service" + properties: + annotations: + additionalProperties: + type: "string" + type: "object" + creationTimestamp: + type: "string" + deletionGracePeriodSeconds: + type: "integer" + deletionTimestamp: + type: "string" + finalizers: + items: + type: "string" + type: "array" + generateName: + type: "string" + generation: + type: "integer" + labels: + additionalProperties: + type: "string" + type: "object" + name: + type: "string" + namespace: + type: "string" + resourceVersion: + type: "string" + selfLink: + type: "string" + uid: + type: "string" + type: "object" + spec: + description: "The spec of this Service" + nullable: true + properties: + allocateLoadBalancerNodePorts: + type: "boolean" + clusterIP: + type: "string" + clusterIPs: + items: + type: "string" + type: "array" + externalIPs: + items: + type: "string" + type: "array" + externalName: + type: "string" + externalTrafficPolicy: + type: "string" + healthCheckNodePort: + type: "integer" + internalTrafficPolicy: + type: "string" + ipFamilies: + items: + type: "string" + type: "array" + ipFamilyPolicy: + type: "string" + loadBalancerClass: + type: "string" + loadBalancerIP: + type: "string" + loadBalancerSourceRanges: + items: + type: "string" + type: "array" + publishNotReadyAddresses: + type: "boolean" + selector: + additionalProperties: + type: "string" + type: "object" + sessionAffinity: + type: "string" + type: + type: "string" + type: "object" + type: "object" + type: "array" + statefulSet: + properties: + metadata: + description: "The metadata of this StatefulSet" + properties: + annotations: + additionalProperties: + type: "string" + type: "object" + creationTimestamp: + type: "string" + deletionGracePeriodSeconds: + type: "integer" + deletionTimestamp: + type: "string" + finalizers: + items: + type: "string" + type: "array" + generateName: + type: "string" + generation: + type: "integer" + labels: + additionalProperties: + type: "string" + type: "object" + name: + type: "string" + namespace: + type: "string" + resourceVersion: + type: "string" + selfLink: + type: "string" + uid: + type: "string" + type: "object" + spec: + description: "The spec of this StatefulSet" + properties: + minReadySeconds: + type: "integer" + podManagementPolicy: + type: "string" + replicas: + type: "integer" + revisionHistoryLimit: + type: "integer" + serviceName: + type: "string" + type: "object" + type: "object" + type: "object" + status: + properties: + message: + type: "string" + state: + enum: + - "CREATED" + - "ERROR" + - "ROLLING_UPDATE" + - "RUNNING" + - "SCALING" + - "STARTING" + type: "string" + type: "object" + type: "object" + versions: + - name: "v1" + served: true + storage: true diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingjsons.sample.fabric8.io.v1.approved.txt b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingjsons.sample.fabric8.io.v1.approved.yml similarity index 53% rename from crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingjsons.sample.fabric8.io.v1.approved.txt rename to crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingjsons.sample.fabric8.io.v1.approved.yml index 89592cd1f07..85145a74cde 100644 --- a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingjsons.sample.fabric8.io.v1.approved.txt +++ b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingjsons.sample.fabric8.io.v1.approved.yml @@ -1,38 +1,38 @@ # Generated by Fabric8 CRDGenerator, manual edits might get overwritten! -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition +apiVersion: "apiextensions.k8s.io/v1" +kind: "CustomResourceDefinition" metadata: - name: containingjsons.sample.fabric8.io + name: "containingjsons.sample.fabric8.io" spec: - group: sample.fabric8.io + group: "sample.fabric8.io" names: - kind: ContainingJson - plural: containingjsons - singular: containingjson - scope: Cluster + kind: "ContainingJson" + plural: "containingjsons" + singular: "containingjson" + scope: "Cluster" versions: - - name: v1alpha1 + - name: "v1alpha1" schema: openAPIV3Schema: properties: spec: properties: field: - type: integer + type: "integer" foo: properties: configAsMap: additionalProperties: - type: object - type: object + type: "object" + type: "object" x-kubernetes-preserve-unknown-fields: true - type: object + type: "object" x-kubernetes-preserve-unknown-fields: true free: x-kubernetes-preserve-unknown-fields: true - type: object + type: "object" status: - type: object - type: object + type: "object" + type: "object" served: true - storage: true \ No newline at end of file + storage: true diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingjsons.sample.fabric8.io.v1beta1.approved.txt b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingjsons.sample.fabric8.io.v1beta1.approved.yml similarity index 53% rename from crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingjsons.sample.fabric8.io.v1beta1.approved.txt rename to crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingjsons.sample.fabric8.io.v1beta1.approved.yml index 051a0a5934f..28a31277c02 100644 --- a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingjsons.sample.fabric8.io.v1beta1.approved.txt +++ b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingjsons.sample.fabric8.io.v1beta1.approved.yml @@ -1,38 +1,38 @@ # Generated by Fabric8 CRDGenerator, manual edits might get overwritten! -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition +apiVersion: "apiextensions.k8s.io/v1beta1" +kind: "CustomResourceDefinition" metadata: - name: containingjsons.sample.fabric8.io + name: "containingjsons.sample.fabric8.io" spec: - group: sample.fabric8.io + group: "sample.fabric8.io" names: - kind: ContainingJson - plural: containingjsons - singular: containingjson - scope: Cluster + kind: "ContainingJson" + plural: "containingjsons" + singular: "containingjson" + scope: "Cluster" validation: openAPIV3Schema: properties: spec: properties: field: - type: integer + type: "integer" foo: properties: configAsMap: additionalProperties: - type: object - type: object + type: "object" + type: "object" x-kubernetes-preserve-unknown-fields: true - type: object + type: "object" x-kubernetes-preserve-unknown-fields: true free: x-kubernetes-preserve-unknown-fields: true - type: object + type: "object" status: - type: object - type: object + type: "object" + type: "object" versions: - - name: v1alpha1 + - name: "v1alpha1" served: true - storage: true \ No newline at end of file + storage: true diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingmaps.sample.fabric8.io.v1.approved.txt b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingmaps.sample.fabric8.io.v1.approved.txt deleted file mode 100644 index 3a65e673ccf..00000000000 --- a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingmaps.sample.fabric8.io.v1.approved.txt +++ /dev/null @@ -1,85 +0,0 @@ -# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: containingmaps.sample.fabric8.io -spec: - group: sample.fabric8.io - names: - kind: ContainingMaps - plural: containingmaps - singular: containingmaps - scope: Cluster - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - properties: - enumToStringMap: - additionalProperties: - type: string - type: object - spec: - properties: - stringToIntMultiMap1: - additionalProperties: - items: - type: integer - type: array - type: object - stringToIntMultiMap2: - additionalProperties: - items: - type: integer - type: array - type: object - stringToIntMultiMap3: - additionalProperties: - items: - type: integer - type: array - type: object - stringToIntMultiMap4: - additionalProperties: - items: - type: integer - type: array - type: object - stringToIntMultiMap5: - additionalProperties: - items: - type: integer - type: array - type: object - stringToIntMultiMap6: - additionalProperties: - items: - type: integer - type: array - type: object - stringToIntMultiMap7: - additionalProperties: - items: - type: integer - type: array - type: object - test: - additionalProperties: - items: - type: string - type: array - type: object - test2: - additionalProperties: - additionalProperties: - items: - type: boolean - type: array - type: object - type: object - type: object - status: - type: object - type: object - served: true - storage: true \ No newline at end of file diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingmaps.sample.fabric8.io.v1.approved.yml b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingmaps.sample.fabric8.io.v1.approved.yml new file mode 100644 index 00000000000..5771468a4b7 --- /dev/null +++ b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingmaps.sample.fabric8.io.v1.approved.yml @@ -0,0 +1,85 @@ +# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! +apiVersion: "apiextensions.k8s.io/v1" +kind: "CustomResourceDefinition" +metadata: + name: "containingmaps.sample.fabric8.io" +spec: + group: "sample.fabric8.io" + names: + kind: "ContainingMaps" + plural: "containingmaps" + singular: "containingmaps" + scope: "Cluster" + versions: + - name: "v1alpha1" + schema: + openAPIV3Schema: + properties: + enumToStringMap: + additionalProperties: + type: "string" + type: "object" + spec: + properties: + stringToIntMultiMap1: + additionalProperties: + items: + type: "integer" + type: "array" + type: "object" + stringToIntMultiMap2: + additionalProperties: + items: + type: "integer" + type: "array" + type: "object" + stringToIntMultiMap3: + additionalProperties: + items: + type: "integer" + type: "array" + type: "object" + stringToIntMultiMap4: + additionalProperties: + items: + type: "integer" + type: "array" + type: "object" + stringToIntMultiMap5: + additionalProperties: + items: + type: "integer" + type: "array" + type: "object" + stringToIntMultiMap6: + additionalProperties: + items: + type: "integer" + type: "array" + type: "object" + stringToIntMultiMap7: + additionalProperties: + items: + type: "integer" + type: "array" + type: "object" + test: + additionalProperties: + items: + type: "string" + type: "array" + type: "object" + test2: + additionalProperties: + additionalProperties: + items: + type: "boolean" + type: "array" + type: "object" + type: "object" + type: "object" + status: + type: "object" + type: "object" + served: true + storage: true diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingmaps.sample.fabric8.io.v1beta1.approved.txt b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingmaps.sample.fabric8.io.v1beta1.approved.txt deleted file mode 100644 index 97cf0fd7efd..00000000000 --- a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingmaps.sample.fabric8.io.v1beta1.approved.txt +++ /dev/null @@ -1,85 +0,0 @@ -# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: containingmaps.sample.fabric8.io -spec: - group: sample.fabric8.io - names: - kind: ContainingMaps - plural: containingmaps - singular: containingmaps - scope: Cluster - validation: - openAPIV3Schema: - properties: - enumToStringMap: - additionalProperties: - type: string - type: object - spec: - properties: - stringToIntMultiMap1: - additionalProperties: - items: - type: integer - type: array - type: object - stringToIntMultiMap2: - additionalProperties: - items: - type: integer - type: array - type: object - stringToIntMultiMap3: - additionalProperties: - items: - type: integer - type: array - type: object - stringToIntMultiMap4: - additionalProperties: - items: - type: integer - type: array - type: object - stringToIntMultiMap5: - additionalProperties: - items: - type: integer - type: array - type: object - stringToIntMultiMap6: - additionalProperties: - items: - type: integer - type: array - type: object - stringToIntMultiMap7: - additionalProperties: - items: - type: integer - type: array - type: object - test: - additionalProperties: - items: - type: string - type: array - type: object - test2: - additionalProperties: - additionalProperties: - items: - type: boolean - type: array - type: object - type: object - type: object - status: - type: object - type: object - versions: - - name: v1alpha1 - served: true - storage: true \ No newline at end of file diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingmaps.sample.fabric8.io.v1beta1.approved.yml b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingmaps.sample.fabric8.io.v1beta1.approved.yml new file mode 100644 index 00000000000..5fa17c538a5 --- /dev/null +++ b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.containingmaps.sample.fabric8.io.v1beta1.approved.yml @@ -0,0 +1,85 @@ +# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! +apiVersion: "apiextensions.k8s.io/v1beta1" +kind: "CustomResourceDefinition" +metadata: + name: "containingmaps.sample.fabric8.io" +spec: + group: "sample.fabric8.io" + names: + kind: "ContainingMaps" + plural: "containingmaps" + singular: "containingmaps" + scope: "Cluster" + validation: + openAPIV3Schema: + properties: + enumToStringMap: + additionalProperties: + type: "string" + type: "object" + spec: + properties: + stringToIntMultiMap1: + additionalProperties: + items: + type: "integer" + type: "array" + type: "object" + stringToIntMultiMap2: + additionalProperties: + items: + type: "integer" + type: "array" + type: "object" + stringToIntMultiMap3: + additionalProperties: + items: + type: "integer" + type: "array" + type: "object" + stringToIntMultiMap4: + additionalProperties: + items: + type: "integer" + type: "array" + type: "object" + stringToIntMultiMap5: + additionalProperties: + items: + type: "integer" + type: "array" + type: "object" + stringToIntMultiMap6: + additionalProperties: + items: + type: "integer" + type: "array" + type: "object" + stringToIntMultiMap7: + additionalProperties: + items: + type: "integer" + type: "array" + type: "object" + test: + additionalProperties: + items: + type: "string" + type: "array" + type: "object" + test2: + additionalProperties: + additionalProperties: + items: + type: "boolean" + type: "array" + type: "object" + type: "object" + type: "object" + status: + type: "object" + type: "object" + versions: + - name: "v1alpha1" + served: true + storage: true diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.k8svalidations.samples.fabric8.io.v1.approved.txt b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.k8svalidations.samples.fabric8.io.v1.approved.txt deleted file mode 100644 index 7205b7ea70b..00000000000 --- a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.k8svalidations.samples.fabric8.io.v1.approved.txt +++ /dev/null @@ -1,145 +0,0 @@ -# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: k8svalidations.samples.fabric8.io -spec: - group: samples.fabric8.io - names: - kind: K8sValidation - plural: k8svalidations - singular: k8svalidation - scope: Cluster - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - properties: - spec: - properties: - deepLevel1: - properties: - deepLevel2: - properties: - simple: - type: string - x-kubernetes-validations: - - rule: self.startsWith('deep-') - valueL2: - type: string - required: - - valueL2 - type: object - valueL1: - type: string - required: - - deepLevel2 - - valueL1 - type: object - x-kubernetes-validations: - - messageExpression: '''valueL1 ('' + self.valueL1 + '') must be equal - to deepLevel2.valueL2 ('' + self.deepLevel2.valueL2 + '')''' - rule: self.valueL1 == self.deepLevel2.valueL2 - immutable: - type: string - x-kubernetes-validations: - - message: cannot be changed once set - rule: self == oldSelf - maxReplicas: - type: integer - minReplicas: - type: integer - monotonicCounter: - type: integer - x-kubernetes-validations: - - message: cannot decrease value once set - reason: FieldValueForbidden - rule: self >= oldSelf - multiple: - type: string - x-kubernetes-validations: - - rule: self.startsWith('start-') - - rule: self.endsWith('-end') - namePrefix: - type: string - onAbstractClass: - properties: - dummy: - type: string - required: - - dummy - type: object - x-kubernetes-validations: - - rule: self.dummy.startsWith('abstract-') - onAttributeAndClass: - properties: - dummy: - type: string - required: - - dummy - type: object - x-kubernetes-validations: - - rule: self.dummy.startsWith('on-class-') - - rule: self.dummy.startsWith('on-attr-') - onAttributeAndGetter: - type: string - x-kubernetes-validations: - - rule: self.startsWith('start-') - - rule: self.endsWith('-end') - onGetter: - type: string - x-kubernetes-validations: - - rule: self.startsWith('on-getter-') - priority: - enum: - - high - - low - - medium - type: string - x-kubernetes-validations: - - message: cannot transition directly between 'low' and 'high' - rule: '!(self == ''high'' && oldSelf == ''low'') && !(self == ''low'' - && oldSelf == ''high'')' - replicas: - type: integer - simple: - type: string - x-kubernetes-validations: - - rule: self.startsWith('simple-') - required: - - deepLevel1 - - maxReplicas - - minReplicas - - multiple - - namePrefix - - onAbstractClass - - onAttributeAndClass - - onAttributeAndGetter - - onGetter - - priority - - replicas - - simple - type: object - x-kubernetes-validations: - - fieldPath: .replicas - rule: self.minReplicas <= self.replicas && self.replicas <= self.maxReplicas - - message: replicas must be greater than or equal to minReplicas - rule: self.minReplicas <= self.replicas - - message: replicas must be smaller than or equal to maxReplicas - rule: self.replicas <= self.maxReplicas - status: - properties: - availableReplicas: - type: integer - type: object - type: object - x-kubernetes-validations: - - messageExpression: '''name must start with '' + self.spec.namePrefix' - reason: FieldValueForbidden - rule: self.metadata.name.startsWith(self.spec.namePrefix) - - message: updates not allowed in degraded state - rule: self.status.availableReplicas >= self.spec.minReplicas - served: true - storage: true - subresources: - status: {} \ No newline at end of file diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.k8svalidations.samples.fabric8.io.v1.approved.yml b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.k8svalidations.samples.fabric8.io.v1.approved.yml new file mode 100644 index 00000000000..2358e65670c --- /dev/null +++ b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.k8svalidations.samples.fabric8.io.v1.approved.yml @@ -0,0 +1,145 @@ +# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! +apiVersion: "apiextensions.k8s.io/v1" +kind: "CustomResourceDefinition" +metadata: + name: "k8svalidations.samples.fabric8.io" +spec: + group: "samples.fabric8.io" + names: + kind: "K8sValidation" + plural: "k8svalidations" + singular: "k8svalidation" + scope: "Cluster" + versions: + - name: "v1alpha1" + schema: + openAPIV3Schema: + properties: + spec: + properties: + deepLevel1: + properties: + deepLevel2: + properties: + simple: + type: "string" + x-kubernetes-validations: + - rule: "self.startsWith('deep-')" + valueL2: + type: "string" + required: + - "valueL2" + type: "object" + valueL1: + type: "string" + required: + - "deepLevel2" + - "valueL1" + type: "object" + x-kubernetes-validations: + - messageExpression: "'valueL1 (' + self.valueL1 + ') must be equal\ + \ to deepLevel2.valueL2 (' + self.deepLevel2.valueL2 + ')'" + rule: "self.valueL1 == self.deepLevel2.valueL2" + immutable: + type: "string" + x-kubernetes-validations: + - message: "cannot be changed once set" + rule: "self == oldSelf" + maxReplicas: + type: "integer" + minReplicas: + type: "integer" + monotonicCounter: + type: "integer" + x-kubernetes-validations: + - message: "cannot decrease value once set" + reason: "FieldValueForbidden" + rule: "self >= oldSelf" + multiple: + type: "string" + x-kubernetes-validations: + - rule: "self.startsWith('start-')" + - rule: "self.endsWith('-end')" + namePrefix: + type: "string" + onAbstractClass: + properties: + dummy: + type: "string" + required: + - "dummy" + type: "object" + x-kubernetes-validations: + - rule: "self.dummy.startsWith('abstract-')" + onAttributeAndClass: + properties: + dummy: + type: "string" + required: + - "dummy" + type: "object" + x-kubernetes-validations: + - rule: "self.dummy.startsWith('on-class-')" + - rule: "self.dummy.startsWith('on-attr-')" + onAttributeAndGetter: + type: "string" + x-kubernetes-validations: + - rule: "self.startsWith('start-')" + - rule: "self.endsWith('-end')" + onGetter: + type: "string" + x-kubernetes-validations: + - rule: "self.startsWith('on-getter-')" + priority: + enum: + - "high" + - "low" + - "medium" + type: "string" + x-kubernetes-validations: + - message: "cannot transition directly between 'low' and 'high'" + rule: "!(self == 'high' && oldSelf == 'low') && !(self == 'low'\ + \ && oldSelf == 'high')" + replicas: + type: "integer" + simple: + type: "string" + x-kubernetes-validations: + - rule: "self.startsWith('simple-')" + required: + - "deepLevel1" + - "maxReplicas" + - "minReplicas" + - "multiple" + - "namePrefix" + - "onAbstractClass" + - "onAttributeAndClass" + - "onAttributeAndGetter" + - "onGetter" + - "priority" + - "replicas" + - "simple" + type: "object" + x-kubernetes-validations: + - fieldPath: ".replicas" + rule: "self.minReplicas <= self.replicas && self.replicas <= self.maxReplicas" + - message: "replicas must be greater than or equal to minReplicas" + rule: "self.minReplicas <= self.replicas" + - message: "replicas must be smaller than or equal to maxReplicas" + rule: "self.replicas <= self.maxReplicas" + status: + properties: + availableReplicas: + type: "integer" + type: "object" + type: "object" + x-kubernetes-validations: + - messageExpression: "'name must start with ' + self.spec.namePrefix" + reason: "FieldValueForbidden" + rule: "self.metadata.name.startsWith(self.spec.namePrefix)" + - message: "updates not allowed in degraded state" + rule: "self.status.availableReplicas >= self.spec.minReplicas" + served: true + storage: true + subresources: + status: {} diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.k8svalidations.samples.fabric8.io.v1beta1.approved.txt b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.k8svalidations.samples.fabric8.io.v1beta1.approved.txt deleted file mode 100644 index 64e2731f98e..00000000000 --- a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.k8svalidations.samples.fabric8.io.v1beta1.approved.txt +++ /dev/null @@ -1,145 +0,0 @@ -# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: k8svalidations.samples.fabric8.io -spec: - group: samples.fabric8.io - names: - kind: K8sValidation - plural: k8svalidations - singular: k8svalidation - scope: Cluster - subresources: - status: {} - validation: - openAPIV3Schema: - properties: - spec: - properties: - deepLevel1: - properties: - deepLevel2: - properties: - simple: - type: string - x-kubernetes-validations: - - rule: self.startsWith('deep-') - valueL2: - type: string - required: - - valueL2 - type: object - valueL1: - type: string - required: - - deepLevel2 - - valueL1 - type: object - x-kubernetes-validations: - - messageExpression: '''valueL1 ('' + self.valueL1 + '') must be equal - to deepLevel2.valueL2 ('' + self.deepLevel2.valueL2 + '')''' - rule: self.valueL1 == self.deepLevel2.valueL2 - immutable: - type: string - x-kubernetes-validations: - - message: cannot be changed once set - rule: self == oldSelf - maxReplicas: - type: integer - minReplicas: - type: integer - monotonicCounter: - type: integer - x-kubernetes-validations: - - message: cannot decrease value once set - reason: FieldValueForbidden - rule: self >= oldSelf - multiple: - type: string - x-kubernetes-validations: - - rule: self.startsWith('start-') - - rule: self.endsWith('-end') - namePrefix: - type: string - onAbstractClass: - properties: - dummy: - type: string - required: - - dummy - type: object - x-kubernetes-validations: - - rule: self.dummy.startsWith('abstract-') - onAttributeAndClass: - properties: - dummy: - type: string - required: - - dummy - type: object - x-kubernetes-validations: - - rule: self.dummy.startsWith('on-class-') - - rule: self.dummy.startsWith('on-attr-') - onAttributeAndGetter: - type: string - x-kubernetes-validations: - - rule: self.startsWith('start-') - - rule: self.endsWith('-end') - onGetter: - type: string - x-kubernetes-validations: - - rule: self.startsWith('on-getter-') - priority: - enum: - - high - - low - - medium - type: string - x-kubernetes-validations: - - message: cannot transition directly between 'low' and 'high' - rule: '!(self == ''high'' && oldSelf == ''low'') && !(self == ''low'' - && oldSelf == ''high'')' - replicas: - type: integer - simple: - type: string - x-kubernetes-validations: - - rule: self.startsWith('simple-') - required: - - deepLevel1 - - maxReplicas - - minReplicas - - multiple - - namePrefix - - onAbstractClass - - onAttributeAndClass - - onAttributeAndGetter - - onGetter - - priority - - replicas - - simple - type: object - x-kubernetes-validations: - - fieldPath: .replicas - rule: self.minReplicas <= self.replicas && self.replicas <= self.maxReplicas - - message: replicas must be greater than or equal to minReplicas - rule: self.minReplicas <= self.replicas - - message: replicas must be smaller than or equal to maxReplicas - rule: self.replicas <= self.maxReplicas - status: - properties: - availableReplicas: - type: integer - type: object - type: object - x-kubernetes-validations: - - messageExpression: '''name must start with '' + self.spec.namePrefix' - reason: FieldValueForbidden - rule: self.metadata.name.startsWith(self.spec.namePrefix) - - message: updates not allowed in degraded state - rule: self.status.availableReplicas >= self.spec.minReplicas - versions: - - name: v1alpha1 - served: true - storage: true diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.k8svalidations.samples.fabric8.io.v1beta1.approved.yml b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.k8svalidations.samples.fabric8.io.v1beta1.approved.yml new file mode 100644 index 00000000000..346cb1d28f5 --- /dev/null +++ b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.k8svalidations.samples.fabric8.io.v1beta1.approved.yml @@ -0,0 +1,145 @@ +# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! +apiVersion: "apiextensions.k8s.io/v1beta1" +kind: "CustomResourceDefinition" +metadata: + name: "k8svalidations.samples.fabric8.io" +spec: + group: "samples.fabric8.io" + names: + kind: "K8sValidation" + plural: "k8svalidations" + singular: "k8svalidation" + scope: "Cluster" + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + spec: + properties: + deepLevel1: + properties: + deepLevel2: + properties: + simple: + type: "string" + x-kubernetes-validations: + - rule: "self.startsWith('deep-')" + valueL2: + type: "string" + required: + - "valueL2" + type: "object" + valueL1: + type: "string" + required: + - "deepLevel2" + - "valueL1" + type: "object" + x-kubernetes-validations: + - messageExpression: "'valueL1 (' + self.valueL1 + ') must be equal\ + \ to deepLevel2.valueL2 (' + self.deepLevel2.valueL2 + ')'" + rule: "self.valueL1 == self.deepLevel2.valueL2" + immutable: + type: "string" + x-kubernetes-validations: + - message: "cannot be changed once set" + rule: "self == oldSelf" + maxReplicas: + type: "integer" + minReplicas: + type: "integer" + monotonicCounter: + type: "integer" + x-kubernetes-validations: + - message: "cannot decrease value once set" + reason: "FieldValueForbidden" + rule: "self >= oldSelf" + multiple: + type: "string" + x-kubernetes-validations: + - rule: "self.startsWith('start-')" + - rule: "self.endsWith('-end')" + namePrefix: + type: "string" + onAbstractClass: + properties: + dummy: + type: "string" + required: + - "dummy" + type: "object" + x-kubernetes-validations: + - rule: "self.dummy.startsWith('abstract-')" + onAttributeAndClass: + properties: + dummy: + type: "string" + required: + - "dummy" + type: "object" + x-kubernetes-validations: + - rule: "self.dummy.startsWith('on-class-')" + - rule: "self.dummy.startsWith('on-attr-')" + onAttributeAndGetter: + type: "string" + x-kubernetes-validations: + - rule: "self.startsWith('start-')" + - rule: "self.endsWith('-end')" + onGetter: + type: "string" + x-kubernetes-validations: + - rule: "self.startsWith('on-getter-')" + priority: + enum: + - "high" + - "low" + - "medium" + type: "string" + x-kubernetes-validations: + - message: "cannot transition directly between 'low' and 'high'" + rule: "!(self == 'high' && oldSelf == 'low') && !(self == 'low' &&\ + \ oldSelf == 'high')" + replicas: + type: "integer" + simple: + type: "string" + x-kubernetes-validations: + - rule: "self.startsWith('simple-')" + required: + - "deepLevel1" + - "maxReplicas" + - "minReplicas" + - "multiple" + - "namePrefix" + - "onAbstractClass" + - "onAttributeAndClass" + - "onAttributeAndGetter" + - "onGetter" + - "priority" + - "replicas" + - "simple" + type: "object" + x-kubernetes-validations: + - fieldPath: ".replicas" + rule: "self.minReplicas <= self.replicas && self.replicas <= self.maxReplicas" + - message: "replicas must be greater than or equal to minReplicas" + rule: "self.minReplicas <= self.replicas" + - message: "replicas must be smaller than or equal to maxReplicas" + rule: "self.replicas <= self.maxReplicas" + status: + properties: + availableReplicas: + type: "integer" + type: "object" + type: "object" + x-kubernetes-validations: + - messageExpression: "'name must start with ' + self.spec.namePrefix" + reason: "FieldValueForbidden" + rule: "self.metadata.name.startsWith(self.spec.namePrefix)" + - message: "updates not allowed in degraded state" + rule: "self.status.availableReplicas >= self.spec.minReplicas" + versions: + - name: "v1alpha1" + served: true + storage: true diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.multiples.sample.fabric8.io.v1.approved.txt b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.multiples.sample.fabric8.io.v1.approved.txt deleted file mode 100644 index b94afd65aed..00000000000 --- a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.multiples.sample.fabric8.io.v1.approved.txt +++ /dev/null @@ -1,42 +0,0 @@ -# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: multiples.sample.fabric8.io -spec: - group: sample.fabric8.io - names: - kind: Multiple - plural: multiples - singular: multiple - scope: Cluster - versions: - - name: v2 - schema: - openAPIV3Schema: - properties: - spec: - properties: - v2: - type: string - type: object - status: - type: object - type: object - served: true - storage: true - - deprecated: true - name: v1 - schema: - openAPIV3Schema: - properties: - spec: - properties: - v1: - type: string - type: object - status: - type: object - type: object - served: true - storage: false diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.multiples.sample.fabric8.io.v1.approved.yml b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.multiples.sample.fabric8.io.v1.approved.yml new file mode 100644 index 00000000000..0b263a3837e --- /dev/null +++ b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.multiples.sample.fabric8.io.v1.approved.yml @@ -0,0 +1,42 @@ +# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! +apiVersion: "apiextensions.k8s.io/v1" +kind: "CustomResourceDefinition" +metadata: + name: "multiples.sample.fabric8.io" +spec: + group: "sample.fabric8.io" + names: + kind: "Multiple" + plural: "multiples" + singular: "multiple" + scope: "Cluster" + versions: + - name: "v2" + schema: + openAPIV3Schema: + properties: + spec: + properties: + v2: + type: "string" + type: "object" + status: + type: "object" + type: "object" + served: true + storage: true + - deprecated: true + name: "v1" + schema: + openAPIV3Schema: + properties: + spec: + properties: + v1: + type: "string" + type: "object" + status: + type: "object" + type: "object" + served: true + storage: false diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.multiples.sample.fabric8.io.v1beta1.approved.txt b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.multiples.sample.fabric8.io.v1beta1.approved.txt deleted file mode 100644 index 496bc0f8362..00000000000 --- a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.multiples.sample.fabric8.io.v1beta1.approved.txt +++ /dev/null @@ -1,42 +0,0 @@ -# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: multiples.sample.fabric8.io -spec: - group: sample.fabric8.io - names: - kind: Multiple - plural: multiples - singular: multiple - scope: Cluster - versions: - - name: v2 - schema: - openAPIV3Schema: - properties: - spec: - properties: - v2: - type: string - type: object - status: - type: object - type: object - served: true - storage: true - - deprecated: true - name: v1 - schema: - openAPIV3Schema: - properties: - spec: - properties: - v1: - type: string - type: object - status: - type: object - type: object - served: true - storage: false diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.multiples.sample.fabric8.io.v1beta1.approved.yml b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.multiples.sample.fabric8.io.v1beta1.approved.yml new file mode 100644 index 00000000000..d92f571be94 --- /dev/null +++ b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.multiples.sample.fabric8.io.v1beta1.approved.yml @@ -0,0 +1,42 @@ +# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! +apiVersion: "apiextensions.k8s.io/v1beta1" +kind: "CustomResourceDefinition" +metadata: + name: "multiples.sample.fabric8.io" +spec: + group: "sample.fabric8.io" + names: + kind: "Multiple" + plural: "multiples" + singular: "multiple" + scope: "Cluster" + versions: + - name: "v2" + schema: + openAPIV3Schema: + properties: + spec: + properties: + v2: + type: "string" + type: "object" + status: + type: "object" + type: "object" + served: true + storage: true + - deprecated: true + name: "v1" + schema: + openAPIV3Schema: + properties: + spec: + properties: + v1: + type: "string" + type: "object" + status: + type: "object" + type: "object" + served: true + storage: false diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.nocyclics.sample.fabric8.io.v1.approved.txt b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.nocyclics.sample.fabric8.io.v1.approved.txt deleted file mode 100644 index 3d40aa4f5c6..00000000000 --- a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.nocyclics.sample.fabric8.io.v1.approved.txt +++ /dev/null @@ -1,51 +0,0 @@ -# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: nocyclics.sample.fabric8.io -spec: - group: sample.fabric8.io - names: - kind: NoCyclic - plural: nocyclics - singular: nocyclic - scope: Namespaced - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - properties: - spec: - properties: - ref1: - properties: - inner: - type: object - ref: - type: integer - type: object - ref2: - properties: - inner: - type: object - ref: - type: integer - type: object - type: object - status: - properties: - message: - type: string - ref1: - properties: - inner: - type: object - ref: - type: integer - type: object - type: object - type: object - served: true - storage: true - subresources: - status: {} \ No newline at end of file diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.nocyclics.sample.fabric8.io.v1.approved.yml b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.nocyclics.sample.fabric8.io.v1.approved.yml new file mode 100644 index 00000000000..f8073b28c61 --- /dev/null +++ b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.nocyclics.sample.fabric8.io.v1.approved.yml @@ -0,0 +1,51 @@ +# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! +apiVersion: "apiextensions.k8s.io/v1" +kind: "CustomResourceDefinition" +metadata: + name: "nocyclics.sample.fabric8.io" +spec: + group: "sample.fabric8.io" + names: + kind: "NoCyclic" + plural: "nocyclics" + singular: "nocyclic" + scope: "Namespaced" + versions: + - name: "v1alpha1" + schema: + openAPIV3Schema: + properties: + spec: + properties: + ref1: + properties: + inner: + type: "object" + ref: + type: "integer" + type: "object" + ref2: + properties: + inner: + type: "object" + ref: + type: "integer" + type: "object" + type: "object" + status: + properties: + message: + type: "string" + ref1: + properties: + inner: + type: "object" + ref: + type: "integer" + type: "object" + type: "object" + type: "object" + served: true + storage: true + subresources: + status: {} diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.nocyclics.sample.fabric8.io.v1beta1.approved.txt b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.nocyclics.sample.fabric8.io.v1beta1.approved.txt deleted file mode 100644 index 546f2ccd875..00000000000 --- a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.nocyclics.sample.fabric8.io.v1beta1.approved.txt +++ /dev/null @@ -1,51 +0,0 @@ -# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: nocyclics.sample.fabric8.io -spec: - group: sample.fabric8.io - names: - kind: NoCyclic - plural: nocyclics - singular: nocyclic - scope: Namespaced - subresources: - status: {} - validation: - openAPIV3Schema: - properties: - spec: - properties: - ref1: - properties: - inner: - type: object - ref: - type: integer - type: object - ref2: - properties: - inner: - type: object - ref: - type: integer - type: object - type: object - status: - properties: - message: - type: string - ref1: - properties: - inner: - type: object - ref: - type: integer - type: object - type: object - type: object - versions: - - name: v1alpha1 - served: true - storage: true \ No newline at end of file diff --git a/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.nocyclics.sample.fabric8.io.v1beta1.approved.yml b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.nocyclics.sample.fabric8.io.v1beta1.approved.yml new file mode 100644 index 00000000000..cbd4c216641 --- /dev/null +++ b/crd-generator/test/src/test/resources/io/fabric8/crd/generator/approvaltests/CRDGeneratorApprovalTest.approvalTest.nocyclics.sample.fabric8.io.v1beta1.approved.yml @@ -0,0 +1,51 @@ +# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! +apiVersion: "apiextensions.k8s.io/v1beta1" +kind: "CustomResourceDefinition" +metadata: + name: "nocyclics.sample.fabric8.io" +spec: + group: "sample.fabric8.io" + names: + kind: "NoCyclic" + plural: "nocyclics" + singular: "nocyclic" + scope: "Namespaced" + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + spec: + properties: + ref1: + properties: + inner: + type: "object" + ref: + type: "integer" + type: "object" + ref2: + properties: + inner: + type: "object" + ref: + type: "integer" + type: "object" + type: "object" + status: + properties: + message: + type: "string" + ref1: + properties: + inner: + type: "object" + ref: + type: "integer" + type: "object" + type: "object" + type: "object" + versions: + - name: "v1alpha1" + served: true + storage: true diff --git a/pom.xml b/pom.xml index 0b1b27c34e8..88fe17fae27 100644 --- a/pom.xml +++ b/pom.xml @@ -1255,7 +1255,7 @@ kubernetes-client/src/test/resources/mockito-extensions/* **/src/test/resources/ssl/* **/src/test/resources/io/fabric8/java/generator/approvals/*.*.approved.txt - crd-generator/**/src/test/resources/**/*.approved.txt + crd-generator/**/src/test/resources/**/*.approved.yml **/it/**/expected/**/*.expected Jenkinsfile .mvn/**/*