Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pluggable JSON library? #125

Open
orestis opened this issue Apr 2, 2022 · 1 comment
Open

Pluggable JSON library? #125

orestis opened this issue Apr 2, 2022 · 1 comment

Comments

@orestis
Copy link

orestis commented Apr 2, 2022

I was investigating various JSON parsers in use in our app code, and I realised lacinia-pedestal hard-codes Cheshire in two places: parsing incoming requests (query, vars) and encoding outgoing responses. Obviously I can replace those interceptors with my own version, but since the Cheshire namespaces are still required, they still need to be present in the class path.

(Lacinia core does the same with data.json for the introspection part).

Would it make sense to have a protocol that applications can implement? Or perhaps use some other load-time machinery to load a particular json library? It would be nice to have a single dependency in a codebase.

@hlship
Copy link
Member

hlship commented Apr 15, 2022

I'm open to this and, yes, we don't actually use cheshire in production at Walmart so coming up with a pluggable way to replace it would be fine. I suspect a simple protocol for a JSON Driver, and a default implementation that uses Cheshire, but does it in a way (using explicit calls to requiring-resolve) that allows Cheshire to be an optional dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants