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

Switch out uPickle for Circe in codegen #1486

Merged
merged 1 commit into from Apr 12, 2024

Conversation

astridej
Copy link
Contributor

As discussed in the Discord, this is a preliminary change for being able to support smithy-build.json as input configuration objects; parsing these in a future-proof way is relatively complicated and difficult to support in uPickle without hand-writing the entirety of the parsing logic. Since Circe is already used elsewhere in the project, we replace the uPickle with Circe, including the implementation of creating the smithy-build.json file from settings.

Note that the special requirement of merging two JSON files while concatenating and deduplicating their arrays is not supported out of the box by Circe's deepMerge and still has to be handled manually, but at least the concatenation part has an option issue ( circe/circe#271 )

PR Checklist (not all items are relevant to all PRs)

  • [βœ… ] Added unit-tests (for runtime code)
  • [🚫] Added bootstrapped code + smoke tests (when the rendering logic is modified)
  • [🚫] Added build-plugins integration tests (when reflection loading is required at codegen-time)
  • [🚫] Added alloy compliance tests (when simpleRestJson protocol behaviour is expanded/updated)
  • [🚫] Updated dynamic module to match generated-code behaviour
  • [🚫] Added documentation
  • [🚫] Updated changelog

This is a preliminary change for being able to support smithy-build.json as
input configuration objects; parsing these in a future-proof way is relatively
complicated and difficult to support in uPickle without hand-writing the entirety
of the parsing logic. Since Circe is already used elsewhere in the project, we
replace the uPickle with Circe, including the implementation of creating the
smithy-build.json file from settings.

Note that the special requirement of merging two JSON files while concatenating and
deduplicating their arrays is not supported out of the box by Circe's deepMerge
and still has to be handled manually (cf circe/circe#271)
@@ -30,17 +30,17 @@ final class SmithyBuildSpec extends munit.FunSuite {
assertEquals(
actual,
"""|{
| "version": "1.0",
| "imports": [
| "version" : "1.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

uPickle and Circe seem to have slightly different opinions on suitable JSON whitespace. I could also change the tests to do a whitespace-ignoring compare to avoid them breaking with changes like this, but how often do we expect to swap out the JSON parsing library? (Famous last words...)

@Baccata Baccata merged commit 189df10 into disneystreaming:series/0.18 Apr 12, 2024
11 checks passed
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