Skip to content

Conversation

zoedsoupe
Copy link
Member

Problem

We've introduced the json_library config option but only applied it to the main library (this one)

Trying to override on the other ones, it got shown that we need a compile-time value since other libraries - like storage-ex derives the Encoder protocol for structs, so a runtime value can't be used

Solution

Transform the option on compile-time, so users need to set it on config.exs exactly like the phoenix library does (although it may fetch fom runtime too)

Rationale

@zoedsoupe
Copy link
Member Author

with that one i can ship the usage of this option across the rest of libraries

@zoedsoupe
Copy link
Member Author

i also tried to respect the standardized api for Encoder protocol across the 3 main encoding libraries: Jason, Poison and the new 1.18 native JSON module

Copy link
Contributor

@Ziinc Ziinc left a comment

Choose a reason for hiding this comment

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

I think we can keep it compile time for now after some thought, quite a minor thing.
Might be worthwhile to add to docs to point out that it is compile time only.

@zoedsoupe zoedsoupe merged commit 0c94303 into main Sep 30, 2025
24 checks passed
@zoedsoupe zoedsoupe deleted the fix/json-library-opt branch September 30, 2025 20:31
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.

2 participants