FAQ

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

    schemaTypeCheck


    schemaTypeCheck will check a schema to ensure that it has a valid type, and passes basic type validation.

    This function focuses on type validity and type-specific constraint checks. It no longer performs the advisory required versus properties check.

    If you want that behavior, enable requiredFieldsDefined separately. The built-in required-fields-defined rule is not part of the recommended ruleset.

    Example ruleset configuration

    oas-schema-check:
      description: "Check a schema passes a basic type and type validation check"
      type: "validation"
      recommended: true
      severity: "error"
      given: "$"
      then:
        function: "schemaTypeCheck"
    
    required-fields-defined:
      description: "Required schema fields should be declared in properties"
      type: "validation"
      recommended: false
      severity: "warn"
      given: "$"
      then:
        function: "requiredFieldsDefined"
    

    The function is used by the oas-schema-check Rule


    View Function Source