FAQ

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

    camel-case-properties


    Formats: Severity:

    Schema property names should use camelCase for consistency and better compatibility with code generation tools. Property names should start with a lowercase letter and use uppercase letters for word boundaries, avoiding underscores, hyphens, and other special characters.

    camelCase is preferred for JSON Objects in requests and responses, both personally and professionally. It’s the most compatible mechanism for accessing JavasScript objects where other cases fail, for example kebab-case will break using dot notation on a JS object.

    • Kebabs: person.first-name <– this will not work.
    • Camels: person.firstName <– lovely stuff.

    Google JSON Style Guide:

    Property names must be camel-cased, ascii strings.

    Crockford:

    Most variables and functions should start with a lower case letter. Names should be formed from the 26 upper and lower case letters (A .. Z, a .. z), the 10 digits (0 .. 9)

    Schema.org

    Properties start with a lower case letter and are also camelCase

    FYI: camelCase naming starts with a lowercase letter and stays all lowercase, do not add any space characters until the next letter of the next work in the name is added, which then becomes capitalized.

    So for example, something called:

    a nice big blue ball

    becomes aNiceBigBlueBall


    This rule helps ensure consistent property naming across your API specification, making it more predictable for developers and code generators.

    Why did this violation appear?

    Your schema contains property names that don’t follow camelCase convention. Common violations include snake_case, PascalCase, kebab-case, SCREAMING_SNAKE_CASE, and other naming patterns.

    What is this rule checking for?

    The rule examines all schemas in OpenAPI 3.x specifications and identifies property names that are not in camelCase format:

    • Properties starting with uppercase letters (PascalCase)
    • Properties using underscores (snake_case)
    • Properties using hyphens (kebab-case)
    • Properties in all uppercase (SCREAMING_CASE)
    • Any other non-camelCase naming patterns

    Bad example

    components:
      schemas:
        User:
          type: object
          properties:
            snake_case:  
              type: string
            PascalCase: 
              type: string
            kebab-case:
              type: string
            SCREAMING_SNAKE_CASE:
              type: string
            SCREAMING-KEBAB-CASE:
              type: string
    

    Good Example

    components:
      schemas:
        User:
          type: object
          properties:
            firstName:          
              type: string
            lastName:          
              type: string
            emailAddress:      
              type: string
            phoneNumber:       
              type: string
            userId:             
              type: string
            id:                 
              type: string
            age:                
              type: integer
    

    How do I fix this violation?

    Rename your schema properties to use camelCase format:

    • Start with lowercase letter: The first character should always be lowercase
    • Use uppercase for word boundaries: Capitalize the first letter of subsequent words
    • Remove special characters: No underscores, hyphens, or other separators
    • Keep single words lowercase: Simple properties like id, name, age are perfectly valid

    Benefits of camelCase:

    • Consistency: Standard convention in many programming languages (JavaScript, Java, C#)
    • Code Generation: Most OpenAPI code generators expect camelCase properties
    • JSON Standard: Matches JavaScript object property naming conventions
    • Readability: Clear word boundaries without special characters