Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract JsonSchema from EncodeJson #330

Open
Dnomyar opened this issue Nov 27, 2019 · 0 comments
Open

Extract JsonSchema from EncodeJson #330

Dnomyar opened this issue Nov 27, 2019 · 0 comments

Comments

@Dnomyar
Copy link

Dnomyar commented Nov 27, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant