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

Feature.Pack (Json.Profile ???) #88

Open
andyglow opened this issue Nov 15, 2020 · 1 comment
Open

Feature.Pack (Json.Profile ???) #88

andyglow opened this issue Nov 15, 2020 · 1 comment
Assignees
Labels

Comments

@andyglow
Copy link
Owner

andyglow commented Nov 15, 2020

h1. Problem
There are many scala libraries exists that solves parse/format problem for different scala types.
Not all of them follow the same standard, though. For example:

  • ujson libs treat scala.Option as json-array (by default)
  • some other use json.null for scala.None, whereas others just omit the field (when it comes to case class field >> json-object field
  • some libs may have support for scala.Either to json codecs, when the others haven't
  • some libs support recursive types, some others don't
  • discriminator field for sealed traits is treated differently

As of now scala-jsonschema has a single perspective on

  • a feature-set
  • and on how scala type is converted into json.
    Which leads to desynchronization. What derived schema shows basically not always coincides with what codec produces.

h1. Idea
scala-jsonschema should be flexible on this and provide extensible api so lib developer and/or extension developer may instruct it about what features supported, implementation specific of certain features and so on.

case class FeaturePack( // JsonProfile?
  `feature-xxx-enabled`: Boolean,
  `feature-yyy-details`: FeatureYYYDetails,
  ...
)

The existence of instance of this class in implicit scope of macro call should affect the way derivation logic process certain types.

@andyglow andyglow self-assigned this Nov 15, 2020
@andyglow andyglow added the idea label Nov 15, 2020
@andyglow
Copy link
Owner Author

linking #220

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

No branches or pull requests

1 participant