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

Create tapir module #80

Open
jisantuc opened this issue May 12, 2020 · 0 comments
Open

Create tapir module #80

jisantuc opened this issue May 12, 2020 · 0 comments

Comments

@jisantuc
Copy link
Contributor

jisantuc commented May 12, 2020

Improvement

Schema derivation for case classes depends on Schema[T] being available for all the components. Not just that it could be available -- for exotic types it actually has to exist beforehand (see coproduct types). We should provide a tapir module that provides Schema implicits for all the data types in stac4s. Most of it will be derivable.

Some of the derivations will be incorrect though. for instance the automatic derivation thinks that TwoDimBbox is an object:

@ implicit val twoDimBboxSchema = implicitly[Schema[com.azavea.stac4s.TwoDimBbox]] 
twoDimBboxSchema: Schema[TwoDimBbox] = Schema(                                                            
  SProduct(                                                                                               
    SObjectInfo("com.azavea.stac4s.TwoDimBbox", List()),
    List(           
      ("xmin", Schema(SNumber, false, None, Some("double"), false)),
      ("ymin", Schema(SNumber, false, None, Some("double"), false)),
      ("xmax", Schema(SNumber, false, None, Some("double"), false)),
      ("ymax", Schema(SNumber, false, None, Some("double"), false))
    )                                                                                                     
  ),                     
  false,                                                                                                                                                                                                             
  None,                                                                                                                                                                                                              
  None,                                                                                                                                                                                                              
  false                                                                                                                                                                                                              
)                                                                                                                                                                                                                    

And the automatic derivation for StacLink is a null:

@ implicit val stacLinkSchema: Schema[StacLink] = implicitly[Schema[StacLink]
  ]                 
stacLinkSchema: Schema[StacLink] = null

Notes + Context

This is to support downstream not having to create stac4s schemas in different places, since Schema[T] + Codec[T] in the json lib is normally sufficient for Codec[T] in tapir

@jcahail jcahail changed the title Create sttp module Create tapir module May 14, 2020
@jisantuc jisantuc mentioned this issue Aug 21, 2020
2 tasks
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