Skip to content

Conversation

@bali182
Copy link

@bali182 bali182 commented Feb 10, 2022

Proposal for Websocket spec, resolves #55

@bali182 bali182 mentioned this pull request Feb 10, 2022
Comment on lines +86 to +88
- Add 2 optional fields on the [Operation Object](https://swagger.io/specification/#operation-object) type:
- `publish`: [Reference Object](https://swagger.io/specification/#reference-object) | `WebSocket Payload Object` - describes the message(s) the client can publish/push to the server.
- `subscribe`: [Reference Object](https://swagger.io/specification/#reference-object) | `WebSocket Payload Object` - describes the message(s) the client can receive from the server.

Choose a reason for hiding this comment

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

If both fields can be optional, how can a tool that reads an OpenAPI document identify a web socket endpoint with certainty? If the OpenAPI document author did not supply either field, the endpoint is unrecognisable from a standard endpoint.

What should happen if those fields are added to an operation other than get? Is that possible?

Copy link
Author

@bali182 bali182 Feb 16, 2022

Choose a reason for hiding this comment

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

  1. I'd say if either publish or subscribe is present, then it's a socket enabled path. If neither is supplied, it should fall back to be recognized as a regular http path. Are you suggesting something more explicit (extra boolean field maybe)?

  2. I'd say error. Similar situation, as to what should happen if a GET request has a requestBody.

What do you think?

Choose a reason for hiding this comment

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

OK, that would work. If anyone needs more, they can always create a proposal for it!

@darrelmiller
Copy link
Member

We appreciate the submission but as discussed in the issue this is out of scope for the OpenAPI specification.

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.

Swagger for WebSocket services

5 participants