Skip to content

Conversation

@chirizxc
Copy link
Contributor

@chirizxc chirizxc commented Dec 3, 2025

Description

Starting with v0.6.0 faststream supports AsyncAPI 3.0.

The AsyncAPI 3.0 documentation states:

In order to preserve the ability to round-trip between YAML and JSON formats, YAML version 1.2 is recommended along with some additional constraints:

  • Tags MUST be limited to those allowed by the JSON Schema ruleset
  • Keys used in YAML maps MUST be limited to a scalar string, as defined by the YAML Failsafe schema ruleset

Note: AsyncAPI use js-yaml as parser, *js-yaml playground

According to spec, yaml of the following type:

protocolVersion: ! "3.2"

should be converted to {protocolVersion: "3.2"}, i.e. to a string, but PyYAML converts it to an float:

import yaml

y = "protocolVersion: ! '3.2'"

print(yaml.safe_load(y))  # {'protocolVersion': 3.2}
print(type(yaml.safe_load(y)["protocolVersion"]))  # <class 'float'>

(Also, PyYAML does not fully support YAML v1.2.* and does not pass the official yaml-test-suite).

Valid AsyncAPI config: https://studio.asyncapi.com/?share=851921b7-91cd-414c-9438-e94876953c0d

but faststream cannot load it

❯ faststream docs serve asyncapi.yaml                                                                                                                 
`asyncapi.yaml` not supported. Make sure that your schema is valid and schema version supported by FastStream

Type of change

Please delete options that are not relevant.

  • Documentation (typos, code examples, or any documentation updates)
  • Bug fix (a non-breaking change that resolves an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a fix or feature that would disrupt existing functionality)
  • This change requires a documentation update

Checklist

  • My code adheres to the style guidelines of this project (just lint shows no errors)
  • I have conducted a self-review of my own code
  • I have made the necessary changes to the documentation
  • My changes do not generate any new warnings
  • I have added tests to validate the effectiveness of my fix or the functionality of my new feature
  • Both new and existing unit tests pass successfully on my local environment by running just test-coverage
  • I have ensured that static analysis tests are passing by running just static-analysis
  • I have included code examples to illustrate the modifications

@CLAassistant
Copy link

CLAassistant commented Dec 3, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the dependencies Pull requests that update a dependency file label Dec 3, 2025
@chirizxc chirizxc marked this pull request as ready for review December 4, 2025 17:05
@chirizxc chirizxc closed this Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants