Could we be consistent naming fields of Entities? #428
carlosthe19916
started this conversation in
General
Replies: 1 comment 1 reply
-
Judging by the URLs I would say you get What worries me a bit is the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
GET /api/v1/package
then I get:GET /api/v1/sbom/{key}/packages
I get:Both endpoints are supposed to give me PACKAGES yet both endpoints are not returning the same data (DTO structure)
An
A
DTO model should have the exact same fields everywhere it appears.If we call something
A
, thenA
should have the same fields everywhere. If not, perhaps we should make a distinction in naming entities and instead ofA
, we needA
andB
for naming entities.If we were modeling a
Person
DTO that hasname
,surname
. Then I expect aPerson
to have exactly those fields everywhere regardless of where it comes from. It is hard to deal with situations where if i hit an endpoint the person hasname
andsurname
and if I hit another different endpoint the person hasfirstname
,secondname
.In the case of the packages above. If you think that technically it is correct to return different bodies for packages endpoints then I think we should reconsider our naming and instead of
GET /api/v1/package
andGET /api/v1/sbom/{key}/packages
we have something likeGET /api/v1/purls
andGET /api/v1/sbom/{key}/package-names
. My point is, we can not call 2 things with the same name, and have different DTOs for the same thingBeta Was this translation helpful? Give feedback.
All reactions