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

Derived JsonDecoder decodeJson vs fromJsonAST error inconsistency tests #765

Open
wants to merge 2 commits into
base: series/2.x
Choose a base branch
from

Conversation

andreisilviudragnea
Copy link

@andreisilviudragnea andreisilviudragnea commented Oct 20, 2022

JsonDecoder {
  final def decodeJson(str: CharSequence): Either[String, A]
  def fromJsonAST(json: Json): Either[String, A]
}
  • Derived JsonDecoders have different errors for:
    • missing fields when calling JsonDecoder.decodeJson (".b.c.v2(missing)") vs JsonDecoder.fromJsonAST ("Missing fields: v2, v3")
    • invalid types when calling JsonDecoder.decodeJson (".b.c.v1(expected '\"' got '1')") vs JsonDecoder.fromJsonAST ("Not a string value").
  • The errors reported by JsonDecoder.fromJsonAST seem to be broken because the JSON path to the error is missing from the messages: "Missing fields: v2, v3", "Not a string value".

Scala 3 derived decoders fail at runtime with StackOverflowError for now. This might be another bug.

@andreisilviudragnea andreisilviudragnea requested a review from a team as a code owner October 20, 2022 19:47
@CLAassistant
Copy link

CLAassistant commented Oct 20, 2022

CLA assistant check
All committers have signed the CLA.

@andreisilviudragnea andreisilviudragnea force-pushed the decodeJson-fromJsonAST-error-consistency branch from 15a8aa4 to 14ecac1 Compare October 24, 2022 15:10
@andreisilviudragnea
Copy link
Author

@fsvehla There seems to be a StackOverflowError problem when running the tests on Scala 3, but I am interested at the moment on the Scala 2 implementation.

Scala 3 decoder generation is different from Scala 2, so I think I might have found another bug or maybe the test is not written in the right file.

@andreisilviudragnea andreisilviudragnea changed the title Derived JsonDecoder decodeJson vs fromJsonAST error consistency Derived JsonDecoder decodeJson vs fromJsonAST error inconsistency tests Oct 24, 2022
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