Skip to content

Commit

Permalink
fix some swagger comments
Browse files Browse the repository at this point in the history
  • Loading branch information
IngoRoessner committed Sep 9, 2024
1 parent f79e120 commit 128e398
Show file tree
Hide file tree
Showing 6 changed files with 222 additions and 25 deletions.
86 changes: 80 additions & 6 deletions docs/devicemanager_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1317,15 +1317,15 @@ const docTemplatedevicemanager = `{
"Bearer": []
}
],
"description": "get device-type",
"description": "delete device-type",
"produces": [
"application/json"
],
"tags": [
"get",
"delete",
"device-types"
],
"summary": "get device-type",
"summary": "delete device-type",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1746,6 +1746,80 @@ const docTemplatedevicemanager = `{
}
},
"/devices/{id}/attributes": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "set device attributes",
"produces": [
"application/json"
],
"tags": [
"set",
"devices"
],
"summary": "set device attributes",
"parameters": [
{
"type": "string",
"description": "Device Id",
"name": "id",
"in": "path",
"required": true
},
{
"type": "boolean",
"description": "wait for done message in kafka before responding",
"name": "wait",
"in": "query"
},
{
"type": "string",
"description": "comma separated list; ensure that no attribute from another origin is overwritten",
"name": "update-only-same-origin-attributes",
"in": "query"
},
{
"description": "attributes",
"name": "message",
"in": "body",
"required": true,
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Attribute"
}
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Device"
}
},
"400": {
"description": "Bad Request"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/devices/{id}/display_name": {
"put": {
"security": [
{
Expand Down Expand Up @@ -2900,15 +2974,15 @@ const docTemplatedevicemanager = `{
"Bearer": []
}
],
"description": "get protocol",
"description": "create protocol",
"produces": [
"application/json"
],
"tags": [
"get",
"create",
"protocols"
],
"summary": "get protocol",
"summary": "create protocol",
"parameters": [
{
"type": "boolean",
Expand Down
86 changes: 80 additions & 6 deletions docs/devicemanager_swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1309,15 +1309,15 @@
"Bearer": []
}
],
"description": "get device-type",
"description": "delete device-type",
"produces": [
"application/json"
],
"tags": [
"get",
"delete",
"device-types"
],
"summary": "get device-type",
"summary": "delete device-type",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1738,6 +1738,80 @@
}
},
"/devices/{id}/attributes": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "set device attributes",
"produces": [
"application/json"
],
"tags": [
"set",
"devices"
],
"summary": "set device attributes",
"parameters": [
{
"type": "string",
"description": "Device Id",
"name": "id",
"in": "path",
"required": true
},
{
"type": "boolean",
"description": "wait for done message in kafka before responding",
"name": "wait",
"in": "query"
},
{
"type": "string",
"description": "comma separated list; ensure that no attribute from another origin is overwritten",
"name": "update-only-same-origin-attributes",
"in": "query"
},
{
"description": "attributes",
"name": "message",
"in": "body",
"required": true,
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Attribute"
}
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Device"
}
},
"400": {
"description": "Bad Request"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/devices/{id}/display_name": {
"put": {
"security": [
{
Expand Down Expand Up @@ -2892,15 +2966,15 @@
"Bearer": []
}
],
"description": "get protocol",
"description": "create protocol",
"produces": [
"application/json"
],
"tags": [
"get",
"create",
"protocols"
],
"summary": "get protocol",
"summary": "create protocol",
"parameters": [
{
"type": "boolean",
Expand Down
61 changes: 55 additions & 6 deletions docs/devicemanager_swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ paths:
- device-types
/device-types/{id}:
delete:
description: get device-type
description: delete device-type
parameters:
- description: DeviceType Id
in: path
Expand Down Expand Up @@ -1143,9 +1143,9 @@ paths:
description: Internal Server Error
security:
- Bearer: []
summary: get device-type
summary: delete device-type
tags:
- get
- delete
- device-types
get:
description: get device-type
Expand Down Expand Up @@ -1477,6 +1477,55 @@ paths:
- set
- devices
/devices/{id}/attributes:
put:
description: set device attributes
parameters:
- description: Device Id
in: path
name: id
required: true
type: string
- description: wait for done message in kafka before responding
in: query
name: wait
type: boolean
- description: comma separated list; ensure that no attribute from another origin
is overwritten
in: query
name: update-only-same-origin-attributes
type: string
- description: attributes
in: body
name: message
required: true
schema:
items:
$ref: '#/definitions/models.Attribute'
type: array
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Device'
"400":
description: Bad Request
"401":
description: Unauthorized
"403":
description: Forbidden
"404":
description: Not Found
"500":
description: Internal Server Error
security:
- Bearer: []
summary: set device attributes
tags:
- set
- devices
/devices/{id}/display_name:
put:
description: set device display name
parameters:
Expand Down Expand Up @@ -2224,7 +2273,7 @@ paths:
- locations
/protocols:
post:
description: get protocol
description: create protocol
parameters:
- description: wait for done message in kafka before responding
in: query
Expand Down Expand Up @@ -2255,9 +2304,9 @@ paths:
description: Internal Server Error
security:
- Bearer: []
summary: get protocol
summary: create protocol
tags:
- get
- create
- protocols
/protocols/{id}:
delete:
Expand Down
2 changes: 1 addition & 1 deletion lib/api/devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func (this *DevicesEndpoints) SetAttributes(config config.Config, router *http.S
// @Failure 403
// @Failure 404
// @Failure 500
// @Router /devices/{id}/attributes [PUT]
// @Router /devices/{id}/display_name [PUT]
func (this *DevicesEndpoints) SetDisplayName(config config.Config, router *http.ServeMux, control Controller) {
router.HandleFunc("PUT /devices/{id}/display_name", func(writer http.ResponseWriter, request *http.Request) {
id := request.PathValue("id")
Expand Down
6 changes: 3 additions & 3 deletions lib/api/devicetypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ func (this *DeviceTypesEndpoints) Set(config config.Config, router *http.ServeMu
}

// Delete godoc
// @Summary get device-type
// @Description get device-type
// @Tags get, device-types
// @Summary delete device-type
// @Description delete device-type
// @Tags delete, device-types
// @Produce json
// @Security Bearer
// @Param id path string true "DeviceType Id"
Expand Down
6 changes: 3 additions & 3 deletions lib/api/protocols.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ func (this *ProtocolsEndpoints) Get(config config.Config, router *http.ServeMux,
}

// Create godoc
// @Summary get protocol
// @Description get protocol
// @Tags get, protocols
// @Summary create protocol
// @Description create protocol
// @Tags create, protocols
// @Produce json
// @Security Bearer
// @Param wait query bool false "wait for done message in kafka before responding"
Expand Down

0 comments on commit 128e398

Please sign in to comment.