1
0
mirror of https://github.com/mainflux/mainflux.git synced 2025-04-26 13:48:53 +08:00
Ian Ngethe Muchiri 7948aa72e8
MF-1761 - Improve path parameters naming (#1762)
* Improve path parameters naming

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* Improve path parameter naming

improve path parameter naming for:
   bootstrap/api/transport.go
   twins/api/http/transport.go

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* Change functions to suit updated path params

Duplicated the functions decodeView and decodeListByConnection to
form new functions decodeThingView, decodeChannelView,
decodeThingListByConnection and decodeChannelListByConnection. This
was as a result of the two functions being used for both view thing
and view channel services

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* Improve path parameter naming

Improve path parameter naming for:
    auth/api/http/groups/transport.go
    bootstrap/api/transport.go
    twins/api/http/transport.go
    ws/api/endpoints.go

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* fix swagger files

Updated the following swagger files
    api/openapi/auth.yml
    api/openapi/cert.yml
    api/openapi/websocket.yml

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* Move websocket.yml from openapi to asyncapi

deleted websocket.yml file in openapi and created websocket.yml file
in asyncapi

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* Update websocket.yml file

Update the websocket.yml file to make subtopic optional and
added security (bearerAuth)

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* Format new line correctly

format newline for api/asyncapi/websocket.yml

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* update websocket.yml file

update the websocket.yml file based on the requested review changes
    The document is now valid

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* Update path parameter naming

make changes to path parameter naming in:
    api/openapi/consumers-notifiers.yml

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* update path parameters naming

Update path parameters naming to be consistent with Go

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* update the mqtt.yml file

update the mqtt.yml file to the latest AsyncAPI version and
make changes on the security of the server

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* Add contact information

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* Update api/asyncapi/mqtt.yml

Co-authored-by: b1ackd0t <blackd0t@protonmail.com>
Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

* Add an empty line between functions

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>

---------

Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>
Co-authored-by: b1ackd0t <blackd0t@protonmail.com>
Co-authored-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
2023-04-20 21:53:02 +02:00

110 lines
2.9 KiB
YAML

asyncapi: '2.6.0'
id: 'https://github.com/mainflux/mainflux/blob/master/api/asyncapi/mqtt.yml'
info:
title: Mainflux MQTT Adapter
version: '1.0.0'
contact:
name: Mainflux Team
url: 'https://github.com/mainflux/mainflux'
email: info@mainflux.com
description: |
MQTT adapter provides an MQTT API for sending messages through the platform. MQTT adapter uses [mProxy](https://github.com/mainflux/mproxy) for proxying traffic between client and MQTT broker.
Additionally, the MQTT adapter and the message broker are replicating the traffic between brokers.
license:
name: Apache 2.0
url: 'https://github.com/mainflux/mainflux/blob/master/LICENSE'
defaultContentType: application/json
servers:
dev:
url: localhost:{port}
protocol: mqtt
description: Test broker
variables:
port:
description: Secure connection (TLS) is available through port 8883.
default: '1883'
enum:
- '1883'
- '8883'
security:
- user-password: []
channels:
channels/{channelID}/messages/{subtopic}:
parameters:
channelID:
$ref: '#/components/parameters/channelID'
in: path
required: true
subtopic:
$ref: '#/components/parameters/subtopic'
in: path
required: false
publish:
traits:
- $ref: '#/components/operationTraits/mqtt'
message:
$ref: '#/components/messages/jsonMsg'
subscribe:
traits:
- $ref: '#/components/operationTraits/mqtt'
message:
$ref: '#/components/messages/jsonMsg'
components:
messages:
jsonMsg:
title: JSON Message
summary: Arbitrary JSON array or object.
contentType: application/json
payload:
$ref: "#/components/schemas/jsonMsg"
schemas:
jsonMsg:
type: object
description: Arbitrary JSON object or array. SenML format is recommended.
example: |
### SenML
```json
[{"bn":"some-base-name:","bt":1641646520, "bu":"A","bver":5, "n":"voltage","u":"V","v":120.1}, {"n":"current","t":-5,"v":1.2}, {"n":"current","t":-4,"v":1.3}]
```
### JSON
```json
{"field_1":"val_1", "t": 1641646525}
```
### JSON Array
```json
[{"field_1":"val_1", "t": 1641646520},{"field_2":"val_2", "t": 1641646522}]
```
parameters:
channelID:
description: Channel ID connected to the Thing ID defined in the username.
schema:
type: string
format: uuid
subtopic:
description: Arbitrary message subtopic.
schema:
type: string
default: ''
securitySchemes:
user-password:
type: userPassword
description: |
username is thing ID connected to the channel defined in the mqtt topic and
password is thing key corresponding to the thing ID
operationTraits:
mqtt:
bindings:
mqtt:
qos: 2