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

Remove Poison as dependancy #28

Merged
merged 8 commits into from
Jan 25, 2021
Merged

Remove Poison as dependancy #28

merged 8 commits into from
Jan 25, 2021

Conversation

sigu
Copy link
Contributor

@sigu sigu commented Jan 18, 2021

Since we are allowing the user to choose either Poison or Jason as the decoding library, we can remove Poison as a dependency and allow the user to install an encoder of their preference

We also add eex into extra applications to remove elixir 1.11 warnings

lib/chartkick.ex Outdated
end

defp options_json(opts) when is_bitstring(opts) do
opts
end

defp json_serializer do
Application.get_env(:chartkick, :json_serializer) || Poison
Copy link
Owner

@buren buren Jan 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't Poison cause problems if the user doesn't include it as a dependency (since its been removed as a dependency from here)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch, that means that we have a couple of options:

Option 1:

We might need to throw back an error to the user if the json_serializer they have defined is not available?

Option 2:

We can instruct the user to install the serializer together with the chartkick dependancy.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm.. If we go with option 2 and the user forgets to install the serializer the error would be weird/confusing.

I'd option 1 since that would enable us to give the user a reasonable error message were we could ask them to install and configure a serializer properly.

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sure that is better user experience too. Let me try something out and push

@buren
Copy link
Owner

buren commented Jan 25, 2021

LGTM 👍 Merging this. Thanks a lot @sigu 🙌

Unrelated question
I noticed that mix.lock is committed (already present since before this PR). I guess that mix.lock should be removed since this is a dependency rather than a project on its own?

@buren buren merged commit 37361a1 into buren:master Jan 25, 2021
@buren
Copy link
Owner

buren commented Jan 26, 2021

One thing I just realized is that this change isn't backwards compatible 🤔 In previous versions this would add Poison as a dependency to encode options and now it doesn't, so users would need to configure the JSON serializer.

I will update the CHANGELOG and do a new release. Probably best to release a v1.0..

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

Successfully merging this pull request may close these issues.

None yet

2 participants