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

decode!/2 has invalid type signature for options #199

Closed
DaniruKun opened this issue Oct 9, 2021 · 0 comments · Fixed by #202
Closed

decode!/2 has invalid type signature for options #199

DaniruKun opened this issue Oct 9, 2021 · 0 comments · Fixed by #202

Comments

@DaniruKun
Copy link

DaniruKun commented Oct 9, 2021

Description

The usage example of decode!/2 with the as option does not match the actual type spec, causing dialyzer to complain.

Steps to reproduce

  1. Create 2 functions in an Elixir module:
  def example do
	body = "some data"
	Poison.decode!(body, as: [%Video{}])
  end

  def example2 do
	body = "some data"
	Poison.decode!(body, %{as: [%Video{}]})
  end
  1. Run dialyzer, it will fail with:
Function example/0 has no local return.
________________________________________________________________________________
lib/api/videos.ex:68:call
The function call will not succeed.


breaks the contract
(iodata(), Poison.Decoder.options()) :: Poison.Decoder.t() | no_return()

As you can see, example2 is valid, while example is not.

devinus added a commit that referenced this issue Jun 9, 2024
Features:

* Support Erlang 27 and Elixir 1.17
* Reintroduce `Poison.encode_to_iodata!/1` for Phoenix compatibility
* Make `:html_safe` encode option follow OWASP recommended HTML
  escaping
* Added `Date.Range` encoding
* Allow `:as` decode option to be a function
* Added a CHANGELOG

Bug Fixes:

* Stop double decoding structs
* Fix various typespecs
* Correctly encode some UTF-8 surrogate pairs

Performance Improvements:

* Significantly improved performance

Breaking Changes:

* Removed deprecated `HashSet` encoding
* Minimum supported versions are now Erlang 24 and Elixir 1.12

Closes #105, #172, #191, #194, #199, #206, #207, #214, #217, #222.
devinus added a commit that referenced this issue Jun 9, 2024
Features:

* Support Erlang 27 and Elixir 1.17
* Reintroduce `Poison.encode_to_iodata!/1` for Phoenix compatibility
* Make `:html_safe` encode option follow OWASP recommended HTML
  escaping
* Add `Date.Range` encoding
* Allow `:as` decode option to be a function
* Add a CHANGELOG

Bug Fixes:

* Stop double decoding structs
* Fix various typespecs
* Correctly encode some UTF-8 surrogate pairs

Performance Improvements:

* Significantly improve performance

Breaking Changes:

* Remove deprecated `HashSet` encoding
* Minimum supported versions are now Erlang 24 and Elixir 1.12

Closes #105, #172, #191, #194, #199, #206, #207, #214, #217, #222.
devinus added a commit that referenced this issue Jun 9, 2024
Features:

* Support Erlang 27 and Elixir 1.17
* Reintroduce `Poison.encode_to_iodata!/1` for Phoenix compatibility
* Make `:html_safe` encode option follow OWASP recommended HTML
  escaping
* Add `Date.Range` encoding
* Allow `:as` decode option to be a function
* Add a CHANGELOG

Bug Fixes:

* Stop double decoding structs
* Fix various typespecs
* Correctly encode some UTF-8 surrogate pairs

Performance Improvements:

* Significantly improve performance

Breaking Changes:

* Remove deprecated `HashSet` encoding
* Minimum supported versions are now Erlang 24 and Elixir 1.12

Closes #105, #172, #191, #194, #199, #206, #207, #214, #217, #222.
devinus added a commit that referenced this issue Jun 9, 2024
Features:

* Support Erlang 27 and Elixir 1.17
* Reintroduce `Poison.encode_to_iodata!/1` for Phoenix compatibility
* Make `:html_safe` encode option follow OWASP recommended HTML
  escaping
* Add `Date.Range` encoding
* Allow `:as` decode option to be a function
* Add a CHANGELOG

Bug Fixes:

* Stop double decoding structs
* Fix various typespecs
* Correctly encode some UTF-8 surrogate pairs

Performance Improvements:

* Significantly improve performance

Breaking Changes:

* Remove deprecated `HashSet` encoding
* Minimum supported versions are now Erlang 24 and Elixir 1.12

