FAQ

  • GitHub GitHub Repo stars
  • Discord Discord Server
  • ✨ New! Try the OpenAPI Doctor ✨ The OpenAPI Doctor

    schema


    schema is a function that takes a JSON Schema definition, and validates that an object looked up via JSON Path matches that schema. If the object does not exist, the function will trigger a rule violation

    How do I use this function?

    This function is configured by the following functionOptions

    NAME TYPE REQUIRED? DESCRIPTION
    schema JSON Schema yes The schema you want to evaluate

    Example ruleset configuration

    openapi-tags:
      description: Global tags should exist, and be an array
      type: validation
      recommended: false
      given: "$"
      then:
        field: "tags"
        function: "schema"
        functionOptions:
          schema:
            type: "array"
            items:
              type: "object"
              minItems: 1
            uniqueItems: true
    

    View Spectral Equivalent


    View Function Source