require custom jsoniter json type to be provided#24
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR requires users to provide a custom JSON type reference when using the Jsoniter codec, addressing a limitation where Jsoniter doesn't provide a built-in type for raw JSON values. The change makes the JSON type configuration explicit and mandatory for Jsoniter users.
- Modified the
JsonCodec.Jsoniterenum case to require ajsonTypeRefparameter - Added CLI validation to enforce the
-jsoniter-json-typeparameter when using Jsoniter - Removed auto-generated codec logic in favor of requiring user-provided custom JSON types
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
modules/core/shared/src/main/scala/codegen.scala |
Modified JsonCodec.Jsoniter to accept a jsonTypeRef parameter, removed common codec generation logic, and updated code generation to use the custom JSON type reference |
modules/cli/src/main/scala/cli.scala |
Updated argument parsing to require -jsoniter-json-type when using Jsoniter codec, modified argument processing to preserve case sensitivity for values |
modules/example-jsoniter-json/shared/src/main/scala/json.scala |
Added example implementation of a custom Jsoniter JSON type using an opaque type wrapper around Array[Byte] |
build.sbt |
Added new exampleJsoniterJson project, updated jsoniter-scala version to 2.38.8, and configured test projects to depend on the example JSON implementation when using Jsoniter |
README.md |
Updated documentation with example of custom Jsoniter JSON type, added new -jsoniter-json-type configuration parameter, and updated dependency versions |
test_gen.sh |
Added -jsoniter-json-type parameter to test generation script and changed array type to ziochunk |
example/generate.scala |
Updated Scala version to 3.7.4, updated codegen dependency version to 0.0.12, and switched JSON codec from Jsoniter to ZioJson |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.