Description
Problem
Akka stub servers, and more generally scala stubs, can rely on a multitude of Json parsers.
Two approaches are therefore possible when generating projects via openapi: either choose one, or let the user choose his own, by just providing an interface (which is the case in scala-akka-http-server).
Each solution has its advantages and disadvantages.
Choosing for the user will often mean having unnecessary dependencies (why have spray-json when I already have jackson?).
On the other hand, having a totally generic stub leads to generate files that are not directly usable. A whole layer of serialization has to be added by the user, which makes the use of the akka-http module more complex.
Proposal 1
No change in current behavior.
Users of scala-akka-http have to guess how to use the generated code.
Pros:
- nothing to do
Cons:
- the module seems unusable at first.
Proposal 2
We generate code with a predefined Json dependency.
Pros :
- the generated code is ready to use
- the tedious task of proposing a marshaller / unmarshaller for each class or model is now done by the generator
Cons:
- the chosen library will not be suitable for everyone
Proposal 3
We generate the same code as now, but with an option to generate marshallers.
This option could allow to specify the json backend to use, free afterwards to make PR to add the backend of his choice.
Pros:
- the best of both worlds: code that can compile out of the box, and the possibility to choose your json backend
Cons:
- the mustache template will become very complex if it has to contain the generation of marshallers for all existing backends
Conclusion
As a commiter and user of this generator, I would like it to be as useful to others as it is to me, so I am willing to modify it to best fit the expectations and policy of the project.
Looking forward to reading your feedbacks, comments, desires, criticisms, thank you!