bridges icon indicating copy to clipboard operation
bridges copied to clipboard

Feature request: Generate json.schema files from case classes

Open Daenyth opened this issue 4 years ago • 2 comments

I'd love to be able to generate json schema files

Ideally, it would support:

  • sealed trait families map to oneOf
    • case object would be values, like in sealed trait T; case object A extends T; case object B extends T would be "type A, values oneOf A, B"
  • AnyVal wrapper classes map to a named type, use sites would use $ref
  • Schemas generated could reference each other, mirroring the scala file layouts/imports

Daenyth avatar May 06 '20 16:05 Daenyth

Sorry it's taken me so long to look at this. I guess the big question is: can you go from an ADT like Type or TsType all the way to a JSON Schema definition? If so, I'd be happy to pair with you (or anyone) to implement it.

davegurnell avatar May 12 '21 10:05 davegurnell

FWIW - I'm guessing that libraries like Tapir have support for this kind of thing already, but I think it's a good fit for Bridges anyway.

davegurnell avatar May 12 '21 10:05 davegurnell