capactio / capact

Simple way to manage applications and infrastructure.
https://capact.io
Apache License 2.0
80 stars 19 forks source link

Add Interface inlined JSONSchema validator #550

Closed mszostok closed 2 years ago

mszostok commented 2 years ago

Description

Changes proposed in this pull request:

Testing

Implemented logic is covered with unit-test. To test it locally, run:

  1. Checkout this branch and build CLI:

    gh pr checkout -R capactio/capact 550
    make build-tool-cli
  2. Clone hub-manifests repo:

    gh repo clone capactio/hub-manifests
  3. Execute manifest validate (without server-side):

    capact manifest validate {HUB_MANIFEST_REPO_PATH}/manifests/**/*.yaml
  4. Introduce error in Interface JSONSchema:

    Change in /manifests/interface/capactio/capact/validation/action/update.yaml property type to e.g. hakuna-matata instead of string.

  5. Execute validate once again:

    capact manifest validate {HUB_MANIFEST_REPO_PATH}/manifests/**/*.yaml
    Validating files in 5 concurrent jobs...
    - ✗ "./manifests/interface/capactio/capact/validation/action/update.yaml":
        * InterfaceValidator: properties.testString.type: Must validate at least one schema (anyOf)
        * InterfaceValidator: properties.testString.type: properties.testString.type must be one of the following: "array", "boolean", "integer", "null", "number", "object", "string"
    
    Validated 162 files in total.
    Error: detected 2 validation errors

Related issue(s)