openapi: 3.0.0 info: title: API Documentation version: 1.0.0 securitySchemes: BasicAuth: type: http scheme: basic tags: - name: Posts description: API for managing posts paths: /api/posts: get: summary: Get a list of all posts tags: [Posts] responses: 200: description: List of all posts content: application/json: schema: type: array items: $ref: '#/components/schemas/Post' post: summary: Add a new post tags: [Posts] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PostInputDto' responses: 201: description: The post was successfully created content: application/json: schema: $ref: '#/components/schemas/Post' 400: description: Validation error content: application/json: schema: $ref: '#/components/schemas/ValidationErrorResponse' /api/posts/{id}: get: summary: Get a post by ID tags: [Posts] parameters: - in: path name: id required: true description: 'The unique identifier of the post' schema: type: string example: '123abc' responses: 200: description: The requested post content: application/json: schema: $ref: '#/components/schemas/Post' 404: description: Post not found put: summary: Update a post by ID tags: [Posts] parameters: - in: path name: id required: true description: 'The unique identifier of the post' schema: type: string example: '123abc' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PostInputDto' responses: 204: description: Post updated successfully 400: description: Validation error content: application/json: schema: $ref: '#/components/schemas/ValidationErrorResponse' 404: description: Post not found delete: summary: Delete a post by ID tags: [Posts] parameters: - in: path name: id required: true description: 'The unique identifier of the post' schema: type: string example: '123abc' responses: 204: description: Post deleted successfully 404: description: Post not found components: schemas: Post: type: object required: - id - title - shortDescription - content - blogId - blogName properties: id: type: string description: 'The unique identifier for the post' example: '123abc' title: type: string description: 'The title of the post' example: 'Interest post' shortDescription: type: string description: 'Little description about the post' example: 'Post about nature' content: type: string description: 'Full text in the post' example: 'This post about Africa. The weather is hot.' blogId: type: string description: 'The unique identifier of the blog' example: '123abc' blogName: type: string description: 'Name of the blog' example: 'About nature' PostInputDto: type: object required: - title - shortDescription - content - blogId properties: title: type: string description: 'The title of the post' example: 'Interest post' shortDescription: type: string description: 'Little description about the post' example: 'Post about nature' content: type: string description: 'Full text in the post' example: 'This post about Africa. The weather is hot.' blogId: type: string description: 'The unique identifier of the blog' example: '123abc' ValidationError: type: object properties: field: type: string example: 'name' message: type: string example: 'Invalid name' ValidationErrorResponse: type: object properties: errorMessages: type: array items: $ref: '#/components/schemas/ValidationError'