You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fails with "discriminator" property type must be string channels.FooEvents.messages.fooQueriedEvent.payload.properties.bazAttributes.discriminator
This is using the official asyncapi CLI binary provided by asyncapi/cli:2.6.0 docker image, but also any other AsyncAPI tool I could find.
Root Cause
From what I can understand, AsyncAPI implements discriminator using the schema that OpenAPI 2.x (Swagger) had, i.e.:
OneOfBazAttributes:
type: objectproperties:
type:
type: stringenum: [ 'RealBazAttributes', 'MockBazAttributes' ]discriminator: type# with the expectation of having the value of `type` matching# the object name exactly as defined in the YAML
(although the AsyncAPI render does not render any oneOf options, but all validations now pass successfully).
OpenAPI moved to a newer schema in 3.x, and whilst AsyncAPI does not seem to have problems with the OpenAPI 3.x schema compatibility, the specific discriminator capability seems to still be stuck in the 2.x world.
As it is, I do not see any clean way to be able to support discriminator and both OpenAPI and AsyncAPI simultaneously, without fixing this issue, or rolling everything back to 2.x.
Proposal
Align the AsyncAPI spec around discriminator to that of OpenAPI 3.1.x, and release it as AsyncAPI 3.1.0.
Keen to see your thoughts.
Thanks anyone participating.
The text was updated successfully, but these errors were encountered:
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request. Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
Context
The overlap in specification between AsyncAPI and OpenAPI specs allows the combining of common models across both.
Example:
./models/foo.yaml
./apis/foo.openapi.ayml
./events/foo.asyncapi.ayml
Problem
It's quite evident that AsyncAPI in general has no compatibility issues with OpenAPI specifications.
However, the problem lies with the use of
discriminator
in aoneOf
situation.If I update
./models/foo.yaml
to this:"discriminator" property type must be string channels.FooEvents.messages.fooQueriedEvent.payload.properties.bazAttributes.discriminator
This is using the official
asyncapi
CLI binary provided byasyncapi/cli:2.6.0
docker image, but also any other AsyncAPI tool I could find.Root Cause
From what I can understand, AsyncAPI implements
discriminator
using the schema that OpenAPI 2.x (Swagger) had, i.e.:(although the AsyncAPI render does not render any
oneOf
options, but all validations now pass successfully).OpenAPI moved to a newer schema in 3.x, and whilst AsyncAPI does not seem to have problems with the OpenAPI 3.x schema compatibility, the specific
discriminator
capability seems to still be stuck in the 2.x world.As it is, I do not see any clean way to be able to support
discriminator
and both OpenAPI and AsyncAPI simultaneously, without fixing this issue, or rolling everything back to 2.x.Proposal
Align the AsyncAPI spec around
discriminator
to that of OpenAPI 3.1.x, and release it as AsyncAPI 3.1.0.Keen to see your thoughts.
Thanks anyone participating.
The text was updated successfully, but these errors were encountered: