Skip to content

Commit

Permalink
Bug/make swagger json output openapi 3 compliant (#2219)
Browse files Browse the repository at this point in the history
update source to ensure swagger.json is openapi 3.0.0 compliant
  • Loading branch information
MrSimonC authored Sep 4, 2024
1 parent 5c40419 commit 7594841
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 52 deletions.
6 changes: 0 additions & 6 deletions server/endpoints/api/admin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ function apiAdminEndpoints(app) {
#swagger.requestBody = {
description: 'Key pair object that will define the new user to add to the system.',
required: true,
type: 'object',
content: {
"application/json": {
example: {
Expand Down Expand Up @@ -153,7 +152,6 @@ function apiAdminEndpoints(app) {
#swagger.requestBody = {
description: 'Key pair object that will update the found user. All fields are optional and will not update unless specified.',
required: true,
type: 'object',
content: {
"application/json": {
example: {
Expand Down Expand Up @@ -321,7 +319,6 @@ function apiAdminEndpoints(app) {
#swagger.requestBody = {
description: 'Request body for creation parameters of the invitation',
required: false,
type: 'object',
content: {
"application/json": {
example: {
Expand Down Expand Up @@ -493,7 +490,6 @@ function apiAdminEndpoints(app) {
#swagger.requestBody = {
description: 'Entire array of user ids who can access the workspace. All fields are optional and will not update unless specified.',
required: true,
type: 'object',
content: {
"application/json": {
example: {
Expand Down Expand Up @@ -553,7 +549,6 @@ function apiAdminEndpoints(app) {
#swagger.requestBody = {
description: 'Page offset to show of workspace chats. All fields are optional and will not update unless specified.',
required: false,
type: 'integer',
content: {
"application/json": {
example: {
Expand Down Expand Up @@ -660,7 +655,6 @@ function apiAdminEndpoints(app) {
#swagger.requestBody = {
description: 'Object with setting key and new value to set. All keys are optional and will not update unless specified.',
required: true,
type: 'object',
content: {
"application/json": {
example: {
Expand Down
10 changes: 3 additions & 7 deletions server/endpoints/api/document/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ function apiDocumentEndpoints(app) {
#swagger.requestBody = {
description: 'File to be uploaded.',
required: true,
type: 'file',
content: {
"multipart/form-data": {
schema: {
type: 'object',
type: 'string',
format: 'binary',
properties: {
file: {
type: 'string',
Expand Down Expand Up @@ -131,7 +131,6 @@ function apiDocumentEndpoints(app) {
#swagger.requestBody = {
description: 'Link of web address to be scraped.',
required: true,
type: 'object',
content: {
"application/json": {
schema: {
Expand Down Expand Up @@ -229,7 +228,6 @@ function apiDocumentEndpoints(app) {
#swagger.requestBody = {
description: 'Text content and metadata of the file to be saved to the system. Use metadata-schema endpoint to get the possible metadata keys',
required: true,
type: 'object',
content: {
"application/json": {
schema: {
Expand Down Expand Up @@ -571,11 +569,10 @@ function apiDocumentEndpoints(app) {
#swagger.requestBody = {
description: 'Name of the folder to create.',
required: true,
type: 'object',
content: {
"application/json": {
schema: {
type: 'object',
type: 'string',
example: {
"name": "new-folder"
}
Expand Down Expand Up @@ -638,7 +635,6 @@ function apiDocumentEndpoints(app) {
#swagger.requestBody = {
description: 'Array of objects containing source and destination paths of files to move.',
required: true,
type: 'object',
content: {
"application/json": {
schema: {
Expand Down
2 changes: 0 additions & 2 deletions server/endpoints/api/openai/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ function apiOpenAICompatibleEndpoints(app) {
#swagger.requestBody = {
description: 'Send a prompt to the workspace with full use of documents as if sending a chat in AnythingLLM. Only supports some values of OpenAI API. See example below.',
required: true,
type: 'object',
content: {
"application/json": {
example: {
Expand Down Expand Up @@ -205,7 +204,6 @@ function apiOpenAICompatibleEndpoints(app) {
#swagger.requestBody = {
description: 'The input string(s) to be embedded. If the text is too long for the embedder model context, it will fail to embed. The vector and associated chunk metadata will be returned in the array order provided',
required: true,
type: 'object',
content: {
"application/json": {
example: {
Expand Down
1 change: 0 additions & 1 deletion server/endpoints/api/system/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ function apiSystemEndpoints(app) {
#swagger.requestBody = {
description: 'Key pair object that matches a valid setting and value. Get keys from GET /v1/system or refer to codebase.',
required: true,
type: 'object',
content: {
"application/json": {
example: {
Expand Down
9 changes: 3 additions & 6 deletions server/endpoints/api/workspace/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ function apiWorkspaceEndpoints(app) {
#swagger.requestBody = {
description: 'JSON object containing new display name of workspace.',
required: true,
type: 'object',
content: {
"application/json": {
example: {
Expand Down Expand Up @@ -265,7 +264,6 @@ function apiWorkspaceEndpoints(app) {
#swagger.requestBody = {
description: 'JSON object containing new settings to update a workspace. All keys are optional and will not update unless provided',
required: true,
type: 'object',
content: {
"application/json": {
example: {
Expand Down Expand Up @@ -404,7 +402,6 @@ function apiWorkspaceEndpoints(app) {
#swagger.requestBody = {
description: 'JSON object of additions and removals of documents to add to update a workspace. The value should be the folder + filename with the exclusions of the top-level documents path.',
required: true,
type: 'object',
content: {
"application/json": {
example: {
Expand Down Expand Up @@ -482,7 +479,6 @@ function apiWorkspaceEndpoints(app) {
#swagger.requestBody = {
description: 'JSON object with the document path and pin status to update.',
required: true,
type: 'object',
content: {
"application/json": {
example: {
Expand Down Expand Up @@ -545,7 +541,6 @@ function apiWorkspaceEndpoints(app) {
#swagger.requestBody = {
description: 'Send a prompt to the workspace and the type of conversation (query or chat).<br/><b>Query:</b> Will not use LLM unless there are relevant sources from vectorDB & does not recall chat history.<br/><b>Chat:</b> Uses LLM general knowledge w/custom embeddings to produce output, uses rolling chat history.',
required: true,
type: 'object',
content: {
"application/json": {
example: {
Expand Down Expand Up @@ -655,7 +650,6 @@ function apiWorkspaceEndpoints(app) {
#swagger.requestBody = {
description: 'Send a prompt to the workspace and the type of conversation (query or chat).<br/><b>Query:</b> Will not use LLM unless there are relevant sources from vectorDB & does not recall chat history.<br/><b>Chat:</b> Uses LLM general knowledge w/custom embeddings to produce output, uses rolling chat history.',
required: true,
type: 'object',
content: {
"application/json": {
example: {
Expand All @@ -671,6 +665,9 @@ function apiWorkspaceEndpoints(app) {
"text/event-stream": {
schema: {
type: 'array',
items: {
type: 'string',
},
example: [
{
id: 'uuid-123',
Expand Down
7 changes: 3 additions & 4 deletions server/endpoints/api/workspaceThread/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ function apiWorkspaceThreadEndpoints(app) {
#swagger.requestBody = {
description: 'Optional userId associated with the thread',
required: false,
type: 'object',
content: {
"application/json": {
example: {
Expand Down Expand Up @@ -125,7 +124,6 @@ function apiWorkspaceThreadEndpoints(app) {
#swagger.requestBody = {
description: 'JSON object containing new name to update the thread.',
required: true,
type: 'object',
content: {
"application/json": {
example: {
Expand Down Expand Up @@ -336,7 +334,6 @@ function apiWorkspaceThreadEndpoints(app) {
#swagger.requestBody = {
description: 'Send a prompt to the workspace thread and the type of conversation (query or chat).',
required: true,
type: 'object',
content: {
"application/json": {
example: {
Expand Down Expand Up @@ -462,7 +459,6 @@ function apiWorkspaceThreadEndpoints(app) {
#swagger.requestBody = {
description: 'Send a prompt to the workspace thread and the type of conversation (query or chat).',
required: true,
type: 'object',
content: {
"application/json": {
example: {
Expand All @@ -478,6 +474,9 @@ function apiWorkspaceThreadEndpoints(app) {
"text/event-stream": {
schema: {
type: 'array',
items: {
type: 'string',
},
example: [
{
id: 'uuid-123',
Expand Down
Loading

0 comments on commit 7594841

Please sign in to comment.