Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://github.com/orgs/hanami/projects/6/views/1?pane=issue&itemId=70528802
This just adds a simple json conversion to struct attributes. Dumps to hash and then json.
I saw the issue description mentioned that it could also be moved to ROM or DRY gems, but I found two discussion that convinced me against it:
dry-rb/dry-struct#166 here Nikita said "Serializing to JSON is not part of the gem and I'm against mixing concerns in general." and in the ROM thread, there was a similar mention, by Piotr rom-rb/rom#403 "In general I would recommend encapsulating json serialization/deserialization with your own APIs, instead of referring to 3rd party gems"
So i thought its best not to nest this method too deep in those gems