Api Management
Naming Conventions
Guidelines for naming conventions related to OAS contracts and data transfer objects (DTOs).
Rules
Contract Separation
Contracts for different gateways (e.g., Self-Care and PBA) must remain independent.
- No shared DTOs: Each gateway's contract is tailored to the specific requirements and maintenance needs of its applications.
- This ensures clarity, avoids unintended dependencies, and simplifies contract management.
Naming Conventions
DTO Suffixes
- Use specific suffixes to clearly define the purpose of data transfer objects (DTOs):
Request
/Response
: For top-level objects representing API request or response payloads.Dto
: For nested models within requests and responses.
Gateway-Specific Prefix
- For the PBA gateway, include the prefix
Pba
in the DTO name to distinguish it from DTOs used in other gateways.
Examples
Below are examples of DTO naming conventions:
GetCustomersRequest:
Count: int
GetCustomersResponse:
Customers: CustomerDto[]
CustomerDto:
FullName: string
Address: string
UpdateBlogPostPbaRequest:
Title: string
Content: string
BlogPostPbaDto:
Id: int
Title: string
Content: string
Author: string
Benefits
- Clarity: Ensures that DTOs are easily identifiable and their purpose is clear - mainly in C# code (and project layers).
- Maintainability: Independent contracts and distinct naming conventions simplify updates and reduce the risk of conflicts.
- Scalability: Enables tailored contracts for each gateway without cross-dependencies.