architecture-decision-record

Architecture Decision Record: snake_case v. camelCase for a REST API?

Decision: snake_case naming convention will be used for REST API endpoints

Status: Accepted

Context

In naming conventions for REST APIs, there are two popular formats: snake_case and camelCase. The snake_case format is where each word in the name is separated by underscores, whereas camelCase is where the first word of the name is in lower case, and the subsequent words have their first letter capitalized. This decision will determine which naming convention should be used for a REST API.

Decision Drivers

Decision

The snake_case naming convention will be used for REST API endpoints. This choice is driven by the following factors:

  1. Consistency: The project already uses snake_case naming convention for all endpoints, and it would be beneficial to maintain this convention to ensure consistency across the entire project.

  2. Readability and clarity: The snake_case convention is more readable and easier to understand. The underscores provide a clear separation between words, making it easier to parse and understand the meaning of the name.

  3. Alignment with industry best practices: The snake_case convention is widely used in the industry and is considered to be a best practice for REST APIs, making it a good choice for the project.

  4. Ease of implementation and maintenance: Keeping with the existing naming convention is easier to implement and maintain as all existing code and documentation would need to be updated if a new convention was chosen.

Consequences

There are potential consequences of this decision.

Overall, the decision to use snake_case naming convention for REST API endpoints results in a consistent, readable, and industry-standard approach while being easy to implement and maintain.

Credit: this page is generated by ChatGPT, then edited for clarity and format.