Skip to content

Extract JsonSchema from EncodeJson #330

@Dnomyar

Description

@Dnomyar

Hey folks,

I was wondering if someone had already extracted a JsonSchema (or similar) from encoders.

For example :

case class Data(id: UUID, a: Option[String])

object Data {
    implicit val encoder: EncodeJson[Data] =
        jencode2L((m: Data) => (m.id, m.a))(
          "id", "some_field_name"
        )
}

Is it possible to extract the JsonSchema from this encoder that could look like :

{
  "title": "Data",
  "type": "object",
  "properties": {
    "id": {
      "type": "uuid"
    },
    "some_field_name": {
      "type": "string",
      "optional": true
    }
  }
}

It seems a bit hard to extract all this information from the current state of the code.
Do you have any clue?
Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions