Add Swagger document for the Message service#2
Conversation
| schema: | ||
| $ref: '#/definitions/SessionToken' | ||
| description: Success | ||
| 201: |
There was a problem hiding this comment.
Was this meant to be 401?
| $ref: '#/responses/Unauthorized' | ||
| default: | ||
| $ref: '#/responses/Error' | ||
| parameters: |
There was a problem hiding this comment.
From a style standpoint, I would think it would be more logical to put the request information before the response information, which here would mean moving parameters above responses. Any reason in particular to put the responses above?
There was a problem hiding this comment.
That's the order they were in in Cloud's document, but I agree it makes much more sense for the request information to be first.
| name: timeoutMilliseconds | ||
| description: The time to keep the connection open while waiting for a message | ||
| type: integer | ||
| required: false |
There was a problem hiding this comment.
Do we know if the default timeout is consistent between server and cloud? If it is, we could document it if we wanted to. We may also want to mention in the description that there's a maximum (again, we can check if there's a consistent max or not).
There was a problem hiding this comment.
From testing, they both seem to have a max timeout of ten seconds. Server seems to have a default timeout of one second, but I'm not sure what Cloud's is. I'll document these values once we know for sure.
@tschmittni: do you know what SystemLink Cloud uses as the default value for timeoutMilliseconds?
There was a problem hiding this comment.
From SystemLink Cloud's node documentation:
Both the SystemLink Server and the SystemLink Cloud server timeout after 10 seconds.
| - Message Queue | ||
| summary: Get the current queue size | ||
| description: Gets the current queue size (in bytes). This is helpful for determining the amount of memory that unread messages are consuming. | ||
| operationId: GetCurrentQueueSIze |
| type: string | ||
| 426: | ||
| description: Upgrade Required | ||
| default: |
There was a problem hiding this comment.
A websocket route will never return a JSON error response. If the web service rejects the connection for any reason, the client will receive a 403 (though I don't think we have any specific failure reasons, so probably don't need to document it explicitly?).
| description: A value used in the WebSocket opening handshake. Provides part of the information used by the server | ||
| to prove that it received a valid WebSocket opening handshake. | ||
| type: string | ||
| required: true |
There was a problem hiding this comment.
All of these headers are required for a successful websocket upgrade. I would say remove the default or replace them with x-example.
If we want to be pedantic about it (and I'm not sure we need to), the 101 response must also contain the Upgrade and Connection headers.
There was a problem hiding this comment.
Replaced default with x-example.
I'll leave the 101 headers as is, since we're not sure if it's worth defining them.
| description: The topic name | ||
| SessionToken: | ||
| type: object | ||
| title: SessionToken |
There was a problem hiding this comment.
For consistency, there should be a space in SessionToken.
jjaco2
left a comment
There was a problem hiding this comment.
Edits for clarity and style plus a few notes about how much (if at all) we care about matching corresponding nodes in NXG.
| tags: | ||
| - Sessions | ||
| summary: Create a session | ||
| description: Creates a unique messaging session that can send and receive messages. |
There was a problem hiding this comment.
Creates a message session with the server to send and receive messages.
| description: Not authorized | ||
| headers: | ||
| WWW_Authenticate: | ||
| description: Information for how to authenticate (only sent by SystemLink Server). |
There was a problem hiding this comment.
(only sent by SystemLink Server)
(sent only from SystemLink Server)
| Token: | ||
| in: path | ||
| name: token | ||
| description: The unique session ID |
| tags: | ||
| - Topics | ||
| summary: Subscribe to a topic | ||
| description: Subscribes to a topic to receive all messages broadcast with that topic name. |
There was a problem hiding this comment.
I like your description better, but I'm curious what you think of the node description we ended up with for NXG 3.0:
Registers an endpoint to a specific topic, or a name channel.
There was a problem hiding this comment.
I think the endpoint they're referring to is the node that gets dropped, so that seems reasonable. I think both are okay in their respective contexts.
| type: object | ||
| properties: | ||
| name: | ||
| description: The string error code |
There was a problem hiding this comment.
Here and throughout these: drop "The" and "A"
(really minor. can CAR this for later if you want)
There was a problem hiding this comment.
Removed leading "The" and "A" from the model descriptions
| description: The identifier of the resource associated with the error | ||
| type: string | ||
| message: | ||
| description: The filled in error message |
| description: The maximum queue size (in bytes) | ||
| WebSocketPublish: | ||
| type: object | ||
| title: WebSocket Publish Action |
There was a problem hiding this comment.
Could "Action" be left off these and still make sense?
There was a problem hiding this comment.
I'd rather leave it on, as "action" has a very specific meaning in WebSockets. Swagger doesn't support documenting WebSocket APIs, so we have to be as descriptive as possible in our WebSocket action models, and I want to make sure folks can figure out which of our models correspond to our WebSocket actions.
| parameters: | ||
| - in: query | ||
| name: timeoutMilliseconds | ||
| description: The time to keep the connection open while waiting for a message |
There was a problem hiding this comment.
Amount of time, in milliseconds, to keep the messaging connection open.
| /v1/sessions: | ||
| post: | ||
| tags: | ||
| - Sessions |
There was a problem hiding this comment.
All tags should be lowercase.
There was a problem hiding this comment.
Here, the strings are used to group the routes in Swagger UI, and I don't think we want lowercase for that.
There was a problem hiding this comment.
The example "pet store" Swagger file that appears when you first open the editor also uses lowercase tags, so we assume that's the convention.
| parameters: | ||
| - in: query | ||
| name: timeoutMilliseconds | ||
| description: The time to keep the connection open while waiting for a message |
There was a problem hiding this comment.
May be good to note that this value may be overridden by a maximum value that the webserver administrator allows.
There was a problem hiding this comment.
Added a note. Server allows for a ten second maximum by default, and we're waiting on Thomas to tell us what Cloud's maximum is.
| description: Flushes the queue of received messages, discarding all messages without reading them. | ||
| operationId: DeleteMessages | ||
| responses: | ||
| 200: |
There was a problem hiding this comment.
This probably should have been a 204. It would require a change on the webservice itself to fix it.
There was a problem hiding this comment.
There was a problem hiding this comment.
The same would apply to subscribe, unsubscribe, and publish.
…er documentation # Justification #1573106 #1576958 # Implementation In a previous attempt, I tried to fix these bugs by listing the supported values as an in-lined enum. However, that broke some codegen-ed data types and also the public facing python API. Since that would very likely break client code, I resorted to just updating the documentation to specifically list the supported orderby fields. # Testing Since this PR is just plain-text changes now, it shouldn't break a build anywhere. I verified that the changes look correct by copying the yaml file contents over to a swagger doc viewer. You can view it yourself by pasting the contents of the modified file [here](https://editor.swagger.io/). # Checklist - [X] I tested changes to product code in product - [X] I considered updates to the wiki - [ ] If this PR affects user-visible strings, I added Jenna Jaco as a reviewer and attached screenshots of the strings in the product
…er documentation # Justification #1573106 #1576958 # Implementation In a previous attempt, I tried to fix these bugs by listing the supported values as an in-lined enum. However, that broke some codegen-ed data types and also the public facing python API. Since that would very likely break client code, I resorted to just updating the documentation to specifically list the supported orderby fields. # Testing Since this PR is just plain-text changes now, it shouldn't break a build anywhere. I verified that the changes look correct by copying the yaml file contents over to a swagger doc viewer. You can view it yourself by pasting the contents of the modified file [here](https://editor.swagger.io/). # Checklist - [X] I tested changes to product code in product - [X] I considered updates to the wiki - [ ] If this PR affects user-visible strings, I added Jenna Jaco as a reviewer and attached screenshots of the strings in the product
…er documentation # Justification #1573106 #1576958 # Implementation In a previous attempt, I tried to fix these bugs by listing the supported values as an in-lined enum. However, that broke some codegen-ed data types and also the public facing python API. Since that would very likely break client code, I resorted to just updating the documentation to specifically list the supported orderby fields. # Testing Since this PR is just plain-text changes now, it shouldn't break a build anywhere. I verified that the changes look correct by copying the yaml file contents over to a swagger doc viewer. You can view it yourself by pasting the contents of the modified file [here](https://editor.swagger.io/). # Checklist - [X] I tested changes to product code in product - [X] I considered updates to the wiki - [ ] If this PR affects user-visible strings, I added Jenna Jaco as a reviewer and attached screenshots of the strings in the product
[X ] This contribution adheres to CONTRIBUTING.md.
What does this Pull Request accomplish?
This pull request adds a Swagger document for the Message service. We'll treat this as the master copy of the Message service's Swagger document, for use in both SystemLink Server and SystemLink cloud. This document is a cleaned up version of the document generated from SystemLink Cloud's implementation of the Message HTTP API.
Why should this Pull Request be merged?
This pull requests completes a user story targeted to 18.2.
What testing has been done?
I've done basic testing of all of the routes against SystemLink Server using this document and Swagger UI.