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

Poison.decode/1 invalid method signature. #149

Open
KamilLelonek opened this issue Nov 7, 2017 · 7 comments
Open

Poison.decode/1 invalid method signature. #149

KamilLelonek opened this issue Nov 7, 2017 · 7 comments

Comments

@KamilLelonek
Copy link

According to the documentation:

decode(iodata, options \\ [])
decode(iodata, Keyword.t) ::
  {:ok, Poison.Parser.t} |
  {:error, :invalid} |
  {:error, {:invalid, String.t}}

The invalid cases are either {:error, :invalid} or {:error, {:invalid, String.t}}.

However, have a look at this example:

iex(1)> Poison.decode "{"
{:error, :invalid, 1}

so we are getting {:error, :invalid, integer()}.

And that one:

iex(18)> Poison.decode "}"
{:error, {:invalid, "}", 0}}

which is basically: {:error, {:invalid, String.t(), integer()}}

Aren't docs up to date then?

@keyan
Copy link

keyan commented Dec 4, 2017

I am seeing the same issue on 3.0.0 and 3.1.0. Looks like it is due to this commit: 50f25b7

This is acceptable because of the major version bump, and surely would have been mentioned in the CHANGELOG if there was one.

However, this change was then removed: a4208a6#diff-574cf330de0ee486ba021c9eaa1f0e7bL42 so it seems that 4.0.0 will have the original 2.X behavior.

@KamilLelonek -- Can you verify the version you were using when conducting the above test?

Perhaps @devinus can explain the reasoning for the change and subsequent revert?

@KamilLelonek
Copy link
Author

From what I see, I was using 3.1.0 version when this issue occurred.

@alakra
Copy link
Contributor

alakra commented Apr 24, 2018

Bump.

@keyan
Copy link

keyan commented Apr 26, 2018

@alakra -- the conclusion above was that this issue appears to be limited to 3.0.0 and 3.0.1. Please include what version you are using and also try upgrading first.

@KamilLelonek
Copy link
Author

this issue appears to be limited to 3.0.0 and 3.0.1

Not really. I'm using 3.1.0.

@keyan
Copy link

keyan commented Apr 26, 2018

Yeah sorry, my mistake, the fix is only on master. And creating a new release would be a major version bump.

@Qqwy
Copy link

Qqwy commented Oct 8, 2018

So how is this going?

This kind of problem is the prime candidate to create a bugfix-release for 3.1.X that has updated documentation to match the actual behaviour that Poison has.

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

No branches or pull requests

4 participants