Repository navigation
feat: describe typed Socket.IO operations with AsyncAPI - #4
Merged
Merged
Conversation
Record namespace-scoped outgoing payloads and declared ACK types alongside inbound handler contracts while preserving existing emit and call behavior. Project the local contract to AsyncAPI 3.1 with Socket.IO semantics kept in a library-specific extension. Remove the never-implemented schema() placeholder and cover runtime, typing, and export behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Outgoing event validation previously knew only an event name and payload type. It could not describe a stable namespace or acknowledgement type, so runtime behavior and generated protocol descriptions had no shared, complete operation contract.
Changes
namespaceandack_typetoregister_emit(). An unscoped registration retains its previous event-wide behavior; a scoped registration overrides it only in that namespace.ack_typeis declarative and does not changecall(response_model=...)validation.pydantic_socketio.asyncapi_schema(sio, *, title, version)to project those registrations into AsyncAPI 3.1. Socket.IO-specific event, role, namespace fallback, and ACK semantics live underx-pydantic-socketio.schema()placeholder, which had only returnedNoneand had no documented use. This is technically an API removal, with no working behavior to migrate.Verification
python-socketio==5.12.1and==5.17.0.emit/onoperations, namespaces, payload examples, and ACK shapes.Product boundary
The schema is useful for documentation and machine-readable contracts. Generic tooling currently renders multi-argument payloads as arrays and does not provide a ready-made Socket.IO client SDK from AsyncAPI 3.1. This PR does not add a generator, runtime dependency, wrapper, DI system, or documentation server.