Decoupled, my friends...it is the way of the future. Everyone wants it. Everyone needs it. There are many contrib (and core) modules that support it. Lightning should take advantage of this.
I propose to add a new feature to Lightning, as a module that is installed by default. This feature will bring in the OpenAPI and JSON API modules (and whatever else is needed to support those) and expose all viewable content entities as JSON, in parallel with normal HTML rendering. Ideally we would also include some support for OAuth-based authentication against this API-first layer.
I'm opening this issue mostly as a placeholder, but also as a spot for people to +1, -1, debate, ask, and generally bikeshed on this.
Comments
Comment #2
gustavo.marcante commentedThis would be great!
There is a nice work being made with Reservoir and Contenta, and joining forces would be interesting.
In my point of view, would be interesting to consider not just JSON API, but also GraphQL as an option, that had alpha Drupal module launched yesterday.
Comment #3
balsamaI fully support this and agree with everything in the IS.
Ultimately, if Lightning is to be viewed as a viable solution for decoupled apps, it will need quite a bit stripped out of the UI including HTML rendering. Obviously, Lightning can't enable something like that out of the box since it's primary goal as a traditional Drupal distribution haven't changed. So that functionality would need to live elsewhere. Two main questions:
If it's a stand-alone module, many sub-profiles could just build off Lightning and require it. If it's a sub-profile itself, then other sub-profiles could just inherit that - which would make Lightning their grandparent profile instead of parent. Or applications could just build off of the profile itselft - which is already common practice. I think I'm leaning towards the latter since it takes advantage of the existing architecture and we can rely on implementors having the same structure. Something like this:
To be clear, I'm suggesting this issue is concerned with "API" listed under Lightning.
Comment #4
e0ipsoNice! The more people using the software the better it will become.
However it sounds like quite some duplication of efforts. Have you considered integrating / collaborating with the distributions that Gustavo mentions?
Comment #5
phenaproximaPull request created: https://github.com/acquia/lightning/pull/412
Comment #7
balsamaRTBC and committed based on feedback here: https://github.com/acquia/lightning/pull/412
Thanks!
Comment #8
balsama@e0ipso yes! Super excited about this. We're working with the reservoir folks to see where we can collaborate. Much of this patch was adapted from their code.
This issue in particular doesn't really overlap with the focus of Contenta. Right now, we just want to allow people to interact with the entities in Lightning using a standard JSON-based API ...provided largely by you - thanks! :)