No. tapir relies on a couple of Scala-specific features, which won't be possible to port to Java. One example is type-safety. Every time we add a new input, with a value which maps to some request part (query, header, path, ...), the type of the value what we create is extended. This is then used to verify at compile-time that the business logic function has the correct signature - takes values of appropriate types as input as returns either the error or successful output.
I’m just wondering what do you think about using Lombok annotations in Java, do you find level of control over what happens in code with such additions enough?
When we're doing projects in Java, we use Lombok. Definitely better than generating all those getters & setters. However, it's still a hack to make Java a better language. Lombok annotations give you a good level of control, but personally when possible, I simply prefer to use a better, more powerful language (such as Scala).
Does two-step filter with limit scan all "books", even if limit is defined, or it is taking all steps into account?
Yes, in this implementation we scanned all books. In reality we would probably call a database query which would do it in a more intelligent way.
Yes, you can generate clients. When you interpret an endpoint as a client, you get a function which, when provided with the input parameters (as specified in the description), will call the endpoint on a given URL.
You can generate Scala code from an OpenAPI description, but that's a different library - Twilio's Guardrail in this case. The OpenAPI representation contains less detail than the tapir representation (for example when it comes to types and codecs - how to serialise objects), so the conversion from tapir to OpenAPI is lossy (hence it's not possible to translate the other way).
Yes, using methods. You can create a method (a function) which takes one base endpoint and enriches is somehow - adding the necessary detail. You can then compose such enriching functions as you would with any other functions. Of course, as long as the type signatures typecheck!
You can find tapir here: https://github.com/softwaremill/tapir And the code from the presentation here: https://github.com/softwaremill/tapir-pres-2
Other links:
- tapir docs: https://tapir-scala.readthedocs.io
- Scala Times, our weekly Scala newsletter: http://scalatimes.com)
- SoftwareMill: http://www.softwaremill.com
- SoftwareMill's 10th anniversary: https://10birthday.softwaremill.com
- https://twitter.com/adamwarski