Skip to content
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

[ID-110]Fix API docs #119

Open
wants to merge 27 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- Fix API docs [#110](https://github.com/rokwire/notifications-building-block/issues/110)

## [1.6.0] - 2022-12-06
### Added
Expand Down
9 changes: 5 additions & 4 deletions driver/web/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ import (

// Adapter entity
type Adapter struct {
host string
port string
host string
port string
notificationsServiceURL string

auth *Auth

Expand Down Expand Up @@ -132,7 +133,7 @@ func (we Adapter) serveDoc(w http.ResponseWriter, r *http.Request) {
}

func (we Adapter) serveDocUI() http.Handler {
url := fmt.Sprintf("%s/doc", we.host)
url := fmt.Sprintf("%s/doc", we.notificationsServiceURL)
return httpSwagger.Handler(httpSwagger.URL(url))
}

Expand Down Expand Up @@ -212,7 +213,7 @@ func NewWebAdapter(host string, port string, app *core.Application, config *mode
bbsApisHandler := rest.NewBBsAPIsHandler(app)
return Adapter{host: host, port: port, cachedYamlDoc: yamlDoc, auth: auth, apisHandler: apisHandler,
adminApisHandler: adminApisHandler, internalApisHandler: internalApisHandler, bbsApisHandler: bbsApisHandler,
app: app, logger: logger}
app: app, logger: logger, notificationsServiceURL: config.NotificationsServiceURL}
}

// AppListener implements core.ApplicationListener interface
Expand Down
107 changes: 67 additions & 40 deletions driver/web/docs/gen/def.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ paths:
post:
tags:
- Internal
summary: Create message
deprecated: true
summary: Create message
description: |
Create message
security:
Expand Down Expand Up @@ -285,52 +285,41 @@ paths:
- name: offset
in: query
description: offset
required: true
style: simple
explode: false
schema:
type: string
- name: limit
in: query
description: limit
required: true
style: simple
explode: false
schema:
type: string
- name: order
in: query
description: 'order - Possible values: asc, desc. Default: desc'
required: true
style: simple
explode: false
schema:
type: string
- name: start_date
in: query
description: start_date - Start date filter in milliseconds as an integer epoch value
required: true
style: simple
explode: false
schema:
type: string
- name: end_date
in: query
description: end_date - End date filter in milliseconds as an integer epoch value
required: true
style: simple
explode: false
schema:
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Message'
'400':
description: Bad request
'401':
Expand Down Expand Up @@ -376,9 +365,24 @@ paths:
Update read status of all messages where the current user is defined as a recipient
security:
- bearerAuth: []
parameters:
- name: id
in: path
description: The message id
required: true
style: simple
explode: false
schema:
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Message'
'400':
description: Bad request
'401':
Expand Down Expand Up @@ -415,7 +419,7 @@ paths:
parameters:
- name: id
in: path
description: offset
description: id
required: true
style: simple
explode: false
Expand Down Expand Up @@ -471,15 +475,16 @@ paths:
Update message
security:
- bearerAuth: []
parameters:
- name: id
in: path
description: offset
required: true
style: simple
explode: false
schema:
type: string
requestBody:
description: body json of the read boolean
content:
application/json:
schema:
type: object
properties:
read:
type: boolean
required: true
responses:
'200':
description: Success
Expand Down Expand Up @@ -540,39 +545,34 @@ paths:
- name: offset
in: query
description: offset
required: true
style: simple
explode: false
schema:
type: string
- name: limit
in: query
description: limit - limit the result
required: true
style: simple
explode: false
schema:
type: string
- name: order
in: query
description: 'order - Possible values: asc, desc. Default: desc'
required: true
style: simple
explode: false
schema:
type: string
- name: start_date
in: query
description: start_date - Start date filter in milliseconds as an integer epoch value
required: true
style: simple
explode: false
schema:
type: string
- name: end_date
in: query
description: end_date - End date filter in milliseconds as an integer epoch value
required: true
style: simple
explode: false
schema:
Expand Down Expand Up @@ -778,46 +778,79 @@ paths:
$ref: '#/components/schemas/_client_req_message'
required: true
parameters:
- name: read
in: query
description: read
style: simple
explode: false
schema:
type: boolean
- name: mute
in: query
description: mute
style: simple
explode: false
schema:
type: boolean
- name: offset
in: query
description: offset
required: true
style: simple
explode: false
schema:
type: string
- name: limit
in: query
description: limit
required: true
style: simple
explode: false
schema:
type: string
- name: order
in: query
description: 'order - Possible values: asc, desc. Default: desc'
required: true
style: simple
explode: false
schema:
type: string
- name: start_date
in: query
description: start_date - Start date filter in milliseconds as an integer epoch value
required: true
style: simple
explode: false
schema:
type: string
- name: end_date
in: query
description: end_date - End date filter in milliseconds as an integer epoch value
required: true
style: simple
explode: false
schema:
type: string
responses:
'200':
description: Success
'400':
description: Bad request
'401':
description: Unauthorized
'500':
description: Internal error
delete:
tags:
- Client
summary: Removes the current user from the recipient list of all described
description: |
Removes the current user from the recipient list of all described
security:
- bearerAuth: []
requestBody:
description: body json of the all message ids that need to be filtered
content:
application/json:
schema:
$ref: '#/components/schemas/_client_req_message'
required: true
responses:
'200':
description: Success
Expand Down Expand Up @@ -847,7 +880,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/InputMessage'
$ref: '#/components/schemas/_client_req_messageV2'
required: true
responses:
'200':
Expand Down Expand Up @@ -938,7 +971,7 @@ paths:
parameters:
- name: id
in: path
description: The message
description: The message id
required: true
style: simple
explode: false
Expand Down Expand Up @@ -1266,12 +1299,6 @@ components:
properties:
token:
type: string
previous_token:
type: string
app_version:
type: string
app_platform:
type: string
_client_req_user:
required:
- notifications_disabled
Expand Down
2 changes: 1 addition & 1 deletion driver/web/docs/resources/admin/message/message.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ post:
content:
application/json:
schema:
$ref: "../../../schemas/application/InputMessage.yaml"
$ref: "../../../schemas/apis/messageV2/request/Request.yaml"
required: true
responses:
200:
Expand Down
2 changes: 1 addition & 1 deletion driver/web/docs/resources/admin/message/messages-id.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ delete:
parameters:
- name: id
in: path
description: The message
description: The message id
required: true
style: simple
explode: false
Expand Down
Loading