Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

CirceCursor.asLeaf incorrectly validates primitive json values

Open Beginner friendly
#955 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
scala
Domain
api

Research direction

Start at CirceCursor.asLeaf and use the linked Scastie reproduction to observe how a primitive JSON value is handled for a String! field. The issue is done when primitive values are validated against the declared field type rather than returned as valid output, while the reproduction continues to behave correctly.

Written by the indexing model from the issue text.

Description

bug

Case branch for custom scalars, added in https://github.com/typelevel/grackle/commit/2ccc7e175b01dac83ac6fdbefe710fa3794fc99a, broke validation of primitive values against field type

Reproduction

https://scastie.scala-lang.org/ztqartpFRD2mliztvGixpQ

import cats.effect.SyncIO
import grackle.Schema
import grackle.circe.CirceMapping
import grackle.syntax._

object Repro extends CirceMapping[SyncIO] {

  override val schema: Schema =
    schema"""
      type Query {
        value: String!
      }
      """
  override val typeMappings: Repro.TypeMappings = List(
    ObjectMapping(schema.ref("Query"))(
      CirceField("value", io.circe.Json.fromInt(42))
    )
  )
}

println(Repro.compileAndRun("{ value }").unsafeRunSync()) // { "data": { "value": 42 } }
Dominant language
Scala
Stars
189
Forks
32
Avg merge
14h 48m
Merged PRs (30d)
25

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from typelevel/grackle

All issues in typelevel/grackle

Similar issues

More Scala issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.