kubeshop / kusk-gateway

Kusk-gateway is an OpenAPI-driven API Gateway for Kubernetes
https://kubeshop.github.io/kusk-gateway/
MIT License
260 stars 21 forks source link

Validation check order #900

Closed jasmingacic closed 1 year ago

jasmingacic commented 1 year ago

So this fix focuses on order of checks performed when validating.

So for example we were checking everything even when some where mutually exclusive. Previously we'd check for upstream even when the Path was already disabled.

Sample API I used for testing:

openapi: 3.0.0
servers:
  - url: http://localhost:8080
info:
  title: simple-api
  version: 0.1.0
  description: A simple API example to test Kusk Gateway with
  license:
    name: MIT
    url: https://github.com/kubeshop/kusk-gateway/blob/main/LICENSE
paths:
  /hello:
    x-kusk:
      disabled: true
      upstream:
        service:
          name: hello-world-svc
          namespace: default
          port: 8080
      # mocking:
      #   enabled: true
      # redirect:
      #   scheme_redirect: https
      #   host_redirect: thenewhost.com
      #   response_code: 302
    get:     
      summary: Returns a Hello world to the user
      responses:
        '200':
          description: A simple hello world!
          content:
            application/json; charset=utf-8:
              schema:
                type: object
                properties:
                  message:
                    type: string
                required:
                  - message

Signed-off-by: jasmingacic jasmin.gacic@gmail.com

netlify[bot] commented 1 year ago

Deploy Preview for kusk-docs-preview canceled.

Name Link
Latest commit d2c64b2a134c366c399d26931c7283e194de842d
Latest deploy log https://app.netlify.com/sites/kusk-docs-preview/deploys/635166dd7df5d9000943531c