• Icon: Story Story
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • Core UI
    • None
    • OCMUI Core Sprint 259, OCMUI Core Sprint 260, OCMUI Core Sprint 261, OCMUI Core Sprint 262

      Validate the YAML, some example code using ajv:

       

      const Ajv = require('ajv');
      const addFormats = require('ajv-formats');
      const openApiSchema = require('./openapi/clusters_mgmt.v1.json');
      const example = require('./src/schema/example.json');
      
      try {
        const ajv = new Ajv({ strict: false, allErrors: true, verbose: true })
        addFormats(ajv)
      
        ajv.addSchema(openApiSchema, "API.yaml")
      
        const validate = ajv.validate({ "$ref": "API.yaml#/components/schemas/Cluster" }, example)
      
      
        console.log({
            valid: validate,
            error: ajv.errors,
            errorText: ajv.errorsText(),
        })
      }
      catch (error) {
        console.error(error.message)
      } 

              emingora Enrique Mingorance Cano
              jschuler_kafka_devexp Joachim Schuler
              Jason Loss Jason Loss
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: