Skip to content

Add Swagger document for the Message service#2

Merged
pvallone merged 8 commits intomasterfrom
users/pvallone/add-message-swagger-doc
Sep 5, 2018
Merged

Add Swagger document for the Message service#2
pvallone merged 8 commits intomasterfrom
users/pvallone/add-message-swagger-doc

Conversation

@pvallone
Copy link
Copy Markdown
Contributor

[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.

@pvallone pvallone self-assigned this Aug 23, 2018
Comment thread message/message.yml Outdated
schema:
$ref: '#/definitions/SessionToken'
description: Success
201:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Was this meant to be 401?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep!

Comment thread message/message.yml
$ref: '#/responses/Unauthorized'
default:
$ref: '#/responses/Error'
parameters:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Comment thread message/message.yml Outdated
name: timeoutMilliseconds
description: The time to keep the connection open while waiting for a message
type: integer
required: false
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

From SystemLink Cloud's node documentation:

Both the SystemLink Server and the SystemLink Cloud server timeout after 10 seconds.

Comment thread message/message.yml Outdated
- 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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

SIze -> Size

Comment thread message/message.yml Outdated
type: string
426:
description: Upgrade Required
default:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?).

Comment thread message/message.yml
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Replaced default with x-example.

I'll leave the 101 headers as is, since we're not sure if it's worth defining them.

Comment thread message/message.yml Outdated
description: The topic name
SessionToken:
type: object
title: SessionToken
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For consistency, there should be a space in SessionToken.

spanglerco
spanglerco previously approved these changes Aug 24, 2018
Copy link
Copy Markdown
Contributor

@jjaco2 jjaco2 left a comment

Choose a reason for hiding this comment

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

Edits for clarity and style plus a few notes about how much (if at all) we care about matching corresponding nodes in NXG.

Comment thread message/message.yml Outdated
tags:
- Sessions
summary: Create a session
description: Creates a unique messaging session that can send and receive messages.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Creates a message session with the server to send and receive messages.

Comment thread message/message.yml Outdated
Comment thread message/message.yml Outdated
description: Not authorized
headers:
WWW_Authenticate:
description: Information for how to authenticate (only sent by SystemLink Server).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(only sent by SystemLink Server)

(sent only from SystemLink Server)

Comment thread message/message.yml Outdated
Token:
in: path
name: token
description: The unique session ID
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Drop "The"

Comment thread message/message.yml
tags:
- Topics
summary: Subscribe to a topic
description: Subscribes to a topic to receive all messages broadcast with that topic name.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Comment thread message/message.yml
Comment thread message/message.yml Outdated
type: object
properties:
name:
description: The string error code
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Here and throughout these: drop "The" and "A"

(really minor. can CAR this for later if you want)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed leading "The" and "A" from the model descriptions

Comment thread message/message.yml Outdated
description: The identifier of the resource associated with the error
type: string
message:
description: The filled in error message
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

filled in

complete?

Comment thread message/message.yml
description: The maximum queue size (in bytes)
WebSocketPublish:
type: object
title: WebSocket Publish Action
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could "Action" be left off these and still make sense?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Comment thread message/message.yml Outdated
parameters:
- in: query
name: timeoutMilliseconds
description: The time to keep the connection open while waiting for a message
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Amount of time, in milliseconds, to keep the messaging connection open.

Comment thread message/nimessage.yml Outdated
/v1/sessions:
post:
tags:
- Sessions
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All tags should be lowercase.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Here, the strings are used to group the routes in Swagger UI, and I don't think we want lowercase for that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread message/nimessage.yml
Comment thread message/nimessage.yml Outdated
parameters:
- in: query
name: timeoutMilliseconds
description: The time to keep the connection open while waiting for a message
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

May be good to note that this value may be overridden by a maximum value that the webserver administrator allows.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Comment thread message/nimessage.yml
description: Flushes the queue of received messages, discarding all messages without reading them.
operationId: DeleteMessages
responses:
200:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This probably should have been a 204. It would require a change on the webservice itself to fix it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The same would apply to subscribe, unsubscribe, and publish.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated the CAR

Comment thread message/nimessage.yml
spanglerco
spanglerco previously approved these changes Aug 28, 2018
@pvallone pvallone merged commit a902a28 into master Sep 5, 2018
@pvallone pvallone deleted the users/pvallone/add-message-swagger-doc branch September 20, 2018 15:44
brian-poteet-ni pushed a commit that referenced this pull request Oct 5, 2021
…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
cameronwaterman pushed a commit that referenced this pull request Jan 11, 2022
…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
haworthia pushed a commit that referenced this pull request Jun 1, 2022
…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
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.

4 participants