Conversation
b9987ed to
59810a8
Compare
edaf96e to
99c4786
Compare
ea6834b to
dacabf1
Compare
c018c8c to
ddb79e0
Compare
| @Transactional | ||
| public Entity createEntity(@Valid Entity entity) { | ||
| // Add validations | ||
| entityValidationService.checkTemplateExist(entity.templateIdentifier()); |
There was a problem hiding this comment.
update for entityValidationService.validateForCreate
| /// Check entity template existence to ensure valid template reference before deeper validations. | ||
| /// @param entity the entity whose template existence is to be checked | ||
| /// @throws EntityTemplateNotFoundException if the template referenced by the entity does not exist | ||
| void checkTemplateExist(final String entity) { |
There was a problem hiding this comment.
Remove this and use EntityTemplateValidation.validateIfExists i the EntityService
| } | ||
| } | ||
|
|
||
| private void validateEntityHeader(Entity entity, Violations violations) { |
There was a problem hiding this comment.
This is already validated using the annotations in the Entity record.
| /// Checks for existing entity with same template and identifier to prevent duplicates. | ||
| /// @param entity the entity to check for existence | ||
| /// @throws EntityAlreadyExistsException if an entity with the same template and identifier already exists | ||
| void checkEntityAlreadyExist(final Entity entity) { |
There was a problem hiding this comment.
| void checkEntityAlreadyExist(final Entity entity) { | |
| void validateUniqueness(final Entity entity) { |
| String value | ||
| String value, | ||
|
|
||
| Object rawValue |
There was a problem hiding this comment.
Lets's check if it we can get around without this parameter using only casting validation.
There was a problem hiding this comment.
I would prefer keeping the Property model limited to business-related information and handling validation via casting, even if certain cases—like a numeric string—might pass through.
| violations.addIfBlank(entity.identifier(), ENTITY_IDENTIFIER_MANDATORY); | ||
| } | ||
|
|
||
| private void validatePropertiesShape(List<Property> properties, Violations violations) { |
There was a problem hiding this comment.
Do we rally need this. Isn't performed also by the annotations?
|
| throw new EntityAlreadyExistsException(entity.templateIdentifier(), entity.identifier()); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Do we really need this validations?



PR Description
What this PR Provides
need #19 before
full post entity endpoint created
Update static swagger, and test containers
How to test
call GET /api/v1/entity-templates to get a template identifier
call POST /api/v1/entities/{template-identifier}
call
/api/v1/entity-templates?page=0&size=20&sort=identifier%2Casc' \
to get template list
get one without properties or relations
and one with rules defined on it
get entities from each :
data-pipeline
monitoring-service
try to create entity for each :
data-pipeline :
201 entity created
trying call get :
try to post same thing two time :
Call new one with relations from previous :
and get :
try on one with rules :
Breaking changes (if any)
Modify post entity and entity validation
add mock for local test
change unique constraint key on identifier =>
Context of the Breaking Change
For example: we redefined the component types list in the DPAC referential
Result of the Breaking Change
For example: your component of type xxx will migrate to the type yyy