openapi: 3.0.0 info: title: Antiplagiat Service API description: API for uploading, retrieving, and analyzing student reports for plagiarism detection. version: 1.0.0 servers: - url: http://localhost:8080 description: API Gateway endpoint paths: /upload: post: summary: Upload a text file description: Uploads a .txt file for plagiarism checking. Returns the file ID. operationId: uploadFile requestBody: required: true content: multipart/form-data: schema: type: object properties: file: type: string format: binary description: The .txt file to upload required: - file responses: '200': description: File uploaded successfully or already exists content: text/plain: schema: type: string example: "550e8400-e29b-41d4-a716-446655440000" description: The ID of the uploaded or existing file '400': description: Invalid file format or request content: text/plain: schema: type: string example: "Only .txt files are allowed" '500': description: Server error (e.g., database or file system failure) content: text/plain: schema: type: string example: "Failed to save file" /file/{id}: get: summary: Retrieve a file by ID description: Retrieves the content of a previously uploaded file by its ID. operationId: getFile parameters: - name: id in: path required: true schema: type: string example: "550e8400-e29b-41d4-a716-446655440000" description: The ID of the file responses: '200': description: File content retrieved successfully content: text/plain: schema: type: string example: "This is the content of the student report." '404': description: File not found content: text/plain: schema: type: string example: "File not found" '500': description: Server error (e.g., database or file system failure) content: text/plain: schema: type: string example: "Internal server error" /analyze/{id}: get: summary: Analyze a file by ID description: Analyzes a previously uploaded file for metrics like paragraphs, words, characters, and optionally a word cloud location. operationId: analyzeFile parameters: - name: id in: path required: true schema: type: string example: "550e8400-e29b-41d4-a716-446655440000" description: The ID of the file to analyze responses: '200': description: Analysis results retrieved successfully content: application/json: schema: type: object properties: paragraphs: type: integer example: 2 description: Number of paragraphs in the file words: type: integer example: 10 description: Number of words in the file characters: type: integer example: 50 description: Number of characters in the file wordCloud: type: string example: "wordcloud_550e8400-e29b-41d4-a716-446655440000.png" description: Имя файла облака слов для запроса /wordcloud/{location} (пусто, если не сгенерировано) plagiarismPercent: type: number format: float example: 87.5 description: Процент совпадения с наиболее похожим файлом required: - paragraphs - words - characters - wordCloud - plagiarismPercent '404': description: File not found content: text/plain: schema: type: string example: "File not found" '500': description: Server error (e.g., analysis or database failure) content: text/plain: schema: type: string example: "Internal server error" '503': description: File storing service unavailable content: text/plain: schema: type: string example: "Service unavailable" /wordcloud/{location}: get: summary: Retrieve a word cloud image description: Retrieves a word cloud image generated for a file, if available. operationId: getWordCloud parameters: - name: location in: path required: true schema: type: string example: "wordcloud_550e8400-e29b-41d4-a716-446655440000.png" description: The location (filename) of the word cloud image responses: '200': description: Word cloud image retrieved successfully content: image/png: schema: type: string format: binary description: The PNG image of the word cloud '404': description: Word cloud image not found content: text/plain: schema: type: string example: "Word cloud not found" '500': description: Server error (e.g., file system failure) content: text/plain: schema: type: string example: "Internal server error"