typelevel / typelevel/doobie

Misleading import paths for Json/Jsonb stuff in doobie-postgres-circe module

Open
#2,235 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
2.2k
Forks
379
Avg merge
14m
Merged PRs (30d)
8

Description

The current imports are:

import doobie.postgres.circe.json.implicits.* // for Json
import doobie.postgres.circe.jsonb.implicits.* // for Jsonb

In fact, the only implicits they bring in are Get[Json] and Put[Json] instances.
However, those paths seem the only way to import instance constructors: pgEncoderPut* and pgDecoderGet* which are not implicit and have to be called explicitly in order to create instances for specific types.

Importing ..implicits.* in order to access non-implicit stuff is really misleading and can be confusing.

Perhaps it makes sense to deprecate .implicits and provide alternative import path .instances, i.e.:

import doobie.postgres.circe.json.instances.* // for Json
import doobie.postgres.circe.jsonb.instances.* // for Jsonb

By convention, instances imply "typeclass instances" and are usually implicits as well, but providing non-implicit instance constructors along with instances themselves should be fine.

Contributor guide

Open the contributing guide

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.

Research direction

Review the doobie-postgres-circe module's json and jsonb import definitions and their uses; start by checking how implicits.* exposes Get/Put instances and pgEncoderPut*/pgDecoderGet* constructors. Confirm the intended compatibility and naming policy, then verify that replacement import paths and deprecation behavior are covered by the module's existing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, scala
Domain
databases
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.