Skip to content

feat: Validate swagger definitions #5694

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 70 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
a3fbe72
docs: audit, deploymentconfig, files, parameters
mtojek Dec 22, 2022
fbe1d70
Swagger comments in workspacebuilds.go
mtojek Jan 2, 2023
96daf47
structs in workspacebuilds.go
mtojek Jan 2, 2023
663ec87
workspaceagents: instance identity
mtojek Jan 2, 2023
fc00d7e
workspaceagents.go in progress
mtojek Jan 2, 2023
67a85b9
workspaceagents.go in progress
mtojek Jan 2, 2023
ce8c7ea
Agents
mtojek Jan 2, 2023
d2a9af5
workspacebuilds.go
mtojek Jan 2, 2023
f37c6b3
/workspaces
mtojek Jan 3, 2023
250982a
templates.go, templateversions.go
mtojek Jan 3, 2023
ff622a7
templateversion.go in progress
mtojek Jan 3, 2023
9dd385c
cancel
mtojek Jan 3, 2023
f96351a
templateversions
mtojek Jan 3, 2023
15de3b6
wip
mtojek Jan 3, 2023
596cdbd
Merge branch 'main' into 3522-workspacebuilds-1
mtojek Jan 3, 2023
eb4ba48
Merge
mtojek Jan 3, 2023
e314c24
x-apidocgen
mtojek Jan 4, 2023
97cd7ac
NullTime hack not needed anymore
mtojek Jan 4, 2023
ae06598
Fix: x-apidocgen
mtojek Jan 4, 2023
c82eb01
Merge branch '3522-workspacebuilds-1' into 3522-templates-1
mtojek Jan 4, 2023
77815d3
Merge branch '3522-templates-1' into 3522-organizations-1
mtojek Jan 4, 2023
7aa0f65
Members
mtojek Jan 4, 2023
b93398e
Fixes
mtojek Jan 4, 2023
5c96bd5
Fix
mtojek Jan 4, 2023
4667f07
WIP
mtojek Jan 5, 2023
0cd9c4a
Merge branch 'main' into 3522-templates-1
mtojek Jan 5, 2023
5405c0c
WIP
mtojek Jan 9, 2023
801cad1
Merge branch '3522-users-1' into 3522-organizations-1
mtojek Jan 9, 2023
0dc1d2a
Users
mtojek Jan 9, 2023
9285425
Logout
mtojek Jan 9, 2023
6979a7f
User profile
mtojek Jan 9, 2023
62a26f9
Status suspend activate
mtojek Jan 9, 2023
b1f389b
User roles
mtojek Jan 9, 2023
14a1654
User tokens
mtojek Jan 9, 2023
5c22629
Keys
mtojek Jan 9, 2023
91c78f4
SSH key
mtojek Jan 9, 2023
c06a636
All
mtojek Jan 9, 2023
ee6dbb1
Typo
mtojek Jan 9, 2023
8f22f8d
Fix
mtojek Jan 9, 2023
77be926
Entitlements
mtojek Jan 9, 2023
4fcedb0
Groups
mtojek Jan 9, 2023
35eae4e
SCIM
mtojek Jan 9, 2023
a7f6add
Fix
mtojek Jan 9, 2023
0f9b0f6
Merge branch 'main' into 3522-enterprise-1
mtojek Jan 9, 2023
3ecfad7
Fix
mtojek Jan 9, 2023
05b6a98
Clean templates
mtojek Jan 9, 2023
03d9e9a
Merge branch 'main' into 3522-enterprise-1
mtojek Jan 11, 2023
1ebf408
Sort API pages
mtojek Jan 11, 2023
c2977cf
Fix: HashedSecret
mtojek Jan 11, 2023
cbacf76
WIP
mtojek Jan 11, 2023
08f1f26
Merge branch 'main' into 3522-validation
mtojek Jan 11, 2023
b23edb4
WIP
mtojek Jan 11, 2023
2f70137
WIP
mtojek Jan 12, 2023
33d93d6
Fix: cover workspaceagents
mtojek Jan 12, 2023
76701b8
Assert: consistent ID and summary
mtojek Jan 12, 2023
7165276
Assert: success or failure defined
mtojek Jan 12, 2023
12e502a
Fix: parallel
mtojek Jan 12, 2023
b501822
Refactor
mtojek Jan 12, 2023
1d30352
Support enterprise
mtojek Jan 12, 2023
9272c01
Go comment goes to top
mtojek Jan 12, 2023
38b6dad
Security
mtojek Jan 12, 2023
a565c15
assertPathParametersDefined
mtojek Jan 12, 2023
1bc8556
assertUniqueRoutes
mtojek Jan 12, 2023
d0964f9
assertRequestBody
mtojek Jan 12, 2023
b2d838f
More fixes
mtojek Jan 12, 2023
182419a
Fix: exceptions
mtojek Jan 12, 2023
cb78089
Fix field format
mtojek Jan 12, 2023
fa2d030
Address PR comments
mtojek Jan 13, 2023
ecb2d5a
Refactor
mtojek Jan 13, 2023
47b6d3e
Merge branch 'main' into 3522-validation
mtojek Jan 13, 2023
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
Agents
  • Loading branch information
