Skip to content

Render AsyncAPI union response variants#926

Draft
danielporterda wants to merge 1 commit into
mainfrom
asyncapi-success-response-generation
Draft

Render AsyncAPI union response variants#926
danielporterda wants to merge 1 commit into
mainfrom
asyncapi-success-response-generation

Conversation

@danielporterda

@danielporterda danielporterda commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Screenshot

AsyncAPI union variants

Shows the generated /v2/updates subscribe output schema now rendering both JsCantonError and JsGetUpdatesResponse, including the nested update variants.

Summary

  • preserve AsyncAPI oneOf/anyOf payload variants in the generator instead of rendering only the first branch sample
  • render variant groups in generated reference schemas, including nested property unions like JsGetUpdatesResponse.update
  • regenerate JSON API AsyncAPI subscribe pages so response unions show both error and success payload shapes

Root cause

The AsyncAPI source for /v2/updates correctly models Either_JsCantonError_JsGetUpdatesResponse as oneOf [JsCantonError, JsGetUpdatesResponse], but schema_sample_value() collapsed oneOf/anyOf schemas to branch zero. Because branch zero is JsCantonError, generated docs omitted the success branch.

Validation

  • python3 -m pytest tests/test_asyncapi.py
  • npm run generate:json-api-asyncapi-reference
  • python3 -m pytest tests/test_asyncapi.py tests/test_openrpc.py
  • python3 -m py_compile src/x2mdx/asyncapi/lifecycle.py src/x2mdx/asyncapi/render.py src/x2mdx/reference_pages.py
  • git diff --check

Note: I also tried tests/test_asyncapi.py tests/test_openrpc.py tests/test_protobuf.py; tests/test_protobuf.py::ProtobufTests::test_cli_builds_overview_and_package_pages failed on an existing relative-link assertion (packages/... expected, ./packages/... rendered), unrelated to this AsyncAPI change.

@mintlify

mintlify Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
cantonfoundation 🟢 Ready View Preview Jul 1, 2026, 7:03 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

Signed-off-by: danielporterda <daniel.porter@digitalasset.com>
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.

1 participant