G
G
Ginevera2019-03-27 17:19:05
Validation
Ginevera, 2019-03-27 17:19:05

What is the best way to implement form validation in a microservices architecture when using Simfony?

Good day!
When unraveling a large monolith on Symfony 3.2, such a global question arose:
what to do with a single UI and a service responsible for a "very_separate_entity" in the case of form validation?
(And even more complex compound forms.)
For clarity, let's denote "a very_separate_entity", for example, "pies".
Problem:
1. There is a single UI that is responsible for displaying everything. (In the articles that I have read, they advocated a single UI, and this is categorically correct from the point of view of separating the presentation from everything)
2. There are "pies", the work with which is taken out in a separate microservice. (As long as there is only output, everything is fine.)
3. When working with forms in Symfony and microservices architecture, validation does not correctly split the code.
(According to the principle of microservices, all information must be transferred to the “pies” microservice for return, and it has entity and form classes for this, but to return data in case of a validation error, the monolith does not have the same entity and form classes that are used and for display.)
Options that came to my mind (all bad):
I. Duplicate entity and form classes for "pies" in the UI - and use them only for display.
II. Convert everything to html, and return it to the UI in this form. One piece or several.
III. Change requests for each sneeze. If you make services chatty enough, there is a solution.
To write microservice "pies" I use Symfony 4.2, which adds spice, so even duplication when choosing this option will be with reservations)
Thanks in advance to all who responded.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question