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

      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)
      } 

            Unassigned Unassigned
            jschuler_kafka_devexp Joachim Schuler
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: