{"id":357114,"date":"2024-05-20T23:43:51","date_gmt":"2024-05-20T23:43:51","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=357114"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-20T23:43:51","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=357114","title":{"rendered":"<span>\u041f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e \u0441 GitHub \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f feign \u0438 jsonschema2pojo maven plugin<\/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>\u0412 \u044d\u043f\u043e\u0445\u0443 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0441\u0435 \u0447\u0430\u0449\u0435 \u0438 \u0447\u0430\u0449\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043a\u0430\u043a \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439, \u0442\u0430\u043a \u0438 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438. \u041a\u0442\u043e-\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0441 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0435\u0439 \u0438 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0438\u0445 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445, \u043a\u0442\u043e-\u0442\u043e \u0437\u0430\u0445\u043b\u0430\u043c\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c POJO \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u043e\u0434\u0438\u043d POJO \u043a\u043b\u0430\u0441\u0441 \u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u0435\u0448\u0430\u0435\u0442 \u0447\u0442\u0435\u043d\u0438\u044e \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e \u0441 API GitHub \u0438 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0435 Spring \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<h2>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438<\/h2>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c feign-spring4 \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 spring \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439.<\/p>\n<pre><code class=\"xml\">&lt;dependency> &lt;groupId>io.github.openfeign&lt;\/groupId> &lt;artifactId>feign-spring4&lt;\/artifactId> &lt;version>${feign.version}&lt;\/version> &lt;\/dependency><\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c feign-jackson \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 POJO \u043a\u043b\u0430\u0441\u0441\u0430\u0445.<\/p>\n<pre><code class=\"xml\">&lt;dependency> &lt;groupId>io.github.openfeign&lt;\/groupId> &lt;artifactId>feign-jackson&lt;\/artifactId> &lt;version>${feign.version}&lt;\/version> &lt;\/dependency><\/code><\/pre>\n<h2>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043b\u0430\u0433\u0438\u043d \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 POJO \u043a\u043b\u0430\u0441\u0441\u043e\u0432<\/h2>\n<p>\u0412 \u0441\u0435\u043a\u0446\u0438\u044e plugins \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0434\u043b\u044f jsonschema2pojo-maven-plugin. \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0433\u0434\u0435 \u0443 \u043d\u0430\u0441 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f json \u0441\u0445\u0435\u043c\u044b, \u043a\u0430\u043a\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430\u0445 \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439, \u0447\u0442\u043e\u0431\u044b \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c.<\/p>\n<pre><code class=\"xml\">&lt;build> &lt;plugins> &lt;plugin> &lt;groupId>org.jsonschema2pojo&lt;\/groupId> &lt;artifactId>jsonschema2pojo-maven-plugin&lt;\/artifactId> &lt;version>1.2.1&lt;\/version> &lt;configuration> &lt;sourceDirectory>${basedir}\/src\/main\/resources\/schema&lt;\/sourceDirectory> &lt;targetPackage>com.example.types&lt;\/targetPackage> &lt;includeAdditionalProperties>false&lt;\/includeAdditionalProperties> &lt;\/configuration> &lt;executions> &lt;execution> &lt;goals> &lt;goal>generate&lt;\/goal> &lt;\/goals> &lt;\/execution> &lt;\/executions> &lt;\/plugin> &lt;\/plugins> &lt;\/build><\/code><\/pre>\n<p>\u041e\u043f\u0438\u0448\u0435\u043c json \u0441\u0445\u0435\u043c\u0443, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0443\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0448\u0438 POJO \u043a\u043b\u0430\u0441\u0441\u044b. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b \u043a\u043b\u0430\u0441\u0441\u044b \u0438\u0437 definitions, \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043d\u0438\u0445 \u0432 properties.<\/p>\n<pre><code class=\"json\">{   \"$schema\": \"http:\/\/json-schema.org\/draft-07\/schema#\",   \"description\" : \"Definition of GitHubApi\",   \"type\": \"object\",   \"properties\" : {     \"contributor\" : {       \"type\" : \"object\",       \"$ref\" : \"#\/definitions\/Contributor\"     },     \"issue\" : {       \"type\" : \"object\",       \"$ref\" : \"#\/definitions\/Issue\"     }   },   \"definitions\": {     \"Contributor\" : {       \"type\" : \"object\",       \"properties\": {         \"login\": {           \"type\": \"string\"         },         \"contributions\": {           \"type\": \"integer\"         }       }     },     \"Issue\" : {       \"type\" : \"object\",       \"properties\": {         \"title\": {           \"type\": \"string\"         },         \"body\": {           \"type\": \"string\"         },         \"labels\": {           \"type\": \"array\",           \"items\": {             \"type\": \"object\",             \"properties\": {               \"name\": {                 \"type\": \"string\"               }             }           }         },         \"user\": {           \"type\" : \"object\",           \"$ref\" : \"#\/definitions\/User\"         }       }     },     \"User\" : {       \"type\" : \"object\",       \"properties\": {         \"login\": {           \"type\": \"string\"         },         \"avatar_url\": {           \"type\": \"string\"         }       }     }   } } <\/code><\/pre>\n<p>\u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0445\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <a href=\"https:\/\/www.liquid-technologies.com\/online-json-to-schema-converter\" rel=\"noopener noreferrer nofollow\">\u043e\u043d\u043b\u0430\u0439\u043d \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c<\/a> \u0441\u0445\u0435\u043c\u044b \u0438\u0437 json.<\/p>\n<h2>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0445 URI \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"java\">interface GitHubApi {     @GetMapping(\"\/repos\/{owner}\/{repo}\/contributors\")     List&lt;Contributor> contributors(@PathVariable(\"owner\") String owner, @PathVariable(\"repo\") String repo);     @GetMapping(\"\/repos\/{owner}\/{repo}\/issues\")     List&lt;Issue> issues(@PathVariable(\"owner\") String owner, @PathVariable(\"repo\") String repo); }<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a GitHub. \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c <strong>JacksonDecoder<\/strong> \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u0432 POJO \u043a\u043b\u0430\u0441\u0441\u0430\u0445 (\u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a @JsonProperty). \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c <strong>SpringContract <\/strong>\u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f spring \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 (@GetMapping, @PathVariable).<\/p>\n<pre><code class=\"java\">GitHubApi github = Feign.builder()             .decoder(new JacksonDecoder())             .contract(new SpringContract())             .target(GitHubApi.class, \"https:\/\/api.github.com\");<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u0442\u0430\u043a\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u0430\u043c, \u043a\u0430\u043a contributors \u0438 issues. \u041f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/ \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0411\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a OpenAPI. \u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0434\u0430\u0435\u0442 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 POJO \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<h2>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h2>\n<ul>\n<li>\n<p><a href=\"https:\/\/github.com\/gromspys\/feign-github-example\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/OpenFeign\/feign\" rel=\"noopener noreferrer nofollow\">OpenFeign \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/joelittlejohn\/jsonschema2pojo\" rel=\"noopener noreferrer nofollow\">jsonschema2pojo \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/json-schema.org\/understanding-json-schema\/basics\" rel=\"noopener noreferrer nofollow\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e Json Schema<\/a><\/p>\n<\/li>\n<\/ul>\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\/766522\/\"> https:\/\/habr.com\/ru\/articles\/766522\/<\/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>\u0412 \u044d\u043f\u043e\u0445\u0443 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0441\u0435 \u0447\u0430\u0449\u0435 \u0438 \u0447\u0430\u0449\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043a\u0430\u043a \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439, \u0442\u0430\u043a \u0438 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438. \u041a\u0442\u043e-\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0441 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0435\u0439 \u0438 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0438\u0445 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445, \u043a\u0442\u043e-\u0442\u043e \u0437\u0430\u0445\u043b\u0430\u043c\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c POJO \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u043e\u0434\u0438\u043d POJO \u043a\u043b\u0430\u0441\u0441 \u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u0435\u0448\u0430\u0435\u0442 \u0447\u0442\u0435\u043d\u0438\u044e \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e \u0441 API GitHub \u0438 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0435 Spring \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<h2>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438<\/h2>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c feign-spring4 \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 spring \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439.<\/p>\n<pre><code class=\"xml\">&lt;dependency> &lt;groupId>io.github.openfeign&lt;\/groupId> &lt;artifactId>feign-spring4&lt;\/artifactId> &lt;version>${feign.version}&lt;\/version> &lt;\/dependency><\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c feign-jackson \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 POJO \u043a\u043b\u0430\u0441\u0441\u0430\u0445.<\/p>\n<pre><code class=\"xml\">&lt;dependency> &lt;groupId>io.github.openfeign&lt;\/groupId> &lt;artifactId>feign-jackson&lt;\/artifactId> &lt;version>${feign.version}&lt;\/version> &lt;\/dependency><\/code><\/pre>\n<h2>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043b\u0430\u0433\u0438\u043d \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 POJO \u043a\u043b\u0430\u0441\u0441\u043e\u0432<\/h2>\n<p>\u0412 \u0441\u0435\u043a\u0446\u0438\u044e plugins \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0434\u043b\u044f jsonschema2pojo-maven-plugin. \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0433\u0434\u0435 \u0443 \u043d\u0430\u0441 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f json \u0441\u0445\u0435\u043c\u044b, \u043a\u0430\u043a\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430\u0445 \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439, \u0447\u0442\u043e\u0431\u044b \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c.<\/p>\n<pre><code class=\"xml\">&lt;build> &lt;plugins> &lt;plugin> &lt;groupId>org.jsonschema2pojo&lt;\/groupId> &lt;artifactId>jsonschema2pojo-maven-plugin&lt;\/artifactId> &lt;version>1.2.1&lt;\/version> &lt;configuration> &lt;sourceDirectory>${basedir}\/src\/main\/resources\/schema&lt;\/sourceDirectory> &lt;targetPackage>com.example.types&lt;\/targetPackage> &lt;includeAdditionalProperties>false&lt;\/includeAdditionalProperties> &lt;\/configuration> &lt;executions> &lt;execution> &lt;goals> &lt;goal>generate&lt;\/goal> &lt;\/goals> &lt;\/execution> &lt;\/executions> &lt;\/plugin> &lt;\/plugins> &lt;\/build><\/code><\/pre>\n<p>\u041e\u043f\u0438\u0448\u0435\u043c json \u0441\u0445\u0435\u043c\u0443, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0443\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0448\u0438 POJO \u043a\u043b\u0430\u0441\u0441\u044b. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b \u043a\u043b\u0430\u0441\u0441\u044b \u0438\u0437 definitions, \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043d\u0438\u0445 \u0432 properties.<\/p>\n<pre><code class=\"json\">{   \"$schema\": \"http:\/\/json-schema.org\/draft-07\/schema#\",   \"description\" : \"Definition of GitHubApi\",   \"type\": \"object\",   \"properties\" : {     \"contributor\" : {       \"type\" : \"object\",       \"$ref\" : \"#\/definitions\/Contributor\"     },     \"issue\" : {       \"type\" : \"object\",       \"$ref\" : \"#\/definitions\/Issue\"     }   },   \"definitions\": {     \"Contributor\" : {       \"type\" : \"object\",       \"properties\": {         \"login\": {           \"type\": \"string\"         },         \"contributions\": {           \"type\": \"integer\"         }       }     },     \"Issue\" : {       \"type\" : \"object\",       \"properties\": {         \"title\": {           \"type\": \"string\"         },         \"body\": {           \"type\": \"string\"         },         \"labels\": {           \"type\": \"array\",           \"items\": {             \"type\": \"object\",             \"properties\": {               \"name\": {                 \"type\": \"string\"               }             }           }         },         \"user\": {           \"type\" : \"object\",           \"$ref\" : \"#\/definitions\/User\"         }       }     },     \"User\" : {       \"type\" : \"object\",       \"properties\": {         \"login\": {           \"type\": \"string\"         },         \"avatar_url\": {           \"type\": \"string\"         }       }     }   } } <\/code><\/pre>\n<p>\u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0445\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <a href=\"https:\/\/www.liquid-technologies.com\/online-json-to-schema-converter\" rel=\"noopener noreferrer nofollow\">\u043e\u043d\u043b\u0430\u0439\u043d \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c<\/a> \u0441\u0445\u0435\u043c\u044b \u0438\u0437 json.<\/p>\n<h2>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0445 URI \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"java\">interface GitHubApi {     @GetMapping(\"\/repos\/{owner}\/{repo}\/contributors\")     List&lt;Contributor> contributors(@PathVariable(\"owner\") String owner, @PathVariable(\"repo\") String repo);     @GetMapping(\"\/repos\/{owner}\/{repo}\/issues\")     List&lt;Issue> issues(@PathVariable(\"owner\") String owner, @PathVariable(\"repo\") String repo); }<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a GitHub. \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c <strong>JacksonDecoder<\/strong> \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u0432 POJO \u043a\u043b\u0430\u0441\u0441\u0430\u0445 (\u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a @JsonProperty). \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c <strong>SpringContract <\/strong>\u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f spring \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 (@GetMapping, @PathVariable).<\/p>\n<pre><code class=\"java\">GitHubApi github = Feign.builder()             .decoder(new JacksonDecoder())             .contract(new SpringContract())             .target(GitHubApi.class, \"https:\/\/api.github.com\");<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u0442\u0430\u043a\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u0430\u043c, \u043a\u0430\u043a contributors \u0438 issues. \u041f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/ \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0411\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a OpenAPI. \u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0434\u0430\u0435\u0442 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 POJO \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<h2>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h2>\n<ul>\n<li>\n<p><a href=\"https:\/\/github.com\/gromspys\/feign-github-example\" rel=\"noopener noreferrer nofollow\">\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/OpenFeign\/feign\" rel=\"noopener noreferrer nofollow\">OpenFeign \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/joelittlejohn\/jsonschema2pojo\" rel=\"noopener noreferrer nofollow\">jsonschema2pojo \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/json-schema.org\/understanding-json-schema\/basics\" rel=\"noopener noreferrer nofollow\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e Json Schema<\/a><\/p>\n<\/li>\n<\/ul>\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\/766522\/\"> https:\/\/habr.com\/ru\/articles\/766522\/<\/a><br \/><\/br><\/br><\/p>\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-357114","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/357114","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=357114"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/357114\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=357114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=357114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=357114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}