mtojek committed Jan 2, 2023
commit ce8c7eacbbc72c97b8e7db96cd4092495c30b08f
62 changes: 62 additions & 0 deletions coderd/apidoc/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,29 @@ const docTemplate = `{
}
}
},
"/workspaceagents/me/coordinate": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"description": "It accepts a WebSocket connection to an agent that listens to\nincoming connections and publishes node updates.",
"produces": [
"application/json"
],
"tags": [
"Agents"
],
"summary": "Coordinate workspace agent via Tailnet",
"operationId": "get-workspace-agent-git-ssh-key-via-tailnet",
"responses": {
"101": {
"description": "Switching Protocols"
}
}
}
},
"/workspaceagents/me/gitauth": {
"get": {
"security": [
Expand Down Expand Up @@ -1060,6 +1083,34 @@ const docTemplate = `{
}
}
},
"/workspaceagents/me/gitsshkey": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Agents"
],
"summary": "Get workspace agent Git SSH key",
"operationId": "get-workspace-agent-git-ssh-key",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.AgentGitSSHKey"
}
}
}
}
},
"/workspaceagents/me/metadata": {
"get": {
"security": [
Expand Down Expand Up @@ -1706,6 +1757,17 @@ const docTemplate = `{
}
}
},
"codersdk.AgentGitSSHKey": {
"type": "object",
"properties": {
"private_key": {
"type": "string"
},
"public_key": {
"type": "string"
}
}
},
"codersdk.AgentStats": {
"type": "object",
"properties": {
Expand Down
52 changes: 52 additions & 0 deletions coderd/apidoc/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,25 @@
}
}
},
"/workspaceagents/me/coordinate": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"description": "It accepts a WebSocket connection to an agent that listens to\nincoming connections and publishes node updates.",
"produces": ["application/json"],
"tags": ["Agents"],
"summary": "Coordinate workspace agent via Tailnet",
"operationId": "get-workspace-agent-git-ssh-key-via-tailnet",
"responses": {
"101": {
"description": "Switching Protocols"
}
}
}
},
"/workspaceagents/me/gitauth": {
"get": {
"security": [
Expand Down Expand Up @@ -920,6 +939,28 @@
}
}
},
"/workspaceagents/me/gitsshkey": {
"get": {
"security": [
{
"CoderSessionToken": []
}
],
"consumes": ["application/json"],
"produces": ["application/json"],
"tags": ["Agents"],
"summary": "Get workspace agent Git SSH key",
"operationId": "get-workspace-agent-git-ssh-key",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/codersdk.AgentGitSSHKey"
}
}
}
}
},
"/workspaceagents/me/metadata": {
"get": {
"security": [
Expand Down Expand Up @@ -1488,6 +1529,17 @@
}
}
},
"codersdk.AgentGitSSHKey": {
"type": "object",
"properties": {
"private_key": {
"type": "string"
},
"public_key": {
"type": "string"
}
}
},
"codersdk.AgentStats": {
"type": "object",
"properties": {
Expand Down
8 changes: 8 additions & 0 deletions coderd/gitsshkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ func (api *API) gitSSHKey(rw http.ResponseWriter, r *http.Request) {
})
}

// @Summary Get workspace agent Git SSH key
// @ID get-workspace-agent-git-ssh-key
// @Security CoderSessionToken
// @Accept json
// @Produce json
// @Tags Agents
// @Success 200 {object} codersdk.AgentGitSSHKey
// @Router /workspaceagents/me/gitsshkey [get]
func (api *API) agentGitSSHKey(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()
agent := httpmw.WorkspaceAgent(r)
Expand Down
9 changes: 9 additions & 0 deletions coderd/workspaceagents.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,15 @@ func (api *API) workspaceAgentConnection(rw http.ResponseWriter, r *http.Request
})
}

// @Summary Coordinate workspace agent via Tailnet
// @Description It accepts a WebSocket connection to an agent that listens to
// @Description incoming connections and publishes node updates.
// @ID get-workspace-agent-git-ssh-key-via-tailnet
// @Security CoderSessionToken
// @Produce json
// @Tags Agents
// @Success 101
// @Router /workspaceagents/me/coordinate [get]
func (api *API) workspaceAgentCoordinate(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()

Expand Down
55 changes: 55 additions & 0 deletions docs/api/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,29 @@ curl -X POST http://coder-server:8080/api/v2/workspaceagents/me/app-health \

To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**.

## Coordinate workspace agent via Tailnet

### Code samples

```shell
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/workspaceagents/me/coordinate \
-H 'Coder-Session-Token: API_KEY'
```

`GET /workspaceagents/me/coordinate`

It accepts a WebSocket connection to an agent that listens to
incoming connections and publishes node updates.

### Responses

| Status | Meaning | Description | Schema |
| ------ | ------------------------------------------------------------------------ | ------------------- | ------ |
| 101 | [Switching Protocols](https://tools.ietf.org/html/rfc7231#section-6.2.2) | Switching Protocols | |

To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**.

## Get workspace agent Git auth

### Code samples
Expand Down Expand Up @@ -220,6 +243,38 @@ curl -X GET http://coder-server:8080/api/v2/workspaceagents/me/gitauth?url=http%

To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**.

## Get workspace agent Git SSH key

### Code samples

```shell
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/workspaceagents/me/gitsshkey \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```

`GET /workspaceagents/me/gitsshkey`

### Example responses

> 200 Response

```json
{
"private_key": "string",
"public_key": "string"
}
```

### Responses

| Status | Meaning | Description | Schema |
| ------ | ------------------------------------------------------- | ----------- | ------------------------------------------------------------ |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.AgentGitSSHKey](schemas.md#codersdkagentgitsshkey) |

To perform this operation, you must be authenticated by means of one of the following methods: **CoderSessionToken**.

## Get authorized workspace agent metadata

### Code samples
Expand Down
16 changes: 16 additions & 0 deletions docs/api/schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@
| `document` | string | true | | |
| `signature` | string | true | | |

## codersdk.AgentGitSSHKey

```json
{
"private_key": "string",
"public_key": "string"
}
```

### Properties

| Name | Type | Required | Restrictions | Description |
| ------------- | ------ | -------- | ------------ | ----------- |
| `private_key` | string | false | | |
| `public_key` | string | false | | |

## codersdk.AgentStats

```json
Expand Down