Skip to content

docs: api root, buildinfo, csp #5493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rephrased
  • Loading branch information
mtojek committed Dec 21, 2022
commit 59de7a032b2258f0660c9587decbeffb95666410
6 changes: 3 additions & 3 deletions coderd/apidoc/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ const docTemplate = `{
"type": "object",
"properties": {
"external_url": {
"description": "ExternalURL is a URL referencing the current Coder version. For production\nbuilds, this will link directly to a release. For development builds, this\nwill link to a commit.",
"description": "ExternalURL is a URL referencing the current Coder version.\nFor production builds, this will link directly to a release. For development builds, this will link to a commit.",
"type": "string"
},
"version": {
Expand Down Expand Up @@ -1188,15 +1188,15 @@ const docTemplate = `{
"type": "object",
"properties": {
"current": {
"description": "Current is a boolean indicating whether the\nserver version is the same as the latest.",
"description": "Current indicates whether the server version is the same as the latest.",
"type": "boolean"
},
"url": {
"description": "URL to download the latest release of Coder.",
"type": "string"
},
"version": {
"description": "Version is the semantic version for the latest\nrelease of Coder.",
"description": "Version is the semantic version for the latest release of Coder.",
"type": "string"
}
}
Expand Down
6 changes: 3 additions & 3 deletions coderd/apidoc/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@
"type": "object",
"properties": {
"external_url": {
"description": "ExternalURL is a URL referencing the current Coder version. For production\nbuilds, this will link directly to a release. For development builds, this\nwill link to a commit.",
"description": "ExternalURL is a URL referencing the current Coder version.\nFor production builds, this will link directly to a release. For development builds, this will link to a commit.",
"type": "string"
},
"version": {
Expand Down Expand Up @@ -1064,15 +1064,15 @@
"type": "object",
"properties": {
"current": {
"description": "Current is a boolean indicating whether the\nserver version is the same as the latest.",
"description": "Current indicates whether the server version is the same as the latest.",
"type": "boolean"
},
"url": {
"description": "URL to download the latest release of Coder.",
"type": "string"
},
"version": {
"description": "Version is the semantic version for the latest\nrelease of Coder.",
"description": "Version is the semantic version for the latest release of Coder.",
"type": "string"
}
}
Expand Down
5 changes: 2 additions & 3 deletions codersdk/buildinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ import (

// BuildInfoResponse contains build information for this instance of Coder.
type BuildInfoResponse struct {
// ExternalURL is a URL referencing the current Coder version. For production
// builds, this will link directly to a release. For development builds, this
// will link to a commit.
// ExternalURL is a URL referencing the current Coder version.
// For production builds, this will link directly to a release. For development builds, this will link to a commit.
ExternalURL string `json:"external_url"`
// Version returns the semantic version of the build.
Version string `json:"version"`
Expand Down
12 changes: 4 additions & 8 deletions codersdk/updatecheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,17 @@ import (
"net/http"
)

// UpdateCheckResponse contains information
// on the latest release of Coder.
// UpdateCheckResponse contains information on the latest release of Coder.
type UpdateCheckResponse struct {
// Current is a boolean indicating whether the
// server version is the same as the latest.
// Current indicates whether the server version is the same as the latest.
Current bool `json:"current"`
// Version is the semantic version for the latest
// release of Coder.
// Version is the semantic version for the latest release of Coder.
Version string `json:"version"`
// URL to download the latest release of Coder.
URL string `json:"url"`
}

// UpdateCheck returns information about the latest release version of
// Coder and whether or not the server is running the latest release.
// UpdateCheck returns information about the latest release version of Coder and whether or not the server is running the latest release.
Copy link
Member

Choose a reason for hiding this comment

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

These comments are somewhat easier to read when there are line-breaks, why do we need to make them a single line (same for the other changes)? (I personally write mine with <=80 char width but we don't enforce it, sub-80 is most prominent in the project though.)

Copy link
Member Author

Choose a reason for hiding this comment

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

I admit that I changed the line length as I stick to <=120 or <=160 chars (widescreen). I believe that times with <=80 chars are already gone :)

As we fixed the bug with <br>, I guess that we can bring the original multi-line comment back.

Copy link
Member

Choose a reason for hiding this comment

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

😅. For me it's not about the space, I just find long lines harder to read because my eye needs to travel more sideways.

I also admit I like it when comments align closely to the thing they describe 😆 (like this):
image

Copy link
Member Author

Choose a reason for hiding this comment

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

In theory, we could involve one more formatter, golines, to enforce a specific line length limit, but maybe let's leave it aside from this PR.

func (c *Client) UpdateCheck(ctx context.Context) (UpdateCheckResponse, error) {
res, err := c.Request(ctx, http.MethodGet, "/api/v2/updatecheck", nil)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions docs/api/schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,11 @@ CreateParameterRequest is a structure used to create a new parameter value for a

### Properties

| Name | Type | Required | Restrictions | Description |
| --------- | ------- | -------- | ------------ | ------------------------------------------------------------------------------------- |
| `current` | boolean | false | | Current is a boolean indicating whether the server version is the same as the latest. |
| `url` | string | false | | Url to download the latest release of Coder. |
| `version` | string | false | | Version is the semantic version for the latest release of Coder. |
| Name | Type | Required | Restrictions | Description |
| --------- | ------- | -------- | ------------ | ----------------------------------------------------------------------- |
| `current` | boolean | false | | Current indicates whether the server version is the same as the latest. |
| `url` | string | false | | Url to download the latest release of Coder. |
| `version` | string | false | | Version is the semantic version for the latest release of Coder. |

## codersdk.UpdateWorkspaceAutostartRequest

Expand Down