Comments (10)
There is const
in the jsonschema that we use: https://github.com/softwaremill/sttp-apispec/blob/master/apispec-model/src/main/scala/sttp/apispec/Schema.scala#L55
I don't think we should be assing const
to sttp.tapir.Schema
. That's the high-level representaiton. Possibly, the translation between a tapir schema and an async api schema needs to be adjusted?
from tapir.
That's probably the place where the discriminators are generated:
from tapir.
I wonder if the way discriminators are defined for OpenAPI and AsyncAPI diverges? But hopefully we can generate something that works for both cases
from tapir.
There is
const
in the jsonschema that we use: https://github.com/softwaremill/sttp-apispec/blob/master/apispec-model/src/main/scala/sttp/apispec/Schema.scala#L55
True, I think it is not being set anywhere in the schema generation code, though.
I don't think we should be assing
const
tosttp.tapir.Schema
. That's the high-level representaiton. Possibly, the translation between a tapir schema and an async api schema needs to be adjusted?
If I am not mistaken, currently OpenAPI and AsyncApi schemas are rendered in the same way, this leads to an illegal async api spec when using .withDiscriminator
: #3754. So yes, it looks like a translation between a tapir schema and an async api schema needs to be adjusted.
from tapir.
I wonder if the way discriminators are defined for OpenAPI and AsyncAPI diverges? But hopefully we can generate something that works for both cases
AsyncApi does not support mapping
for the discriminator, also discriminator must be a String. It looks like separate rendering paths might be needed - OpenApi conforms to JSON Schema Specification Draft 2020-12, AsyncApi does not.
from tapir.
Ah I see. Then I guess we'll need a flag for the TSchemaToASchema
class to make this configurable
from tapir.
Ah I see. Then I guess we'll need a flag for the
TSchemaToASchema
class to make this configurable
What would be your suggestion for the flag? Discriminator-specific (we might stumble on other asyncapi/openapi incompatibilities in the future), or perhaps enum OpenApi/AsyncApi/JsonSchema? It seems that ASchema
is only used for rendering to one of those specs.
from tapir.
Let's start with a simple Boolean
flag if we want to generate mapping
s or const
s for discriminators. If there are more such cases, we'll refactor. ASchema
is an alias for the sttp-apispec Schema
, I think it's used by both?
from tapir.
OK, let's roll with a Boolean
flag. Yes, ASchema
is used by both.
from tapir.
Closining for now, see #3765.
from tapir.
Related Issues (20)
- Schema of `oneOf` variants with same status code and content-type HOT 5
- Web Sockets for netty-server-loom
- [BUG] WebSocket routes always trigger error when using as part of an existing Play Application HOT 1
- tapir server to ignore any validations HOT 11
- [BUG] Websockets with zio-http can fail on too early messages on slow hosts
- [BUG] ClosedChannelException when consuming stream response body with Fs2Streams HOT 1
- Issue with Recognition of API path in Tapir version 10.4.1 HOT 5
- Relaxed enumeratum codecs HOT 2
- [BUG] Can no longer return 304 with empty string as body - get 500 internal server error HOT 4
- [Feature] Semi-auto enum schema derivation configuration
- Enchancement of the Endpoint DSL to support multiple path variables or combination of path variable and literal within single path segment
- AsyncApi schema - broken rendering of examples
- AsyncApi schema - use of `.withDiscriminator` for `Schema` renders illegal async api spec HOT 1
- [BUG] All optional query parameters are required HOT 5
- Add a flag into `TSchemaToASchema` to distinguish between `mappings` or `consts` for discriminators. HOT 4
- Can we add `SchemaType.Intersection` for `SProduct`s? HOT 1
- Allow for third-party routing logic to tap into the Tapir backends HOT 3
- [BUG] Security path inputs always goes before regular input segments HOT 3
- [BUG] Netty servers shouldn't reply to WS Close frame immediately
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.