{"openapi":"3.1.0","info":{"title":"REST Bootcamp OpenAPI Definition","description":"Набор методов для выполнения упражнений в рамках трудового лагеря REST Bootcamp","version":"2.0"},"servers":[{"url":"https://api.rest-bootcamp.net","description":"Generated server url"}],"tags":[{"name":"Customers","description":"Операции с клиентами"}],"paths":{"/customers/{id}":{"get":{"tags":["Customers"],"summary":"Получить клиента по ID","operationId":"getCustomerById","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Клиент найден","content":{"application/hal+json":{"schema":{"$ref":"#/components/schemas/CustomerResponseDto"}}}}}},"put":{"tags":["Customers"],"summary":"Полная замена данных клиента (upsert)","operationId":"replaceCustomer","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerCreateDto"}}},"required":true},"responses":{"200":{"description":"Клиент успешно обновлён","content":{"application/hal+json":{"schema":{"$ref":"#/components/schemas/CustomerResponseDto"}}}}}},"delete":{"tags":["Customers"],"summary":"Удалить клиента","operationId":"deleteCustomer","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Клиент успешно удалён","content":{"application/hal+json":{"schema":{"$ref":"#/components/schemas/CustomerResponseDto"}}}}}},"patch":{"tags":["Customers"],"summary":"Частичное обновление клиента","operationId":"partialUpdateCustomer","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerUpdateDto"}}},"required":true},"responses":{"200":{"description":"Клиент успешно обновлён","content":{"application/hal+json":{"schema":{"$ref":"#/components/schemas/CustomerResponseDto"}}}}}}},"/customers":{"get":{"tags":["Customers"],"summary":"Получить список клиентов с пагинацией","description":"Поддерживает фильтрацию по имени/фамилии, пагинацию и сортировку.","operationId":"getAllCustomers","parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","format":"int32","default":0,"minimum":0}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","format":"int32","default":10,"maximum":100,"minimum":1}},{"name":"sort","in":"query","required":false,"schema":{"type":"string","default":"lastName,asc"}},{"name":"firstName","in":"query","required":false,"schema":{"type":"string","maxLength":50,"minLength":0}},{"name":"lastName","in":"query","required":false,"schema":{"type":"string","maxLength":50,"minLength":0}}],"responses":{"200":{"description":"Список клиентов успешно получен","content":{"application/hal+json":{"examples":{"Пример ответа с пагинацией":{"description":"Пример ответа с пагинацией","value":"{\n  \"_embedded\": {\n    \"customerResponseDtoes\": [ ... ]\n  },\n  \"_links\": {\n    \"self\": { \"href\": \"/customers?page=0&size=10&sort=lastName,asc\" },\n    \"next\": { \"href\": \"/customers?page=1&size=10&sort=lastName,asc\" },\n    \"first\": { \"href\": \"/customers?page=0&size=10&sort=lastName,asc\" },\n    \"last\": { \"href\": \"/customers?page=4&size=10&sort=lastName,asc\" }\n  },\n  \"page\": {\n    \"size\": 10,\n    \"totalElements\": 47,\n    \"totalPages\": 5,\n    \"number\": 0\n  }\n}\n"}}}}}}},"post":{"tags":["Customers"],"summary":"Создать нового клиента","operationId":"createCustomer","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerCreateDto"}}},"required":true},"responses":{"201":{"description":"Клиент успешно создан","content":{"application/hal+json":{"schema":{"$ref":"#/components/schemas/CustomerResponseDto"}}}},"400":{"description":"Ошибка валидации","content":{"application/hal+json":{"schema":{"$ref":"#/components/schemas/CustomerResponseDto"}}}}}}}},"components":{"schemas":{"CustomerCreateDto":{"type":"object","description":"Данные для создания нового клиента","properties":{"firstName":{"type":"string","description":"Имя клиента","example":"Frodo","maxLength":50,"minLength":2},"lastName":{"type":"string","description":"Фамилия клиента","example":"Baggins","maxLength":50,"minLength":2},"born":{"type":"string","format":"date","description":"Дата рождения (yyyy-MM-dd)","example":"2000-09-22"}},"required":["firstName","lastName"]},"CustomerResponseDto":{"type":"object","description":"Ответ с данными клиента","properties":{"id":{"type":"string","format":"uuid","description":"Уникальный идентификатор клиента","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"},"firstName":{"type":"string","description":"Имя клиента","example":"Bilbo"},"lastName":{"type":"string","description":"Фамилия клиента","example":"Baggins"},"born":{"type":"string","format":"date","description":"Дата рождения","example":"3001-09-22"}}},"CustomerUpdateDto":{"type":"object","description":"Данные для частичного обновления (все поля необязательны)","properties":{"firstName":{"type":"string","description":"Новое имя клиента","example":"Samwise","maxLength":50,"minLength":2,"pattern":"(?s).*\\S.*"},"lastName":{"type":"string","description":"Новая фамилия клиента","example":"Gamgee","maxLength":50,"minLength":2,"pattern":"(?s).*\\S.*"},"born":{"type":"string","format":"date","description":"Новая дата рождения","example":"2000-04-06"}}}}}}