You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG]: Generating Scala3 uPickle from JSON Schema is missing ReadWriter annotation for enums #2677
CLI, npm, or app.quicktype.io: CLI
Version: 23.0.170
Description
In the generated Scala3 output there is a missing ReadWriter annotation for the generated enum Color, which leads to a build failure while the uPickle macro is trying run:
No given instance of type ReadersVersionSpecific_this.Reader[
[error] | quicktype.Color] was found.
Triage sweep note (assisted by Claude): confirmed reproducible on current master (v23.3.0, 68ecb284).
Root cause: confirmed exactly as reported — output is enum Color : with no derives ReadWriter, while the corresponding case class correctly gets derives ReadWriter. UpickleRenderer (packages/quicktype-core/src/language/Scala3/UpickleRenderer.ts) only overrides emitClassDefinitionMethods; enum emission falls through to the base Scala3Renderer.emitEnumDefinition (Scala3Renderer.ts:298), which hardcodes ["enum ", name, " : "] with no hook for a derives clause. At runtime this fails with No given instance of type Reader[Color] since uPickle has no way to derive a Reader/Writer for the enum. CirceRenderer is unaffected because it fully overrides emitEnumDefinition itself.
Assessment: severity medium — only affects the non-default --framework upickle option, but for that framework any schema containing an enum produces code that fails to compile/run, with no workaround. Fix difficulty: easy — add an overridable hook in the base renderer (e.g. an enum-declaration-suffix method) and have UpickleRenderer emit derives ReadWriter through it, mirroring the class-side handling.
Activity
schani commentedon Jul 6, 2026
Triage sweep note (assisted by Claude): confirmed reproducible on current master (v23.3.0,
68ecb284).Root cause: confirmed exactly as reported — output is
enum Color :with noderives ReadWriter, while the corresponding case class correctly getsderives ReadWriter.UpickleRenderer(packages/quicktype-core/src/language/Scala3/UpickleRenderer.ts) only overridesemitClassDefinitionMethods; enum emission falls through to the baseScala3Renderer.emitEnumDefinition(Scala3Renderer.ts:298), which hardcodes["enum ", name, " : "]with no hook for aderivesclause. At runtime this fails withNo given instance of type Reader[Color]since uPickle has no way to derive aReader/Writerfor the enum.CirceRendereris unaffected because it fully overridesemitEnumDefinitionitself.Assessment: severity medium — only affects the non-default
--framework upickleoption, but for that framework any schema containing an enum produces code that fails to compile/run, with no workaround. Fix difficulty: easy — add an overridable hook in the base renderer (e.g. an enum-declaration-suffix method) and haveUpickleRendereremitderives ReadWriterthrough it, mirroring the class-side handling.Reproduction:
{ "$schema": "https://json-schema.org/draft/2019-09/schema", "definitions": { "Color" : { "type" : "string", "enum": ["Red", "Green", "Blue"] }, "Monster" : { "type" : "object", "properties" : { "name" : { "type" : "string" }, "color" : { "$ref" : "#/definitions/Color" } }, "required" : ["name", "color"], "additionalProperties" : false } }, "$ref" : "#/definitions/Monster" }Output:
(
enum Coloris missingderives ReadWriter, matching the issue's expected-vs-actual.)