{"id":376058,"date":"2024-05-21T06:40:46","date_gmt":"2024-05-21T06:40:46","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=376058"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=376058","title":{"rendered":"<span>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f OpenAPI \u0438\u0437 Spring Boot MVC<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/alekseytumbaev\/spring-openapi-example\/tree\/master\/src\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c <a href=\"https:\/\/mvnrepository.com\/artifact\/org.springdoc\/springdoc-openapi-starter-webmvc-ui\" rel=\"noopener noreferrer nofollow\">springdoc-openapi-starter-webmvc-ui<\/a>.<\/p>\n<p><a href=\"https:\/\/springdoc.org\/#Introduction\" rel=\"noopener noreferrer nofollow\">\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430<\/a> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442:<\/p>\n<ul>\n<li>\n<p>OpenAPI 3<\/p>\n<\/li>\n<li>\n<p>Spring Boot V3 (\u0434\u043b\u044f V2 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u0430\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c, \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438)<\/p>\n<\/li>\n<li>\n<p>JSR-303<\/p>\n<\/li>\n<li>\n<p>Swagger UI (\u0431\u0443\u0434\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440)<\/p>\n<\/li>\n<li>\n<p>OAuth 2 (\u044d\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u043e\u043a\u0435\u043d \u0442\u0438\u043f\u0430 Bearer)<\/p>\n<\/li>\n<li>\n<p>GraalVM native images (\u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c)<\/p>\n<\/li>\n<\/ul>\n<p>Swagger UI \u0431\u0443\u0434\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0430\u0448\u0438\u0445 DTO, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432, ControllerAdvice\u2019\u043e\u0432 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439.<\/p>\n<p>\u041f\u0443\u0442\u044c \u0434\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e ui \u2014 <code>\/swagger-ui\/index.html<\/code>, \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0432 application.properties \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>springdoc.swagger-ui.path<\/code>.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 open api \u0444\u0430\u0439\u043b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 json \u043f\u043e \u043f\u0443\u0442\u0438 <code>\/api-docs<\/code>,  \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 yaml \u2014 <code>\/api-docs.yaml<\/code>. \u041f\u0443\u0442\u044c \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>springdoc.api-docs.path<\/code>.<\/p>\n<h2>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0438\u0437 DTO \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c UserDto:<\/p>\n<pre><code class=\"java\">@Data @AllArgsConstructor @Schema(description = \"\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\") public class UserDto {     private String name;          @Schema(description = &amp;quot;\u042d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0430\u044f \u043f\u043e\u0447\u0442\u0430&amp;quot;, example = &amp;quot;junior@example.com&amp;quot;)     @Email     @NotBlank     private String email;          @Schema(description = &amp;quot;\u041f\u0430\u0440\u043e\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u0442 8 \u0434\u043e 32 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432,&amp;quot; +             &amp;quot;\u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043e\u0434\u043d\u0443 \u0431\u0443\u043a\u0432\u0443, \u043e\u0434\u043d\u0443 \u0446\u0438\u0444\u0440\u0443 \u0438 \u043e\u0434\u0438\u043d \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b&amp;quot;)     @Size(min = 8, max = 32)     @NotBlank     @Pattern(regexp = &amp;quot;^(?=.*[A-Za-z])(?=.*\\\\\\\\d)(?=.*[@$!%*#?^&amp;amp;])[A-Za-z\\\\\\\\d@$!%*#?^&amp;amp;]{3,}$&amp;quot;)     @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)     private String password;  }<\/code><\/pre>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 <code>@Schema<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>\u0412\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u0430\u043c\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u043a \u043d\u0435\u043c\u0443.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440:<\/p>\n<pre><code class=\"java\">@RestController @RequestMapping(\"\/users\") public class UserController {        @PostMapping     public UserDto addUser(@RequestBody @Validated UserDto userDto) {         return userDto;     } } <\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 <code>\/swagger-ui\/index.html<\/code> \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0443. \u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0447\u0442\u043e \u0432\u0441\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 JSR-303 \u0438 <code>@JsonProperty<\/code> \u043e\u0442\u0440\u0430\u0437\u0438\u043b\u0438\u0441\u044c \u0432 api.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d75\/6b7\/d72\/d756b7d72de2428af638677237df9d9d.png\" width=\"960\" height=\"1328\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d75\/6b7\/d72\/d756b7d72de2428af638677237df9d9d.png\"\/><\/figure>\n<h2>@RequestParam, @PathVariable \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438\u0445 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438<\/h2>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u044b \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u0443\u0442\u0438. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>@Parameter<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code>@Schema<\/code>. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <code>@Schema<\/code> \u043f\u0435\u0440\u0435\u0437\u0430\u0442\u0440\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<pre><code class=\"java\">    @GetMapping(\"\/{email}\")     public UserDto getUserByEmail(@PathVariable @Validated @Email                                   @Parameter(description = \"\u042d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0430\u044f \u043f\u043e\u0447\u0442\u0430\", example = \"junior@example.com\")                                   String email) {         return new UserDto(\"retrieved user\", email, null);     }      @GetMapping     public Collection&amp;lt;UserDto&amp;gt; getAllUsers(@RequestParam(required = false, defaultValue = &amp;quot;0&amp;quot;)                                            @Validated @Min(0) int page,                                            @RequestParam(required = false, defaultValue = &amp;quot;10&amp;quot;)                                            @Validated @Min(1) int size) {         return List.of(new UserDto(&amp;quot;retrieved user&amp;quot;, &amp;quot;junior@example.com&amp;quot;, null));     }<\/code><\/pre>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 <code>@Min<\/code> \u0432 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430\u0445 \u043d\u0435 \u043e\u0442\u0440\u0430\u0437\u0438\u043b\u0438\u0441\u044c:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/382\/f86\/6b0\/382f866b062c65e05db1739abc9b14d2.png\" width=\"1920\" height=\"2212\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/382\/f86\/6b0\/382f866b062c65e05db1739abc9b14d2.png\"\/><\/figure>\n<p>\u041d\u043e \u044d\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 swagger ui, \u0430 \u043d\u0435 springdoc. \u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043d\u0430 <code>\/api-docs.yaml<\/code>, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0430\u043c \u0435\u0441\u0442\u044c:<\/p>\n<pre><code class=\"yaml\">  \/users:     get:       tags:       - user-controller       operationId: getAllUsers       parameters:       - name: page         in: query         required: false         schema:           minimum: 0 ## \u0412\u043e\u0442 \u043e\u043d!           type: integer           format: int32           default: 0<\/code><\/pre>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0435\u0441\u043b\u0438 \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 <code>page<\/code> \u0438 <code>size<\/code> \u043c\u0435\u043d\u044c\u0448\u0435 \u043d\u0443\u043b\u044f, ui \u0432\u044b\u0434\u0430\u0441\u0442 \u043e\u0448\u0438\u0431\u043a\u0443.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/50e\/2be\/fb7\/50e2befb7ba5a03e32836fd8068c2ed1.png\" width=\"1458\" height=\"579\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/50e\/2be\/fb7\/50e2befb7ba5a03e32836fd8068c2ed1.png\"\/><\/figure>\n<p>\u0412\u044b \u0434\u0430\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 <a href=\"https:\/\/editor.swagger.io\/\" rel=\"noopener noreferrer nofollow\">editor.swagger.io<\/a>, \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e swagger ui \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<pre><code class=\"yaml\">openapi: 3.0.1 info:   title: OpenAPI definition   version: v0 servers: - url: &lt;http:\/\/localhost:8080>   description: Generated server url paths:   \/users:     get:       tags:       - user-controller       operationId: getAllUsers       parameters:       - name: page         in: query         required: false         schema:           minimum: 0 ##\u0412\u043e\u0442 \u043e\u043d!           type: integer           format: int32           default: 0       responses:         \"200\":           description: OK <\/code><\/pre>\n<p>\u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0441\u0442\u0440\u0430\u043d\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c swagger ui. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043c\u043d\u0435 \u0431\u044b \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0435\u0441\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u0430 \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u044f \u0445\u043e\u0447\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0430 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u041d\u043e \u043a\u0430\u043a \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 \u044f, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043d\u0435 \u043d\u0430\u0448\u0435\u043b.<\/p>\n<p>\u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u2014 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0435 \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435:<\/p>\n<pre><code class=\"java\">    @GetMapping     public Collection&lt;UserDto> getAllUsers(@RequestParam(required = false, defaultValue = \"0\")                                            @Parameter(description = \"min: 0\") \/\/\u0440\u0430\u0437                                            @Validated @Min(0) int page,                                            @RequestParam(required = false, defaultValue = \"10\")                                            @Parameter(description = \"min: 1\") \/\/\u0434\u0432\u0430\u0441                                            @Validated @Min(1) int size) {         return List.of(new UserDto(\"retrieved user\", \"junior@example.com\", null));     } <\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/50f\/0af\/7eb\/50f0af7eb16f88be6034ae6b73bde6c8.png\" width=\"571\" height=\"454\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/50f\/0af\/7eb\/50f0af7eb16f88be6034ae6b73bde6c8.png\"\/><\/figure>\n<h2>Page, Pageable \u0438 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438<\/h2>\n<p>\u0423 springdoc \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 Page \u0438 Pageable \u0438\u0437 spring data. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u043a\u0430\u043a \u043e\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0442\u0430\u0440\u0442\u0435\u0440 <code>org.springframework.boot:spring-boot-starter-data-jpa<\/code> \u0438 h2 <code>com.h2database:h2<\/code>.<\/p>\n<p>\u0418 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u0435\u0442\u043e\u0434 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435:<\/p>\n<pre><code class=\"java\">    @GetMapping(\"\/page\")     public Page&lt;UserDto> getAllUsersAsPage(Pageable pageable) {         return Page.empty(pageable);     } <\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, Page \u0438 Pageable \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438\u0441\u044c \u0432 api, \u0430  \u0432\u043c\u0435\u0441\u0442\u043e \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430 \u0432 Page \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432\u043d\u0443\u0442\u0440\u0438:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c42\/b53\/d2f\/c42b53d2fbb6d1ca1b1e06103ab5f82a.png\" width=\"1159\" height=\"997\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c42\/b53\/d2f\/c42b53d2fbb6d1ca1b1e06103ab5f82a.png\"\/><\/figure>\n<h2>@ControllerAdvice \u0438 \u043e\u0442\u0432\u0435\u0442\u044b 4xx<\/h2>\n<p>Sprigdoc \u043c\u043e\u0436\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e ControllerAdvice \u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"java\">@RestControllerAdvice public class GlobalExceptionHandler {     @ExceptionHandler(Throwable.class)     @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)     public ErrorResponseDto handleThrowable(Throwable e) {         return new ErrorResponseDto(e.getMessage());     } }<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/729\/394\/7a5\/7293947a5140d8d48417790d543f2174.png\" width=\"1420\" height=\"1054\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/729\/394\/7a5\/7293947a5140d8d48417790d543f2174.png\"\/><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/296\/813\/f7a\/296813f7a46c9a96b8c9a342f810eba2.png\" width=\"1420\" height=\"1007\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/296\/813\/f7a\/296813f7a46c9a96b8c9a342f810eba2.png\"\/><\/figure>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u0438\u0435 \u043e\u0442\u0432\u0435\u0442\u044b \u0438\u0437 ControllerAdvice \u0434\u043e\u0431\u0430\u0432\u044f\u0442\u0441\u044f \u043a\u043e \u0432\u0441\u0435\u043c \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430\u043c, \u0434\u0430\u0436\u0435 \u043a \u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438 \u043d\u0435 \u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u044e\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0438\u0437 ControllerAdvice: <code>springdoc.override-with-generic-response=false<\/code>.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442:<\/p>\n<pre><code class=\"java\">    @GetMapping(\"\/{email}\")     \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0442\u0432\u0435\u0442 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439     @ApiResponse(responseCode = \"404\", description = \"\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\",             content = @Content(schema = @Schema(implementation = ErrorResponseDto.class)))     public UserDto getUserByEmail(@PathVariable @Validated @Email                                   @Parameter(description = \"\u042d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0430\u044f \u043f\u043e\u0447\u0442\u0430\", example = \"junior@example.com\")                                   String email) {         return new UserDto(\"retrieved user\", email, null);     }<\/code><\/pre>\n<p>\u041d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0442\u0432\u0435\u0442\u0430 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0443\u0434\u0430\u043b\u0438\u0442 \u043e\u0442\u0432\u0435\u0442 \u0441 \u043a\u043e\u0434\u043e\u043c 200, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u043d\u044c\u0448\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/76f\/016\/0d1\/76f0160d1bacac0067cb680c9b133bac.png\" width=\"1420\" height=\"670\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/76f\/016\/0d1\/76f0160d1bacac0067cb680c9b133bac.png\"\/><\/figure>\n<p>\u0427\u0442\u043e\u0431\u044b \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 200, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0430\u043a\u0443\u044e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e \u043d\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440:<\/p>\n<pre><code class=\"java\">@RestController @RequestMapping(\"\/users\") \/\/\u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 @ApiResponses(@ApiResponse(responseCode = \"200\", useReturnTypeSchema = true)) public class UserController { <\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3e8\/854\/11f\/3e885411fe5262df08303f1e2b06f96e.png\" width=\"1420\" height=\"916\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3e8\/854\/11f\/3e885411fe5262df08303f1e2b06f96e.png\"\/><\/figure>\n<h2>Fine-grained \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f: \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0441\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0430\u043c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0435 \u0442\u0435\u043b\u043e \u043e\u0442\u0432\u0435\u0442\u0430<\/h2>\n<p>\u0414\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0442\u0435\u043b\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 <code>content = @Content(schema = @Schema(implementation = ErrorResponseDto.class))<\/code>, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u044d\u0442\u043e \u0442\u0435\u043b\u043e \u043a\u043e \u0432\u0441\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u0430\u043c \u0441 \u043a\u043e\u0434\u0430\u043c\u0438 4xx \u0438 5xx.<\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 open api \u2014 \u044d\u0442\u043e, \u043f\u043e \u0441\u0443\u0442\u0438, \u0440\u0443\u0447\u043d\u043e\u0435 \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u0435 \u0432 \u0444\u0430\u0439\u043b open api, \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u043e\u0435 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u044b. \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e:<\/p>\n<pre><code class=\"java\">@Configuration public class OpenApiConfig {      @Bean     public OpenApiCustomizer openApiCustomizer() {         return openApi -> {             \/\/\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0445\u0435\u043c\u0443 \u043e\u0448\u0438\u0431\u043a\u0438             var sharedErrorSchema = ModelConverters.getInstance()                     .read(ErrorResponseDto.class).get(ErrorResponseDto.class.getSimpleName());             if (sharedErrorSchema == null) {                 throw new IllegalStateException(                         \"\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u0434\u043b\u044f \u043e\u0448\u0438\u0431\u043e\u043a 4xx \u0438 5xx, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0445\u0435\u043c\u0430 \u043e\u0448\u0438\u0431\u043a\u0438\");             }              \/\/\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0435\u043b\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043a\u043e \u0432\u0441\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u0430\u043c \u0441 \u043a\u043e\u0434\u0430\u043c\u0438 4xx \u0438 5xx             openApi.getPaths().values().forEach(pathItem -> pathItem.readOperations().forEach(operation ->                     operation.getResponses().forEach((status, response) -> {                         if (status.startsWith(\"4\") || status.startsWith(\"5\")) {                             response.getContent().forEach((code, mediaType) -> mediaType.setSchema(sharedErrorSchema));                         }                     })));         };     } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0431\u0440\u0430\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0435\u043b\u0430 \u043e\u0442\u0432\u0435\u0442\u0430 \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430:<\/p>\n<pre><code class=\"java\">    @GetMapping(\"\/{email}\")     \/\/ \u0442\u0435\u043b\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438     @ApiResponse(responseCode = \"404\", description = \"\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\")     public UserDto getUserByEmail(@PathVariable @Validated @Email                                   @Parameter(description = \"\u042d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0430\u044f \u043f\u043e\u0447\u0442\u0430\", example = \"junior@example.com\")                                   String email) {         return new UserDto(\"retrieved user\", email, null);     } <\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/891\/8cb\/685\/8918cb68588c69eb43a7168f84c848d4.png\" width=\"1420\" height=\"1494\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/891\/8cb\/685\/8918cb68588c69eb43a7168f84c848d4.png\"\/><\/figure>\n<p>\u0422\u0443\u0442 \u0432\u0430\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e:<\/p>\n<ol>\n<li>\n<p>\u0422\u0435\u043b\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430, \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 Schemas \u043e\u0431\u044a\u0435\u043a\u0442\u0430 ErrorResponseDto \u043d\u0435\u0442. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u043f\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0438\u0437 \u043d\u0430\u0448\u0435\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u0437\u0430\u0442\u0440\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 \u0442\u0435\u043b\u0430 \u043e\u0442\u0432\u0435\u0442\u043e\u0432. \u0422\u043e \u0435\u0441\u0442\u044c, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 ApiResponse \u0432\u044b \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043b\u0438 \u0442\u0435\u043b\u043e \u043e\u0442\u0432\u0435\u0442\u0430, \u043e\u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043c\u0435\u043d\u0435\u043d\u043e \u043d\u0430 ErrorResponseDto.<\/p>\n<\/li>\n<\/ol>\n<p>\u041a\u0430\u043a \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0443\u043d\u043a\u0442 \u044f \u043d\u0435 \u0437\u043d\u0430\u044e, \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0443\u043d\u043a\u0442 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u0441\u0442\u044b\u043b\u0435\u043c.<\/p>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0445\u0435\u043c\u044b, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043d\u0435\u0435 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u044d\u0442\u0443 \u0441\u0441\u044b\u043b\u043a\u0443 \u043a\u043e \u0432\u0441\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u0430\u043c \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438:<\/p>\n<pre><code class=\"java\">    @Bean     public OpenApiCustomizer openApiCustomizer() {         return openApi -> {             \/\/\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0441\u0445\u0435\u043c\u0443 \u043e\u0448\u0438\u0431\u043a\u0430             var sharedErrorSchema = new Schema&lt;>().$ref(\"#\/components\/schemas\/\" + ErrorResponseDto.class.getSimpleName());              \/\/\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0435\u043b\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043a\u043e \u0432\u0441\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0430\u043c             openApi.getPaths().values().forEach(pathItem -> pathItem.readOperations().forEach(operation ->                     operation.getResponses().forEach((status, response) -> {                         if (status.startsWith(\"4\") || status.startsWith(\"5\")) {                             response.getContent().forEach((code, mediaType) -> mediaType.setSchema(sharedErrorSchema));                         }                     })));         };     }<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 OpenApiConfig \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c ErrorResponseDto, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0435\u0433\u043e \u0432 \u0440\u0430\u0437\u0434\u0435\u043b Schemas:<\/p>\n<pre><code class=\"java\">    \/**      * \u041a\u043e\u0441\u0442\u044b\u043b\u044c, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0445\u0435\u043c\u0443 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 open api      *\/     @RestController     @RequestMapping(\"\/donotuse\")     static public class DoNotUse {          @Operation(description = \"\u041d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u041a\u043e\u0441\u0442\u044b\u043b\u044c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0434\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 open api\",                 deprecated = true,                 responses = {                         @ApiResponse(content = @Content(schema = @Schema(implementation = ErrorResponseDto.class)))                 })         @DeleteMapping         public void registerOpenApiComponent() {         }     }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c ErrorResponseDto \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 Schemas, \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043a\u043e\u0441\u0442\u044b\u043b\u044c\u043d\u044b\u0439 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/104\/136\/01f\/10413601f77bd504c85dc3a3a6e2c23d.png\" width=\"1420\" height=\"1689\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/104\/136\/01f\/10413601f77bd504c85dc3a3a6e2c23d.png\"\/><\/figure>\n<h2>Security<\/h2>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043a \u043d\u0430\u0448\u0438\u043c \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430\u043c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0443\u044e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e. \u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043a\u0435\u043d Bearer:<\/p>\n<pre><code class=\"java\">@Configuration @OpenAPIDefinition(         info = @Info(title = \"\u041f\u0440\u0438\u043c\u0435\u0440 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 OpenAPI \u0438\u0437 Spring MVC\", version = \"1.0.0\"),         security = @SecurityRequirement(name = \"BearerAuth\")) @SecurityScheme(         type = SecuritySchemeType.HTTP,         scheme = \"bearer\",         bearerFormat = \"JWT\",         name = \"BearerAuth\") public class OpenApiConfig { <\/code><\/pre>\n<p>\u041d\u0430 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430\u0445 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0437\u0430\u043c\u043e\u0447\u043a\u0438:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/559\/71c\/831\/55971c83183a74183818198c36961267.png\" width=\"1460\" height=\"661\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/559\/71c\/831\/55971c83183a74183818198c36961267.png\"\/><\/figure>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/aa6\/084\/4b7\/aa60844b7cf076dbd1931f97a76e77bc.png\" width=\"1527\" height=\"698\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aa6\/084\/4b7\/aa60844b7cf076dbd1931f97a76e77bc.png\"\/><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043e \u0432\u0441\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u00abAuthorization\u00bb \u0441\u00a0\u0442\u043e\u043a\u0435\u043d\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0443\u043a\u0430\u0437\u0430\u043b\u0438:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/aba\/1e9\/4bf\/aba1e94bffc7fb4fb93dca3e029149eb.png\" width=\"1418\" height=\"702\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aba\/1e9\/4bf\/aba1e94bffc7fb4fb93dca3e029149eb.png\"\/><\/figure>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u043e\u0432, \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@SecurityRequirements<\/code>. \u0415\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0449\u0438\u0449\u0435\u043d:<\/p>\n<pre><code class=\"java\">    @PostMapping     @SecurityRequirements     public UserDto addUser(@RequestBody @Validated UserDto userDto) {         return userDto;     }<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b04\/c73\/df7\/b04c73df75a719fa339c7d9c2fb930ec.png\" width=\"1420\" height=\"291\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b04\/c73\/df7\/b04c73df75a719fa339c7d9c2fb930ec.png\"\/><\/figure>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043a \u0445\u0430\u043a\u0430\u0442\u043e\u043d\u0443 \u0438 \u0441\u043a\u043e\u0440\u043e \u0431\u0443\u0434\u0443\u0442 \u0434\u0440\u0443\u0433\u0438\u0435!<\/p>\n<p>\u042f \u0443\u0436\u0435 \u043f\u0438\u0441\u0430\u043b \u043e <a href=\"https:\/\/t.me\/life_of_junior_dev\/73\" rel=\"noopener noreferrer nofollow\">\u0432\u044b\u0431\u043e\u0440\u0435 \u043c\u0435\u0436\u0434\u0443 Spring \u0438 Ktor<\/a>, \u0434\u0430\u043b\u0435\u0435 \u043d\u0430\u043f\u0438\u0448\u0443 \u043e \u0440\u0430\u0431\u043e\u0442\u0435 docker compose \u0441\u043e Spring, \u043e\u0431 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u0445\u0430\u043a\u0430\u0442\u043e\u043d.<\/p>\n<p>\u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c!<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/814061\/\"> https:\/\/habr.com\/ru\/articles\/814061\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/alekseytumbaev\/spring-openapi-example\/tree\/master\/src\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c <a href=\"https:\/\/mvnrepository.com\/artifact\/org.springdoc\/springdoc-openapi-starter-webmvc-ui\" rel=\"noopener noreferrer nofollow\">springdoc-openapi-starter-webmvc-ui<\/a>.<\/p>\n<p><a href=\"https:\/\/springdoc.org\/#Introduction\" rel=\"noopener noreferrer nofollow\">\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430<\/a> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442:<\/p>\n<ul>\n<li>\n<p>OpenAPI 3<\/p>\n<\/li>\n<li>\n<p>Spring Boot V3 (\u0434\u043b\u044f V2 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u0430\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c, \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438)<\/p>\n<\/li>\n<li>\n<p>JSR-303<\/p>\n<\/li>\n<li>\n<p>Swagger UI (\u0431\u0443\u0434\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440)<\/p>\n<\/li>\n<li>\n<p>OAuth 2 (\u044d\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u043e\u043a\u0435\u043d \u0442\u0438\u043f\u0430 Bearer)<\/p>\n<\/li>\n<li>\n<p>GraalVM native images (\u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c)<\/p>\n<\/li>\n<\/ul>\n<p>Swagger UI \u0431\u0443\u0434\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0430\u0448\u0438\u0445 DTO, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432, ControllerAdvice\u2019\u043e\u0432 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439.<\/p>\n<p>\u041f\u0443\u0442\u044c \u0434\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e ui \u2014 <code>\/swagger-ui\/index.html<\/code>, \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0432 application.properties \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>springdoc.swagger-ui.path<\/code>.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 open api \u0444\u0430\u0439\u043b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 json \u043f\u043e \u043f\u0443\u0442\u0438 <code>\/api-docs<\/code>,  \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 yaml \u2014 <code>\/api-docs.yaml<\/code>. \u041f\u0443\u0442\u044c \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>springdoc.api-docs.path<\/code>.<\/p>\n<h2>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0438\u0437 DTO \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c UserDto:<\/p>\n<pre><code class=\"java\">@Data @AllArgsConstructor @Schema(description = \"\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\") public class UserDto {     private String name;          @Schema(description = &amp;quot;\u042d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0430\u044f \u043f\u043e\u0447\u0442\u0430&amp;quot;, example = &amp;quot;junior@example.com&amp;quot;)     @Email     @NotBlank     private String email;          @Schema(description = &amp;quot;\u041f\u0430\u0440\u043e\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u0442 8 \u0434\u043e 32 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432,&amp;quot; +             &amp;quot;\u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043e\u0434\u043d\u0443 \u0431\u0443\u043a\u0432\u0443, \u043e\u0434\u043d\u0443 \u0446\u0438\u0444\u0440\u0443 \u0438 \u043e\u0434\u0438\u043d \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b&amp;quot;)     @Size(min = 8, max = 32)     @NotBlank     @Pattern(regexp = &amp;quot;^(?=.*[A-Za-z])(?=.*\\\\\\\\d)(?=.*[@$!%*#?^&amp;amp;])[A-Za-z\\\\\\\\d@$!%*#?^&amp;amp;]{3,}$&amp;quot;)     @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)     private String password;  }<\/code><\/pre>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 <code>@Schema<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>\u0412\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u0430\u043c\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u043a \u043d\u0435\u043c\u0443.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440:<\/p>\n<pre><code class=\"java\">@RestController @RequestMapping(\"\/users\") public class UserController {        @PostMapping     public UserDto addUser(@RequestBody @Validated UserDto userDto) {         return userDto;     } } <\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 <code>\/swagger-ui\/index.html<\/code> \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0443. \u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0447\u0442\u043e \u0432\u0441\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 JSR-303 \u0438 <code>@JsonProperty<\/code> \u043e\u0442\u0440\u0430\u0437\u0438\u043b\u0438\u0441\u044c \u0432 api.<\/p>\n<figure class=\"full-width\"><\/figure>\n<h2>@RequestParam, @PathVariable \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438\u0445 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438<\/h2>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u044b \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u0443\u0442\u0438. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>@Parameter<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code>@Schema<\/code>. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <code>@Schema<\/code> \u043f\u0435\u0440\u0435\u0437\u0430\u0442\u0440\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<pre><code class=\"java\">    @GetMapping(\"\/{email}\")     public UserDto getUserByEmail(@PathVariable @Validated @Email                                   @Parameter(description = \"\u042d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0430\u044f \u043f\u043e\u0447\u0442\u0430\", example = \"junior@example.com\")                                   String email) {         return new UserDto(\"retrieved user\", email, null);     }      @GetMapping     public Collection&amp;lt;UserDto&amp;gt; getAllUsers(@RequestParam(required = false, defaultValue = &amp;quot;0&amp;quot;)                                            @Validated @Min(0) int page,                                            @RequestParam(required = false, defaultValue = &amp;quot;10&amp;quot;)                                            @Validated @Min(1) int size) {         return List.of(new UserDto(&amp;quot;retrieved user&amp;quot;, &amp;quot;junior@example.com&amp;quot;, null));     }<\/code><\/pre>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 <code>@Min<\/code> \u0432 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430\u0445 \u043d\u0435 \u043e\u0442\u0440\u0430\u0437\u0438\u043b\u0438\u0441\u044c:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041d\u043e \u044d\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 swagger ui, \u0430 \u043d\u0435 springdoc. \u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043d\u0430 <code>\/api-docs.yaml<\/code>, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0430\u043c \u0435\u0441\u0442\u044c:<\/p>\n<pre><code class=\"yaml\">  \/users:     get:       tags:       - user-controller       operationId: getAllUsers       parameters:       - name: page         in: query         required: false         schema:           minimum: 0 ## \u0412\u043e\u0442 \u043e\u043d!           type: integer           format: int32           default: 0<\/code><\/pre>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0435\u0441\u043b\u0438 \u043f\u043e\u043f\u044b\u0442\u0430\u0442\u044c\u0441\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 <code>page<\/code> \u0438 <code>size<\/code> \u043c\u0435\u043d\u044c\u0448\u0435 \u043d\u0443\u043b\u044f, ui \u0432\u044b\u0434\u0430\u0441\u0442 \u043e\u0448\u0438\u0431\u043a\u0443.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412\u044b \u0434\u0430\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 <a href=\"https:\/\/editor.swagger.io\/\" rel=\"noopener noreferrer nofollow\">editor.swagger.io<\/a>, \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e swagger ui \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<pre><code class=\"yaml\">openapi: 3.0.1 info:   title: OpenAPI definition   version: v0 servers: - url: &lt;http:\/\/localhost:8080>   description: Generated server url paths:   \/users:     get:       tags:       - user-controller       operationId: getAllUsers       parameters:       - name: page         in: query         required: false         schema:           minimum: 0 ##\u0412\u043e\u0442 \u043e\u043d!           type: integer           format: int32           default: 0       responses:         \"200\":           description: OK <\/code><\/pre>\n<p>\u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0441\u0442\u0440\u0430\u043d\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c swagger ui. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043c\u043d\u0435 \u0431\u044b \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0435\u0441\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u0430 \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u044f \u0445\u043e\u0447\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0430 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u041d\u043e \u043a\u0430\u043a \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 \u044f, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043d\u0435 \u043d\u0430\u0448\u0435\u043b.<\/p>\n<p>\u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u2014 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0435 \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435:<\/p>\n<pre><code class=\"java\">    @GetMapping     public Collection&lt;UserDto> getAllUsers(@RequestParam(required = false, defaultValue = \"0\")                                            @Parameter(description = \"min: 0\") \/\/\u0440\u0430\u0437                                            @Validated @Min(0) int page,                                            @RequestParam(required = false, defaultValue = \"10\")                                            @Parameter(description = \"min: 1\") \/\/\u0434\u0432\u0430\u0441                                            @Validated @Min(1) int size) {         return List.of(new UserDto(\"retrieved user\", \"junior@example.com\", null));     } <\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<h2>Page, Pageable \u0438 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438<\/h2>\n<p>\u0423 springdoc \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 Page \u0438 Pageable \u0438\u0437 spring data. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u043a\u0430\u043a \u043e\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0442\u0430\u0440\u0442\u0435\u0440 <code>org.springframework.boot:spring-boot-starter-data-jpa<\/code> \u0438 h2 <code>com.h2database:h2<\/code>.<\/p>\n<p>\u0418 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u0435\u0442\u043e\u0434 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435:<\/p>\n<pre><code class=\"java\">    @GetMapping(\"\/page\")     public Page&lt;UserDto> getAllUsersAsPage(Pageable pageable) {         return Page.empty(pageable);     } <\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, Page \u0438 Pageable \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438\u0441\u044c \u0432 api, \u0430  \u0432\u043c\u0435\u0441\u0442\u043e \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430 \u0432 Page \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432\u043d\u0443\u0442\u0440\u0438:<\/p>\n<figure class=\"full-width\"><\/figure>\n<h2>@ControllerAdvice \u0438 \u043e\u0442\u0432\u0435\u0442\u044b 4xx<\/h2>\n<p>Sprigdoc \u043c\u043e\u0436\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e ControllerAdvice \u043a \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"java\">@RestControllerAdvice public class GlobalExceptionHandler {     @ExceptionHandler(Throwable.class)     @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)     public ErrorResponseDto handleThrowable(Throwable e) {         return new ErrorResponseDto(e.getMessage());     } }<\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u0438\u0435 \u043e\u0442\u0432\u0435\u0442\u044b \u0438\u0437 ControllerAdvice \u0434\u043e\u0431\u0430\u0432\u044f\u0442\u0441\u044f \u043a\u043e \u0432\u0441\u0435\u043c \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430\u043c, \u0434\u0430\u0436\u0435 \u043a \u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438 \u043d\u0435 \u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u044e\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0438\u0437 ControllerAdvice: <code>springdoc.override-with-generic-response=false<\/code>.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442:<\/p>\n<pre><code class=\"java\">    @GetMapping(\"\/{email}\")     \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0442\u0432\u0435\u0442 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439     @ApiResponse(responseCode = \"404\", description = \"\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\",             content = @Content(schema = @Schema(implementation = ErrorResponseDto.class)))     public UserDto getUserByEmail(@PathVariable @Validated @Email                                   @Parameter(description = \"\u042d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0430\u044f \u043f\u043e\u0447\u0442\u0430\", example = \"junior@example.com\")                                   String email) {         return new UserDto(\"retrieved user\", email, null);     }<\/code><\/pre>\n<p>\u041d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0442\u0432\u0435\u0442\u0430 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0443\u0434\u0430\u043b\u0438\u0442 \u043e\u0442\u0432\u0435\u0442 \u0441 \u043a\u043e\u0434\u043e\u043c 200, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u043d\u044c\u0448\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0427\u0442\u043e\u0431\u044b \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 200, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0430\u043a\u0443\u044e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e \u043d\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440:<\/p>\n<pre><code class=\"java\">@RestController @RequestMapping(\"\/users\") \/\/\u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 @ApiResponses(@ApiResponse(responseCode = \"200\", useReturnTypeSchema = true)) public class UserController { <\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<h2>Fine-grained \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f: \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0441\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0430\u043c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0435 \u0442\u0435\u043b\u043e \u043e\u0442\u0432\u0435\u0442\u0430<\/h2>\n<p>\u0414\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0442\u0435\u043b\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 <code>content = @Content(schema = @Schema(implementation = ErrorResponseDto.class))<\/code>, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u044d\u0442\u043e \u0442\u0435\u043b\u043e \u043a\u043e \u0432\u0441\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u0430\u043c \u0441 \u043a\u043e\u0434\u0430\u043c\u0438 4xx \u0438 5xx.<\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 open api \u2014 \u044d\u0442\u043e, \u043f\u043e \u0441\u0443\u0442\u0438, \u0440\u0443\u0447\u043d\u043e\u0435 \u0434\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u0435 \u0432 \u0444\u0430\u0439\u043b open api, \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u043e\u0435 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u044b. \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e:<\/p>\n<pre><code class=\"java\">@Configuration public class OpenApiConfig {      @Bean     public OpenApiCustomizer openApiCustomizer() {         return openApi -> {             \/\/\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0445\u0435\u043c\u0443 \u043e\u0448\u0438\u0431\u043a\u0438             var sharedErrorSchema = ModelConverters.getInstance()                     .read(ErrorResponseDto.class).get(ErrorResponseDto.class.getSimpleName());             if (sharedErrorSchema == null) {                 throw new IllegalStateException(                         \"\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u0434\u043b\u044f \u043e\u0448\u0438\u0431\u043e\u043a 4xx \u0438 5xx, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0445\u0435\u043c\u0430 \u043e\u0448\u0438\u0431\u043a\u0438\");             }              \/\/\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0435\u043b\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043a\u043e \u0432\u0441\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u0430\u043c \u0441 \u043a\u043e\u0434\u0430\u043c\u0438 4xx \u0438 5xx             openApi.getPaths().values().forEach(pathItem -> pathItem.readOperations().forEach(operation ->                     operation.getResponses().forEach((status, response) -> {                         if (status.startsWith(\"4\") || status.startsWith(\"5\")) {                             response.getContent().forEach((code, mediaType) -> mediaType.setSchema(sharedErrorSchema));                         }                     })));         };     } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0431\u0440\u0430\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0435\u043b\u0430 \u043e\u0442\u0432\u0435\u0442\u0430 \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430:<\/p>\n<pre><code class=\"java\">    @GetMapping(\"\/{email}\")     \/\/ \u0442\u0435\u043b\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438     @ApiResponse(responseCode = \"404\", description = \"\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\")     public UserDto getUserByEmail(@PathVariable @Validated @Email                                   @Parameter(description = \"\u042d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0430\u044f \u043f\u043e\u0447\u0442\u0430\", example = \"junior@example.com\")                                   String email) {         return new UserDto(\"retrieved user\", email, null);     } <\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<p>\u0422\u0443\u0442 \u0432\u0430\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e:<\/p>\n<ol>\n<li>\n<p>\u0422\u0435\u043b\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430, \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 Schemas \u043e\u0431\u044a\u0435\u043a\u0442\u0430 ErrorResponseDto \u043d\u0435\u0442. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u043f\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0438\u0437 \u043d\u0430\u0448\u0435\u0439 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u0437\u0430\u0442\u0440\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 \u0442\u0435\u043b\u0430 \u043e\u0442\u0432\u0435\u0442\u043e\u0432. \u0422\u043e \u0435\u0441\u0442\u044c, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 ApiResponse \u0432\u044b \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043b\u0438 \u0442\u0435\u043b\u043e \u043e\u0442\u0432\u0435\u0442\u0430, \u043e\u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043c\u0435\u043d\u0435\u043d\u043e \u043d\u0430 ErrorResponseDto.<\/p>\n<\/li>\n<\/ol>\n<p>\u041a\u0430\u043a \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0443\u043d\u043a\u0442 \u044f \u043d\u0435 \u0437\u043d\u0430\u044e, \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0443\u043d\u043a\u0442 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u0441\u0442\u044b\u043b\u0435\u043c.<\/p>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0445\u0435\u043c\u044b,<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-376058","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/376058","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=376058"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/376058\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=376058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=376058"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=376058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}