Fix: Make swagger doc compliant to OpenAPI (#3394)

This fixes issues in the swagger.json file. The motivation to do so is to be able to generate API clients using https://openapi-generator.tech Doing so will require further changes to the api spec, but this seems like a good first step since it is now "valid" according to editor.swagger.io and openapi-generator validate.

Fixes #2806
This commit is contained in:
Jan-David
2021-11-17 14:25:15 +01:00
committed by GitHub
parent d227a56747
commit e500d1216b
55 changed files with 527 additions and 695 deletions

View File

@@ -10,7 +10,7 @@ responses:
type: array
description: 'Array of agent bots'
items:
- $ref: '#/definitions/agent_bot'
$ref: '#/definitions/agent_bot'
401:
description: Unauthorized

View File

@@ -11,21 +11,22 @@ parameters:
required: true
schema:
type: object
required:
- name
- email
- role
properties:
name:
name:
type: string
description: Full Name of the agent
required: true
email:
type: string
description: Email of the Agent
required: true
role:
role:
type: string
enum: ['agent', 'administrator']
description: Whether its administrator or agent
required: true
availability_status:
availability_status:
type: string
enum: ['available', 'busy', 'offline']
description: The availability setting of the agent.

View File

@@ -8,8 +8,7 @@ security:
parameters:
- in: path
name: id
schema:
type: integer
type: integer
required: true
description: The ID of the agent to be deleted
responses:

View File

@@ -8,8 +8,7 @@ security:
parameters:
- in: path
name: id
schema:
type: integer
type: integer
required: true
description: The ID of the agent to be updated.
- name: data
@@ -17,13 +16,14 @@ parameters:
required: true
schema:
type: object
required:
- role
properties:
role:
role:
type: string
enum: ['agent', 'administrator']
description: Whether its administrator or agent
required: true
availability:
availability:
type: string
enum: ['available', 'busy', 'offline']
description: The availability setting of the agent.
@@ -39,4 +39,4 @@ responses:
404:
description: Agent not found
403:
description: Access denied
description: Access denied

View File

@@ -16,13 +16,15 @@ post:
required: true
schema:
type: object
required:
- inbox_id
properties:
inbox_id:
type: number
description: The ID of the inbox
required: true
source_id:
$ref: '#/parameters/source_id'
type: string
description: Contact Inbox Source Id
responses:
200:
description: Success

View File

@@ -1,16 +1,17 @@
parameters:
- $ref: '#/parameters/account_id'
- name: id
in: path
type: number
description: ID of the contact
required: true
get:
tags:
- Contact
operationId: contactDetails
summary: Show Contact
description: Get a contact belonging to the account using ID
parameters:
- $ref: '#/parameters/account_id'
- name: id
in: path
type: number
description: ID of the contact
required: true
responses:
200:
description: Success
@@ -28,12 +29,6 @@ put:
summary: Update Contact
description: Update a contact belonging to the account using ID
parameters:
- $ref: '#/parameters/account_id'
- name: id
in: path
type: number
description: ID of the contact
required: true
- name: data
in: body
required: true
@@ -54,16 +49,10 @@ delete:
- Contact
operationId: contactDelete
summary: Delete Contact
parameters:
- name: id
in: path
type: number
description: ID of the contact
required: true
responses:
200:
description: Success
401:
description: Unauthorized
404:
description: Contact not found
description: Contact not found

View File

@@ -1,41 +0,0 @@
get:
tags:
- Conversation
operationId: conversationList
description: List all the conversations with pagination
summary: Conversations List
parameters:
- $ref: '#/parameters/account_id'
- name: assignee_type
in: query
type: string
enum: ['me', 'unassigned', 'all', 'assigned']
required: true
- name: status
in: query
type: string
enum: ['open', 'resolved', 'pending']
required: true
- name: page
in: query
type: integer
required: true
- name: inbox_id
in: query
type: integer
- name: labels
in: query
type: array
items:
type: string
responses:
200:
description: Success
schema:
$ref: '#/definitions/conversation_list'
400:
description: Bad Request Error
schema:
$ref: '#/definitions/bad_request_error'
description: Access denied

View File

@@ -1,44 +1,43 @@
post:
tags:
- Conversation
operationId: conversationFilter
description: Filter conversations with custom filter options and pagination
summary: Conversations Filter
security:
- userApiKey: []
- agentBotApiKey: []
parameters:
- name: page
in: query
type: integer
- name: payload
in: body
required: true
schema:
type: array
items:
type: object
properties:
attribute_key:
tags:
- Conversation
operationId: conversationFilter
description: Filter conversations with custom filter options and pagination
summary: Conversations Filter
security:
- userApiKey: []
- agentBotApiKey: []
parameters:
- name: page
in: query
type: integer
- name: payload
in: body
required: true
schema:
type: array
items:
type: object
properties:
attribute_key:
type: string
description: filter attribute name
filter_operator:
type: string
description: filter operator name
values:
type: array
items:
type: string
description: filter attribute name
filter_operator:
type: string
description: filter operator name
values:
type: array
description: array of the attribute values to filter
query_operator:
type: string
description: query operator name
- $ref: '#/parameters/account_id'
responses:
200:
description: Success
schema:
$ref: '#/definitions/conversation_list'
400:
description: Bad Request Error
schema:
$ref: '#/definitions/bad_request_error'
description: Access denied
description: array of the attribute values to filter
query_operator:
type: string
description: query operator name
responses:
200:
description: Success
schema:
$ref: '#/definitions/conversation_list'
400:
description: Bad Request Error
schema:
$ref: '#/definitions/bad_request_error'

View File

@@ -1,24 +1,27 @@
parameters:
- $ref: '#/parameters/account_id'
get:
tags:
- Conversation
operationId: conversationSearch
description: Search for conversations containing a messages with the query string
summary: Conversations Search
operationId: conversationList
description: List all the conversations with pagination
summary: Conversations List
parameters:
- name: q
in: query
type: string
- name: assignee_type
in: query
type: string
enum: ['me', 'unassigned', 'all', 'assigned']
required: true
- name: status
in: query
type: string
enum: ['open', 'resolved', 'pending', 'all']
enum: ['open', 'resolved', 'pending']
required: true
- name: page
in: query
type: integer
required: true
- name: inbox_id
in: query
type: integer
@@ -27,7 +30,6 @@ get:
type: array
items:
type: string
- $ref: '#/parameters/account_id'
responses:
200:
@@ -38,8 +40,6 @@ get:
description: Bad Request Error
schema:
$ref: '#/definitions/bad_request_error'
description: Access denied
post:
tags:
@@ -51,7 +51,6 @@ post:
- userApiKey: []
- agentBotApiKey: []
parameters:
- $ref: '#/parameters/account_id'
- name: data
in: body
required: true
@@ -59,7 +58,8 @@ post:
type: object
properties:
source_id:
$ref: '#/parameters/source_id'
type: string
description: Conversation source id
inbox_id:
type: string
description: "Id of inbox in which the conversation is created <br/> Allowed Inbox Types: Website, Phone, Api, Email "

View File

@@ -13,7 +13,7 @@ parameters:
labels:
type: array
description: Array of labels (comma-separated strings)
properties:
items:
type: string
responses:
200:

View File

@@ -31,7 +31,8 @@ post:
type: array
description: The files to be uploaded.
items:
type: file
type: string
format: binary
responses:

View File

@@ -6,12 +6,13 @@ description: List all messages of a conversation
responses:
200:
description: Success
type: array
description: Array of messages
schema:
allOf:
- $ref: '#/definitions/generic_id'
- $ref: '#/definitions/message'
type: array
description: Array of messages
items:
allOf:
- $ref: '#/definitions/generic_id'
- $ref: '#/definitions/message'
404:
description: Conversation not found
401:

View File

@@ -12,11 +12,12 @@ parameters:
required: true
schema:
type: object
required:
- status
properties:
status:
type: string
enum: ["open", "resolved", "pending"]
required: true
description: The status of the conversation
responses:
200:

View File

@@ -16,7 +16,8 @@ post:
type: string
description: The name of the inbox
avatar:
type: file
type: string
format: binary
description: File for avatar image
channel:
type: object

View File

@@ -11,15 +11,18 @@ parameters:
required: true
schema:
type: object
required:
- inbox_id
- user_ids
properties:
inbox_id:
type: string
description: The ID of the inbox
required: true
user_ids:
user_ids:
type: array
items:
type: integer
description: IDs of users to be added to the inbox
required: true
responses:
200:
description: Success

View File

@@ -11,15 +11,18 @@ parameters:
required: true
schema:
type: object
required:
- inbox_id
- user_ids
properties:
inbox_id:
type: string
description: The ID of the inbox
required: true
user_ids:
user_ids:
type: array
items:
type: integer
description: IDs of users to be deleted from the inbox
required: true
responses:
200:
description: Success

View File

@@ -2,7 +2,7 @@ tags:
- Inbox
operationId: update-agents-in-inbox
summary: Update Agents in Inbox
description: All agents execept the one passed in params will be removed
description: All agents except the one passed in params will be removed
security:
- userApiKey: []
parameters:
@@ -11,15 +11,18 @@ parameters:
required: true
schema:
type: object
required:
- inbox_id
- user_ids
properties:
inbox_id:
type: string
description: The ID of the inbox
required: true
user_ids:
user_ids:
type: array
items:
type: integer
description: IDs of users to be added to the inbox
required: true
responses:
200:
description: Success

View File

@@ -16,10 +16,11 @@ post:
required: true
schema:
type: object
required:
- agent_bot
properties:
agent_bot:
type: number
required: true
description: 'Agent bot ID'
responses:
204:

View File

@@ -16,17 +16,18 @@ patch:
required: true
schema:
type: object
required:
- enable_auto_assignment
properties:
name:
type: string
description: The name of the inbox
enable_auto_assignment:
type: boolean
required: true
description: 'Enable Auto Assignment'
avatar:
type: file
required: false
type: string
format: binary
description: 'Image file for avatar'
channel:
type: object