1.5 KiB
1.5 KiB
Model class naming conventions
- Status: Accepted
- Deciders: Marino, Zorica, Stefanija, Davide, Tomasz, Maciej
- Date: 20/09/2021
Context and Problem Statement
We would like to have well defined conventions when it comes to model class naming in all the application layers, for the sake of consistency.
Considered Options
For the API models:
xRequest/xResponse
andxResultResponse
, with an optionalxResultResponse
as a wrapper for the model, if needed, e.g.GetMessageRequest
,GetMessageResponse
andGetMessageResultResponse
(containsGetMessageResponse
),xRequest/xApiModel
andxResponse
as a wrapper for the model, if needed, e.g.GetMessageRequest
,GetMessageApiModel
andGetMessageResponse
(containsGetMessageApiModel
).
For the DB models:
xEntity
e.g.MessageEntity
,xDatabaseModel
e.g.MessageDatabaseModel
.
Decision Outcome
- The presentation layer models will use
UiModel
suffix, e.g.MessageUiModel
. - The domain layer models will have no suffix, e.g.
Message
. - The database models will have
Entity
suffix, e.g.MessageEntity
. - The API request models will have
Request
suffix, e.g.GetMessageRequest
. - The API response models will have
Response
suffix, e.g.GetMessageResponse
. - The API response wrapper models will have
ResultResponse
suffix, e.g.GetMessageResultResponse
.
Consequences
- All the new models declared in the application should follow the conventions defined above.