Bug/make swagger json output openapi 3 compliant (#2219)

update source to ensure swagger.json is openapi 3.0.0 compliant
This commit is contained in:
Mr Simon C 2024-09-04 23:40:24 +01:00 committed by GitHub
parent 5c40419a27
commit 7594841dac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 18 additions and 52 deletions

View File

@ -88,7 +88,6 @@ function apiAdminEndpoints(app) {
#swagger.requestBody = { #swagger.requestBody = {
description: 'Key pair object that will define the new user to add to the system.', description: 'Key pair object that will define the new user to add to the system.',
required: true, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
example: { example: {
@ -153,7 +152,6 @@ function apiAdminEndpoints(app) {
#swagger.requestBody = { #swagger.requestBody = {
description: 'Key pair object that will update the found user. All fields are optional and will not update unless specified.', description: 'Key pair object that will update the found user. All fields are optional and will not update unless specified.',
required: true, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
example: { example: {
@ -321,7 +319,6 @@ function apiAdminEndpoints(app) {
#swagger.requestBody = { #swagger.requestBody = {
description: 'Request body for creation parameters of the invitation', description: 'Request body for creation parameters of the invitation',
required: false, required: false,
type: 'object',
content: { content: {
"application/json": { "application/json": {
example: { example: {
@ -493,7 +490,6 @@ function apiAdminEndpoints(app) {
#swagger.requestBody = { #swagger.requestBody = {
description: 'Entire array of user ids who can access the workspace. All fields are optional and will not update unless specified.', description: 'Entire array of user ids who can access the workspace. All fields are optional and will not update unless specified.',
required: true, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
example: { example: {
@ -553,7 +549,6 @@ function apiAdminEndpoints(app) {
#swagger.requestBody = { #swagger.requestBody = {
description: 'Page offset to show of workspace chats. All fields are optional and will not update unless specified.', description: 'Page offset to show of workspace chats. All fields are optional and will not update unless specified.',
required: false, required: false,
type: 'integer',
content: { content: {
"application/json": { "application/json": {
example: { example: {
@ -660,7 +655,6 @@ function apiAdminEndpoints(app) {
#swagger.requestBody = { #swagger.requestBody = {
description: 'Object with setting key and new value to set. All keys are optional and will not update unless specified.', description: 'Object with setting key and new value to set. All keys are optional and will not update unless specified.',
required: true, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
example: { example: {

View File

@ -31,11 +31,11 @@ function apiDocumentEndpoints(app) {
#swagger.requestBody = { #swagger.requestBody = {
description: 'File to be uploaded.', description: 'File to be uploaded.',
required: true, required: true,
type: 'file',
content: { content: {
"multipart/form-data": { "multipart/form-data": {
schema: { schema: {
type: 'object', type: 'string',
format: 'binary',
properties: { properties: {
file: { file: {
type: 'string', type: 'string',
@ -131,7 +131,6 @@ function apiDocumentEndpoints(app) {
#swagger.requestBody = { #swagger.requestBody = {
description: 'Link of web address to be scraped.', description: 'Link of web address to be scraped.',
required: true, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
schema: { schema: {
@ -229,7 +228,6 @@ function apiDocumentEndpoints(app) {
#swagger.requestBody = { #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', 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, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
schema: { schema: {
@ -571,11 +569,10 @@ function apiDocumentEndpoints(app) {
#swagger.requestBody = { #swagger.requestBody = {
description: 'Name of the folder to create.', description: 'Name of the folder to create.',
required: true, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
schema: { schema: {
type: 'object', type: 'string',
example: { example: {
"name": "new-folder" "name": "new-folder"
} }
@ -638,7 +635,6 @@ function apiDocumentEndpoints(app) {
#swagger.requestBody = { #swagger.requestBody = {
description: 'Array of objects containing source and destination paths of files to move.', description: 'Array of objects containing source and destination paths of files to move.',
required: true, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
schema: { schema: {

View File

@ -90,7 +90,6 @@ function apiOpenAICompatibleEndpoints(app) {
#swagger.requestBody = { #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.', 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, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
example: { example: {
@ -205,7 +204,6 @@ function apiOpenAICompatibleEndpoints(app) {
#swagger.requestBody = { #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', 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, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
example: { example: {

View File

@ -113,7 +113,6 @@ function apiSystemEndpoints(app) {
#swagger.requestBody = { #swagger.requestBody = {
description: 'Key pair object that matches a valid setting and value. Get keys from GET /v1/system or refer to codebase.', description: 'Key pair object that matches a valid setting and value. Get keys from GET /v1/system or refer to codebase.',
required: true, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
example: { example: {

View File

@ -25,7 +25,6 @@ function apiWorkspaceEndpoints(app) {
#swagger.requestBody = { #swagger.requestBody = {
description: 'JSON object containing new display name of workspace.', description: 'JSON object containing new display name of workspace.',
required: true, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
example: { example: {
@ -265,7 +264,6 @@ function apiWorkspaceEndpoints(app) {
#swagger.requestBody = { #swagger.requestBody = {
description: 'JSON object containing new settings to update a workspace. All keys are optional and will not update unless provided', description: 'JSON object containing new settings to update a workspace. All keys are optional and will not update unless provided',
required: true, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
example: { example: {
@ -404,7 +402,6 @@ function apiWorkspaceEndpoints(app) {
#swagger.requestBody = { #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.', 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, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
example: { example: {
@ -482,7 +479,6 @@ function apiWorkspaceEndpoints(app) {
#swagger.requestBody = { #swagger.requestBody = {
description: 'JSON object with the document path and pin status to update.', description: 'JSON object with the document path and pin status to update.',
required: true, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
example: { example: {
@ -545,7 +541,6 @@ function apiWorkspaceEndpoints(app) {
#swagger.requestBody = { #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.', 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, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
example: { example: {
@ -655,7 +650,6 @@ function apiWorkspaceEndpoints(app) {
#swagger.requestBody = { #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.', 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, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
example: { example: {
@ -671,6 +665,9 @@ function apiWorkspaceEndpoints(app) {
"text/event-stream": { "text/event-stream": {
schema: { schema: {
type: 'array', type: 'array',
items: {
type: 'string',
},
example: [ example: [
{ {
id: 'uuid-123', id: 'uuid-123',

View File

@ -36,7 +36,6 @@ function apiWorkspaceThreadEndpoints(app) {
#swagger.requestBody = { #swagger.requestBody = {
description: 'Optional userId associated with the thread', description: 'Optional userId associated with the thread',
required: false, required: false,
type: 'object',
content: { content: {
"application/json": { "application/json": {
example: { example: {
@ -125,7 +124,6 @@ function apiWorkspaceThreadEndpoints(app) {
#swagger.requestBody = { #swagger.requestBody = {
description: 'JSON object containing new name to update the thread.', description: 'JSON object containing new name to update the thread.',
required: true, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
example: { example: {
@ -336,7 +334,6 @@ function apiWorkspaceThreadEndpoints(app) {
#swagger.requestBody = { #swagger.requestBody = {
description: 'Send a prompt to the workspace thread and the type of conversation (query or chat).', description: 'Send a prompt to the workspace thread and the type of conversation (query or chat).',
required: true, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
example: { example: {
@ -462,7 +459,6 @@ function apiWorkspaceThreadEndpoints(app) {
#swagger.requestBody = { #swagger.requestBody = {
description: 'Send a prompt to the workspace thread and the type of conversation (query or chat).', description: 'Send a prompt to the workspace thread and the type of conversation (query or chat).',
required: true, required: true,
type: 'object',
content: { content: {
"application/json": { "application/json": {
example: { example: {
@ -478,6 +474,9 @@ function apiWorkspaceThreadEndpoints(app) {
"text/event-stream": { "text/event-stream": {
schema: { schema: {
type: 'array', type: 'array',
items: {
type: 'string',
},
example: [ example: [
{ {
id: 'uuid-123', id: 'uuid-123',

View File

@ -193,7 +193,6 @@
"requestBody": { "requestBody": {
"description": "Key pair object that will define the new user to add to the system.", "description": "Key pair object that will define the new user to add to the system.",
"required": true, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"example": { "example": {
@ -263,7 +262,6 @@
"requestBody": { "requestBody": {
"description": "Key pair object that will update the found user. All fields are optional and will not update unless specified.", "description": "Key pair object that will update the found user. All fields are optional and will not update unless specified.",
"required": true, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"example": { "example": {
@ -434,7 +432,6 @@
"requestBody": { "requestBody": {
"description": "Request body for creation parameters of the invitation", "description": "Request body for creation parameters of the invitation",
"required": false, "required": false,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"example": { "example": {
@ -626,7 +623,6 @@
"requestBody": { "requestBody": {
"description": "Entire array of user ids who can access the workspace. All fields are optional and will not update unless specified.", "description": "Entire array of user ids who can access the workspace. All fields are optional and will not update unless specified.",
"required": true, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"example": { "example": {
@ -686,7 +682,6 @@
"requestBody": { "requestBody": {
"description": "Page offset to show of workspace chats. All fields are optional and will not update unless specified.", "description": "Page offset to show of workspace chats. All fields are optional and will not update unless specified.",
"required": false, "required": false,
"type": "integer",
"content": { "content": {
"application/json": { "application/json": {
"example": { "example": {
@ -790,7 +785,6 @@
"requestBody": { "requestBody": {
"description": "Object with setting key and new value to set. All keys are optional and will not update unless specified.", "description": "Object with setting key and new value to set. All keys are optional and will not update unless specified.",
"required": true, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"example": { "example": {
@ -861,11 +855,11 @@
"requestBody": { "requestBody": {
"description": "File to be uploaded.", "description": "File to be uploaded.",
"required": true, "required": true,
"type": "file",
"content": { "content": {
"multipart/form-data": { "multipart/form-data": {
"schema": { "schema": {
"type": "object", "type": "string",
"format": "binary",
"properties": { "properties": {
"file": { "file": {
"type": "string", "type": "string",
@ -938,7 +932,6 @@
"requestBody": { "requestBody": {
"description": "Link of web address to be scraped.", "description": "Link of web address to be scraped.",
"required": true, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
@ -1015,7 +1008,6 @@
"requestBody": { "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", "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, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
@ -1311,11 +1303,10 @@
"requestBody": { "requestBody": {
"description": "Name of the folder to create.", "description": "Name of the folder to create.",
"required": true, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object", "type": "string",
"example": { "example": {
"name": "new-folder" "name": "new-folder"
} }
@ -1369,7 +1360,6 @@
"requestBody": { "requestBody": {
"description": "Array of objects containing source and destination paths of files to move.", "description": "Array of objects containing source and destination paths of files to move.",
"required": true, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
@ -1441,7 +1431,6 @@
"requestBody": { "requestBody": {
"description": "JSON object containing new display name of workspace.", "description": "JSON object containing new display name of workspace.",
"required": true, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"example": { "example": {
@ -1679,7 +1668,6 @@
"requestBody": { "requestBody": {
"description": "JSON object containing new settings to update a workspace. All keys are optional and will not update unless provided", "description": "JSON object containing new settings to update a workspace. All keys are optional and will not update unless provided",
"required": true, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"example": { "example": {
@ -1830,7 +1818,6 @@
"requestBody": { "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.", "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, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"example": { "example": {
@ -1890,7 +1877,6 @@
"requestBody": { "requestBody": {
"description": "JSON object with the document path and pin status to update.", "description": "JSON object with the document path and pin status to update.",
"required": true, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"example": { "example": {
@ -1967,7 +1953,6 @@
"requestBody": { "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.", "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, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"example": { "example": {
@ -2002,6 +1987,9 @@
"text/event-stream": { "text/event-stream": {
"schema": { "schema": {
"type": "array", "type": "array",
"items": {
"type": "string"
},
"example": [ "example": [
{ {
"id": "uuid-123", "id": "uuid-123",
@ -2060,7 +2048,6 @@
"requestBody": { "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.", "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, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"example": { "example": {
@ -2241,7 +2228,6 @@
"requestBody": { "requestBody": {
"description": "Key pair object that matches a valid setting and value. Get keys from GET /v1/system or refer to codebase.", "description": "Key pair object that matches a valid setting and value. Get keys from GET /v1/system or refer to codebase.",
"required": true, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"example": { "example": {
@ -2440,7 +2426,6 @@
"requestBody": { "requestBody": {
"description": "Optional userId associated with the thread", "description": "Optional userId associated with the thread",
"required": false, "required": false,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"example": { "example": {
@ -2523,7 +2508,6 @@
"requestBody": { "requestBody": {
"description": "JSON object containing new name to update the thread.", "description": "JSON object containing new name to update the thread.",
"required": true, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"example": { "example": {
@ -2742,7 +2726,6 @@
"requestBody": { "requestBody": {
"description": "Send a prompt to the workspace thread and the type of conversation (query or chat).", "description": "Send a prompt to the workspace thread and the type of conversation (query or chat).",
"required": true, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"example": { "example": {
@ -2787,6 +2770,9 @@
"text/event-stream": { "text/event-stream": {
"schema": { "schema": {
"type": "array", "type": "array",
"items": {
"type": "string"
},
"example": [ "example": [
{ {
"id": "uuid-123", "id": "uuid-123",
@ -2845,7 +2831,6 @@
"requestBody": { "requestBody": {
"description": "Send a prompt to the workspace thread and the type of conversation (query or chat).", "description": "Send a prompt to the workspace thread and the type of conversation (query or chat).",
"required": true, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"example": { "example": {
@ -3012,7 +2997,6 @@
"requestBody": { "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.", "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, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"example": { "example": {
@ -3076,7 +3060,6 @@
"requestBody": { "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", "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, "required": true,
"type": "object",
"content": { "content": {
"application/json": { "application/json": {
"example": { "example": {