playframework / playframework/play-json

Feature request: Add more methods to Format. like circe `Codec.iemap`

Open
#1,289 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
375
Forks
140
Avg merge
1d 5h
Merged PRs (30d)
28

Description

Play JSON Version (2.5.x / etc)

all

API (Scala / Java / Neither / Both)

scala

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

all

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

all

Expected Behavior

Format has bimap method. But I think we should add more methods. e.g.

 def bimapJsResult[B](readsMap: A => JsResult[B], writesContramap: B => A): Format[B] =

https://github.com/playframework/play-json/blob/3c047f2b8b100806885d08426f0161148361a5b4/play-json/shared/src/main/scala/play/api/libs/json/Format.scala#L22-L23

https://github.com/circe/circe/blob/f7380ca5516bb80e2a0a8da85e2d30fad6a344f1/modules/core/shared/src/main/scala/io/circe/Codec.scala#L35-L51

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

Start by reading play-json/shared/src/main/scala/play/api/libs/json/Format.scala, especially the existing bimap method, and compare the referenced circe Codec.scala methods. Run the existing Play JSON tests covering Format behavior. Done means the agreed additional Format methods are implemented with tests confirming their read and write behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.