FAQ

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

    oasCamelCaseProperties


    oasCamelCaseProperties examines all schemas in an OpenAPI 3.x specification to identify property names that don’t follow the configured naming convention. By default the function enforces camelCase, but you can override that using then.functionOptions.type.

    Supported canonical values are:

    • camel
    • snake
    • pascal
    • kebab
    • macro
    • cobol
    • flat
    • pascal-kebab

    Aliases such as snake_case, kebab-case, camelCase, and lowercase are also accepted.

    The function iterates through all schemas in the document ensuring no schema is checked twice through caching mechanisms.

    For each property that violates the configured rule, the function identifies the specific case type being used (snake_case, PascalCase, kebab-case, etc.) and reports the violation with a descriptive message.

    Example ruleset configuration

    camel-case-properties:
      description: "Schema property names should use camelCase format"
      type: "style"
      recommended: true
      severity: "warn"
      given: "$"
      resolved: true
      then:
        function: "oasCamelCaseProperties"
        functionOptions:
          type: camel
    

    Example using snake_case

    snake-case-properties:
      description: "Schema property names should use snake_case format"
      type: "style"
      severity: "warn"
      given: "$"
      resolved: true
      then:
        function: "oasCamelCaseProperties"
        functionOptions:
          type: snake
    

    The function is used by the camel-case-properties Rule


    View Function Source