proophsoftware / event-machine-skeleton

Dockerized skeleton for prooph software Event Machine
https://proophsoftware.github.io/event-machine/
BSD 3-Clause "New" or "Revised" License
33 stars 4 forks source link

Why GraphQL was replaced with Swagger UI? #19

Open akondas opened 5 years ago

akondas commented 5 years ago

(from pure curiosity)

codeliner commented 5 years ago

Here is the corresponding release with information in linked PRs: https://github.com/proophsoftware/event-machine/releases/tag/v0.14.0

in short: GraphQL does not include format validation, so JSON Schema was always main target. GraphQL has a nice Dev UI and I was curious if GraphQL and JSON Schema can be combined. It worked somehow, but always felt wrong. It wasn't possible to use all available JSON Schema features nor all GraphQL features due to mapping limitations.

@camuthig Started to experiment with Swagger UI integration so we were able to remove GraphQL but still have a tool to interact with the backend without much effort.

Message and type schema definition is much simpler now. We don't need to differentiate between Input types and response types (like required by GraphQL). Nested objects can be defined without explicit types. AnyOf, OneOf definitions can be used and so on.

That said, if one wants to use GraphQL, recommendation is to put a GraphQL layer in front of Event Machine (same for REST API). Another option is to use GraphQL for read access and don't implement Queries + Finders/Resolvers in Event Machine. Read and Write can be separated thanks to CQRS.

akondas commented 5 years ago

Thanks for your comprehensive answer. I wonder if it is not worth keeping a kind of decision log (similar to changelog) for such decisions ... :thinking:

codeliner commented 5 years ago

That's basically a good idea. I always try to link related issues in releases. GraphQL was dropped in the experimentation phase. I thought we had a discussion somewhere in an issue but seems to be that it was discussed in the prooph chat.

We're still experimenting but get closer to a stable feature set and have some important news waiting to be published ;)

Event Machine v1.0 is only a milestone to give existing projects a stable base, but we're heading towards v2.0 with an optimized Event Machine core.