You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/04/09 10:11:16 UTC

[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #345: feat: schema for apisixroute

gxthrj commented on a change in pull request #345:
URL: https://github.com/apache/apisix-ingress-controller/pull/345#discussion_r610509723



##########
File path: samples/deploy/crd/v1beta1/ApisixRoute.yaml
##########
@@ -35,3 +48,146 @@ spec:
     kind: ApisixRoute
     shortNames:
       - ar
+  preserveUnknownFields: true # we have to enable it since plugin config
+  validation:
+    openAPIV3Schema:
+      type: object
+      properties:
+        spec:
+          type: object
+          properties:
+            http:
+              type: array
+              minItems: 1
+              items:
+                type: object
+                oneOf:
+                  - required: ["name", "match", "backend"]
+                  - required: ["name", "match", "backends"]
+                properties:
+                  name:
+                    type: string
+                    minLength: 1
+                  priority:
+                    type: integer
+                  match:
+                    type: object
+                    required:
+                    - paths
+                    properties:
+                      paths:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^/" # start with "/"
+                      hosts:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^\\*?[0-9a-zA-Z-._]+$"

Review comment:
       ```suggestion
                             pattern: "(^\*?[a-zA-Z0-9._-]+$|^\*$)"
   ```

##########
File path: samples/deploy/crd/v1beta1/ApisixRoute.yaml
##########
@@ -35,3 +48,146 @@ spec:
     kind: ApisixRoute
     shortNames:
       - ar
+  preserveUnknownFields: true # we have to enable it since plugin config
+  validation:
+    openAPIV3Schema:
+      type: object
+      properties:
+        spec:
+          type: object
+          properties:
+            http:
+              type: array
+              minItems: 1
+              items:
+                type: object
+                oneOf:
+                  - required: ["name", "match", "backend"]
+                  - required: ["name", "match", "backends"]
+                properties:
+                  name:
+                    type: string
+                    minLength: 1
+                  priority:
+                    type: integer
+                  match:
+                    type: object
+                    required:
+                    - paths
+                    properties:
+                      paths:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^/" # start with "/"

Review comment:
       ```suggestion
                             pattern: "^\/[a-zA-Z0-9\-._~%!$&'()+,;=:@/]*\*?$"
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org