Several examples of customization were seen in the guide
but, what are the cases in which it is possible, or needed, create a new API?
Remember: in general, whenever you make important changes to the default behavior, it is best to use a new API.
Basically, the legacy behavior has been significantly changed and it is no longer formally correct to associate it with the same API.
In the customization examples seen so far we can say that:
-
Add step before or after default elaboration → if changes are very impactful it is recommended to switch to a new custom API
-
Remove default step → as above, since the removal of a step impacts legacy behavior, it is recommended to switch to a new custom API
-
Make a field optional → in this case it is mandatory to switch to a new custom API as a new DTO must be created to pass as input to the API
Are there other cases in which it is right to switch to a new custom API?
Absolutely yes!
Don’t forget the possibility of creating an API that combines the logics of multiple existing components, creating a completely new custom logic.
This is the concept of Component Reusability: it is based on the concatenation of N default logics that combined together create a new and complex use case.