Comments (5)
I'm not aware of any tapir-specific patterns, so this might be a more general-Scala question. On first attempt, I think I would model it as you did. After all, you need to somehow express the optionality of each field in types.
The problem then is, what about optional fields? That is situations where you end up with Option[Option[X]]
in the patch. Probably the json decoder would need to handle this appropriately when seeing a missing vs. null
field?
from tapir.
Now i use jsonBodyWithRaw and parse json again for filter fake nulls..
from tapir.
found a good idea https://github.com/pathikrit/metarest
from tapir.
@boryaferz yeah macros could work, though it might be problematic in IDEs.
I don't know which json parser you are using, but I think it should be possible to configure it to properly handle nested options, so that you don't have to do any hand-parsing. jsonBody
just takes the json encoders/decoders that are in scope. But that's more of a question regarding the json library.
from tapir.
Thanks
from tapir.
Related Issues (20)
- Netty gRPC server HOT 1
- [BUG] Option of CommaSeparated has a strange behavior when no value is provided HOT 6
- [BUG] "type mismatch" when attempting to compile endpoint test (Tapir + Zio2 + Http4s + Circe + Doobie) HOT 3
- [BUG] Enumeration schema is inconsistent depending on the encoding function HOT 3
- [BUG] Invalid AsyncAPI documentation generated. HOT 3
- Implement multipart body support in sttp stub
- Snake case and discriminator config ignored HOT 5
- [BUG] route won't match if `extractFromRequest` is followed by a static path or path parameter input HOT 1
- Validate discriminator values HOT 8
- Simple default bundle compatible with Scala toolkit HOT 7
- [BUG] semiauto schema derivation looses generic type HOT 1
- [BUG] mapping is sometimes lost in schema generation
- Should we prevent space inside endpoint name/operationId HOT 1
- How to handle an error with fs2.Stream based endpoint HOT 2
- Release latest tapir with `sttpApispec` set to `0.11.0` HOT 1
- [BUG] Routing Regression in 1.10.13(ZIO-HTTP) HOT 8
- `SttpClientInterpreter` does not propagate headers in the http response for websockets HOT 6
- Compile crash when deriving case classes using OpenAI Schema annotations HOT 2
- Schema Magnolia Derivation inlines a null that breaks Scala 3's -Yexplicit-nulls compiler option HOT 1
- Strange behaviour of HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tapir.