Skip to content

fix: preserve declared YAML scalar types - #78

Merged
cdavernas merged 2 commits into
asyncapi:masterfrom
LouisDeconinck:fix/yaml-scalar-deserialization
Sep 11, 2026
Merged

cdavernas merged 2 commits into
asyncapi:masterfrom
LouisDeconinck:fix/yaml-scalar-deserialization

Conversation

@LouisDeconinck

Copy link
Copy Markdown
Contributor

What this PR does:
Prevents YAML scalar type inference from replacing explicitly declared AsyncAPI property types before deserialization. This allows unquoted specification/API versions and numeric MQTT QoS values to be read through the document reader.

Adds a focused regression test covering asyncapi: 3.0.0, info.version: 1.0.0, and bindings.mqtt.qos: 2.

Fixes #76

Additional information:

  • dotnet build --no-restore passes.
  • Focused IO tests pass on net8.0 and net9.0.
  • The full suite has container-dependent failures locally because Docker is unavailable; non-container tests pass.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide 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.

@cdavernas cdavernas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Cheers ❤️

@cdavernas

Copy link
Copy Markdown
Collaborator

@LouisDeconinck Would you be so kind to fix the tests so that I can proceed with the merge?

@LouisDeconinck

Copy link
Copy Markdown
Contributor Author

The build-and-test failure on the previous run was caused by flaky container-based binding tests (NatsBindingHandlerTests.Subscribe_Should_Work, AmqpBindingHandlerTests.Publish_Should_Work/Subscribe_Should_Work) — readiness/timing races in the Testcontainers setup, unrelated to the YAML scalar change (all IO tests, including the new one, passed on both target frameworks). The new commit waits for the broker port to be available before tests proceed, and gives the NATS subscription a moment to be established before publishing.

@cdavernas

cdavernas commented Sep 11, 2026 •

Copy link
Copy Markdown
Collaborator

@LouisDeconinck Thank you ❤️

There's clearly still a bug with the tests (42mn+ to run) but I'll address in a dedicated PR

@cdavernas
cdavernas merged commit eadbe18 into asyncapi:master Sep 11, 2026
5 of 6 checks passed
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

Successfully merging this pull request may close these issues.

StringEnumDeserializer crashes when scalar matches an implicit YAML type (Decimal/Integer) — asyncapi: 3.0.0, bindings.mqtt.qos: 2

2 participants