openapi: 3.1.0 info: title: My Library API description: Documentation for My Library API version: '1.0' servers: - url: http://localhost:8080 description: Generated server url tags: - name: Book Management description: APIs for book operations - name: Customer Management description: APIs for managing customer information and loyalty points paths: /api/customers/{customerId}: put: tags: - Customer Management summary: Update customer information description: Updates an existing customer's information operationId: updateCustomer parameters: - name: customerId in: path description: Customer's UUID required: true schema: type: string format: uuid requestBody: content: application/json: schema: $ref: '#/components/schemas/CustomerInfo' required: true responses: '200': description: Customer successfully updated content: '*/*': schema: $ref: '#/components/schemas/CustomerDTO' '404': description: Customer not found content: '*/*': schema: $ref: '#/components/schemas/CustomerDTO' delete: tags: - Customer Management summary: Delete a customer description: Deletes a customer by their ID operationId: deleteCustomer parameters: - name: customerId in: path description: Customer's UUID required: true schema: type: string format: uuid responses: '204': description: Customer successfully deleted '404': description: Customer not found /api/customers: post: tags: - Customer Management summary: Register a new customer description: Creates a new customer with the provided information operationId: registerCustomer requestBody: content: application/json: schema: $ref: '#/components/schemas/CustomerInfo' required: true responses: '201': description: Customer successfully registered content: '*/*': schema: type: string format: uuid '400': description: Invalid customer information provided content: '*/*': schema: type: string format: uuid /api/customers/{customerId}/loyalty/subtract: post: tags: - Customer Management summary: Subtract loyalty points description: Subtracts loyalty points from a customer's account operationId: subtractLoyaltyPoints parameters: - name: customerId in: path description: Customer's UUID required: true schema: type: string format: uuid - name: points in: query description: Number of points to subtract required: true schema: type: integer format: int32 responses: '200': description: Loyalty points successfully subtracted content: '*/*': schema: type: integer format: int32 '400': description: Not enough loyalty points content: '*/*': schema: type: integer format: int32 '404': description: Customer not found content: '*/*': schema: type: integer format: int32 /api/customers/{customerId}/loyalty/add: post: tags: - Customer Management summary: Add loyalty points description: Adds loyalty points to a customer's account operationId: addLoyaltyPoints parameters: - name: customerId in: path description: Customer's UUID required: true schema: type: string format: uuid - name: points in: query description: Number of points to add required: true schema: type: integer format: int32 responses: '200': description: Loyalty points successfully added content: '*/*': schema: type: integer format: int32 '404': description: Customer not found content: '*/*': schema: type: integer format: int32 /api/books: get: tags: - Book Management summary: Get all books description: Returns a paginated list of books operationId: getBooks parameters: - name: pageable in: query required: true schema: $ref: '#/components/schemas/Pageable' responses: '200': description: Successfully retrieved books content: '*/*': schema: $ref: '#/components/schemas/Page' post: tags: - Book Management summary: Register a new book description: Adds a new book to the system operationId: registerBook requestBody: content: application/json: schema: $ref: '#/components/schemas/BookDTO' required: true responses: '201': description: Book successfully registered content: '*/*': schema: type: integer format: int64 '400': description: Invalid book data provided content: '*/*': schema: type: string '406': description: Conflict with existing book in database content: '*/*': schema: type: string /api/customers/phone/{phoneNumber}: get: tags: - Customer Management summary: Find customer by phone number description: Returns customer information based on phone number operationId: findCustomerByPhoneNumber parameters: - name: phoneNumber in: path description: Customer's phone number required: true schema: type: string responses: '200': description: Customer found content: '*/*': schema: $ref: '#/components/schemas/CustomerDTO' '404': description: Customer not found content: '*/*': schema: $ref: '#/components/schemas/CustomerDTO' /api/books/{bookId}: get: tags: - Book Management summary: Get book by ID description: Retrieves a book by its ID operationId: getBookById parameters: - name: bookId in: path description: ID of the book to retrieve required: true schema: type: integer format: int64 responses: '200': description: Book found content: '*/*': schema: $ref: '#/components/schemas/BookDTO' '404': description: Book not found components: schemas: CustomerInfo: type: object properties: firstName: type: string lastName: type: string phoneNumber: type: string required: - firstName - lastName - phoneNumber CustomerDTO: type: object properties: id: type: string format: uuid firstName: type: string lastName: type: string phoneNumber: type: string loyaltyPoints: type: integer format: int32 BookDTO: type: object properties: isbn: type: integer format: int64 title: type: string maxLength: 255 minLength: 0 author: type: string publisher: type: string publicationDate: type: string format: date price: type: number format: double quantity: type: integer format: int32 categories: type: array description: Book categories enum: - FICTION - NON_FICTION - SCIENCE_FICTION - FANTASY - MYSTERY - THRILLER - ROMANCE - BIOGRAPHY - HISTORY - POETRY - CHILDRENS - YOUNG_ADULT - SCIENCE - PHILOSOPHY - SELF_HELP - TRAVEL - COOKING - ART - RELIGION - REFERENCE example: - FICTION - THRILLER items: type: string description: type: string language: type: string required: - author - categories - isbn - language - price - publicationDate - publisher - quantity - title Pageable: type: object properties: page: type: integer format: int32 minimum: 0 size: type: integer format: int32 minimum: 1 sort: type: array items: type: string Page: type: object properties: totalElements: type: integer format: int64 totalPages: type: integer format: int32 size: type: integer format: int32 content: type: array items: type: object number: type: integer format: int32 sort: $ref: '#/components/schemas/SortObject' first: type: boolean last: type: boolean pageable: $ref: '#/components/schemas/PageableObject' numberOfElements: type: integer format: int32 empty: type: boolean PageableObject: type: object properties: offset: type: integer format: int64 sort: $ref: '#/components/schemas/SortObject' pageSize: type: integer format: int32 pageNumber: type: integer format: int32 unpaged: type: boolean paged: type: boolean SortObject: type: object properties: empty: type: boolean unsorted: type: boolean sorted: type: boolean