Closes #105, #172, #191, #194, #199, #206, #207, #214, #217, #222.
devinus added a commit that referenced this issue Jun 9, 2024
Features:

* Support Erlang 27 and Elixir 1.17
* Reintroduce `Poison.encode_to_iodata!/1` for Phoenix compatibility
* Make `:html_safe` encode option follow OWASP recommended HTML
  escaping
* Add `Date.Range` encoding
* Allow `:as` decode option to be a function
* Add a CHANGELOG

Bug Fixes:

* Stop double decoding structs
* Fix various typespecs
* Correctly encode some UTF-8 surrogate pairs

Performance Improvements:

* Significantly improve performance

Breaking Changes:

* Remove deprecated `HashSet` encoding
* Minimum supported versions are now Erlang 24 and Elixir 1.12

Closes #105, #172, #191, #194, #199, #206, #207, #214, #217, #222.
devinus added a commit that referenced this issue Jun 9, 2024
Features:

* Support Erlang 27 and Elixir 1.17
* Reintroduce `Poison.encode_to_iodata!/1` for Phoenix compatibility
* Make `:html_safe` encode option follow OWASP recommended HTML
  escaping
* Add `Date.Range` encoding
* Allow `:as` decode option to be a function
* Add a CHANGELOG

Bug Fixes:

* Stop double decoding structs
* Fix various typespecs
* Correctly encode some UTF-8 surrogate pairs

Performance Improvements:

* Significantly improve performance

Breaking Changes:

* Remove deprecated `HashSet` encoding
* Minimum supported versions are now Erlang 24 and Elixir 1.12

Closes #105, #172, #191, #194, #199, #206, #207, #214, #217, #222.
devinus added a commit that referenced this issue Jun 9, 2024
Features:

* Support Erlang 27 and Elixir 1.17
* Reintroduce `Poison.encode_to_iodata!/1` for Phoenix compatibility
* Make `:html_safe` encode option follow OWASP recommended HTML
  escaping
* Add `Date.Range` encoding
* Allow `:as` decode option to be a function
* Add a CHANGELOG

Bug Fixes:

* Stop double decoding structs
* Fix various typespecs
* Correctly encode some UTF-8 surrogate pairs

Performance Improvements:

* Significantly improve performance

Breaking Changes:

* Remove deprecated `HashSet` encoding
* Minimum supported versions are now Erlang 24 and Elixir 1.12

Closes #105, #172, #191, #194, #199, #206, #207, #214, #217, #222.
devinus added a commit that referenced this issue Jun 9, 2024
Features:

* Support Erlang 27 and Elixir 1.17
* Reintroduce `Poison.encode_to_iodata!/1` for Phoenix compatibility
* Make `:html_safe` encode option follow OWASP recommended HTML
  escaping
* Add `Date.Range` encoding
* Allow `:as` decode option to be a function
* Add a CHANGELOG

Bug Fixes:

* Stop double decoding structs
* Fix various typespecs
* Correctly encode some UTF-8 surrogate pairs

Performance Improvements:

* Significantly improve performance

Breaking Changes:

* Remove deprecated `HashSet` encoding
* Minimum supported versions are now Erlang 24 and Elixir 1.12

Closes #105, #172, #191, #194, #199, #206, #207, #214, #217, #222.
devinus added a commit that referenced this issue Jun 9, 2024
Features:

* Support Erlang 27 and Elixir 1.17
* Reintroduce `Poison.encode_to_iodata!/1` for Phoenix compatibility
* Make `:html_safe` encode option follow OWASP recommended HTML
  escaping
* Add `Date.Range` encoding
* Allow `:as` decode option to be a function
* Add a CHANGELOG

Bug Fixes:

* Stop double decoding structs
* Fix various typespecs
* Correctly encode some UTF-8 surrogate pairs

Performance Improvements:

* Significantly improve performance

Breaking Changes:

* Remove deprecated `HashSet` encoding
* Minimum supported versions are now Erlang 24 and Elixir 1.12

Closes #105, #172, #191, #194, #199, #206, #207, #214, #217, #222.
This was referenced Jun 9, 2024
@devinus devinus reopened this Jun 9, 2024
@devinus devinus closed this as completed Jun 9, 2024
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 a pull request may close this issue.

2 participants