{"id":343062,"date":"2022-12-23T15:01:14","date_gmt":"2022-12-23T15:01:14","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=343062"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2022-12-23T15:01:14","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=343062","title":{"rendered":"<span>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f GraphQL \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0430 Python<\/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>\u0420\u0435\u0447\u044c \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0445 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441<a href=\"https:\/\/graphql.org\/\" rel=\"noopener noreferrer nofollow\"> GraphQL<\/a> \u043d\u0430 Python \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430. \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 GraphQL \u0432 \u0441\u0432\u043e\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445 \u043d\u0430 Python, \u0442\u043e, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435 GraphQL \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043f\u0438\u0441\u0430\u0442\u044c Python \u043a\u043b\u0430\u0441\u0441\u044b \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u044d\u0442\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u0430\u043c \u0431\u044b\u043b\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e: \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0445\u043e\u0436\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u043f\u0440\u0438 \u0447\u0430\u0441\u0442\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0441\u0445\u0435\u043c\u044b \u0438 \u0442.\u043f. \u0412\u043e\u0442 \u0438 \u043c\u043d\u0435 \u0442\u043e\u0436\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0440\u0435\u0448\u0430\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u0430 \u0441\u0432\u0435\u0442 \u0434\u0432\u0430 \u043f\u0430\u043a\u0435\u0442\u0430: <a href=\"https:\/\/pypi.org\/project\/graphql-query\/\" rel=\"noopener noreferrer nofollow\">graphql-query<\/a> \u0438 <a href=\"https:\/\/pypi.org\/project\/graphql2python\/\" rel=\"noopener noreferrer nofollow\">graphql2python<\/a>.<\/p>\n<h3>\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u0441 \u043f\u0430\u043a\u0435\u0442\u043e\u043c graphql-query<\/h3>\n<p>\u041f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 GraphQL \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u043d\u0430 Python (<a href=\"https:\/\/graphql.org\/code\/#python-client\" rel=\"noopener noreferrer nofollow\">https:\/\/graphql.org\/code\/#python-client<\/a>) \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a, \u0442.\u0435. \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u0441\u0442\u0440\u043e\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438\u0437 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432, \u043e\u0431\u0449\u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u0442.\u043f.<\/p>\n<p><strong>graphql-query<\/strong> &#8212; \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u044b GraphQL \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 (<a href=\"https:\/\/graphql.org\/learn\/queries\/\" rel=\"noopener noreferrer nofollow\">https:\/\/graphql.org\/learn\/queries\/<\/a>) \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 <em>render<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0438\u0441\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/pypi.org\/project\/Jinja2\/\" rel=\"noopener noreferrer nofollow\">jinja2<\/a>.<\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f <strong>graphql-query<\/strong> \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <a href=\"https:\/\/denisart.github.io\/graphql-query\/\" rel=\"noopener noreferrer nofollow\">https:\/\/denisart.github.io\/graphql-query\/<\/a>. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 GraphQL.<\/p>\n<h3>\u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441<\/h3>\n<p>\u0414\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441. \u0422\u0430\u043a\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a<\/p>\n<pre><code class=\"javascript\">{   hero {     name   } }<\/code><\/pre>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 <strong>graphql-query<\/strong> \u043c\u043e\u0436\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c<\/p>\n<pre><code class=\"python\">from graphql_query import Operation, Query  hero = Query(name=\"hero\", fields=[\"name\"]) operation = Operation(type=\"query\", queries=[hero])  print(operation.render()) # query { #  hero { #    name #  } # }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 <em>render <\/em>\u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <strong><em>graphql_query.Operation<\/em><\/strong><em> <\/em>\u043a\u0430\u043a \u0440\u0430\u0437 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c. \u0412\u043d\u0443\u0442\u0440\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <strong><em>fields<\/em><\/strong> \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <strong><em>graphql_query.Query<\/em><\/strong> \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c<\/p>\n<ul>\n<li>\n<p>\u0441\u0442\u0440\u043e\u043a\u0438 (\u0438\u043c\u0435\u043d\u0430 \u043f\u043e\u043b\u0435\u0439);<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u044a\u0435\u043a\u0442\u044b <strong><em>graphql_query.Field<\/em><\/strong><em>;<\/em><\/p>\n<\/li>\n<li>\n<p>\u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b (<a href=\"https:\/\/graphql.org\/learn\/queries\/#inline-fragments\" rel=\"noopener noreferrer nofollow\">Inline Fragments<\/a>);<\/p>\n<\/li>\n<\/ul>\n<h3>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b, \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435<\/h3>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 (<a href=\"https:\/\/graphql.org\/learn\/queries\/#variables\" rel=\"noopener noreferrer nofollow\">Variables<\/a>), \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b (<a href=\"https:\/\/graphql.org\/learn\/queries\/#arguments\" rel=\"noopener noreferrer nofollow\">Arguments<\/a>) \u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b (<a href=\"https:\/\/graphql.org\/learn\/queries\/#fragments\" rel=\"noopener noreferrer nofollow\">Fragments<\/a>):<\/p>\n<pre><code class=\"javascript\">query HeroComparison($first: Int = 3) {   leftComparison: hero(episode: EMPIRE) {     ...comparisonFields   }   rightComparison: hero(episode: JEDI) {     ...comparisonFields   } }  fragment comparisonFields on Character {   name   friendsConnection(first: $first) {     totalCount     edges {       node {         name       }     }   } }<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0432\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u0432\u043c\u0435\u0441\u0442\u0435 \u0441 <a href=\"https:\/\/graphql.org\/learn\/queries\/#aliases\" rel=\"noopener noreferrer nofollow\">\u0430\u043b\u0438\u0430\u0441\u0430\u043c\u0438<\/a>) \u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u043b\u0435\u0439. \u041a\u043e\u0434 \u043d\u0430 <strong>graphql-query <\/strong>\u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a<\/p>\n<pre><code class=\"python\">from graphql_query import Argument, Operation, Query, Fragment, Field, Variable  # \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, # \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 var_first = Variable(name=\"first\", type=\"Int\", default=\"3\")  arg_first = Argument(name=\"first\", value=var_first) arg_empire = Argument(name=\"episode\", value=\"EMPIRE\") arg_jedi = Argument(name=\"episode\", value=\"JEDI\")  # \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 comparisonFields comparisonFields = Fragment(     name=\"comparisonFields\",     type=\"Character\",     fields=[         \"name\",         Field(             name=\"friendsConnection\",             # \u043e\u0431\u044a\u0435\u043a\u0442 graphql_query.Field \u0442\u043e\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u043e\u043b\u0435 arguments             arguments=[arg_first],             fields=[                 \"totalCount\",                 Field(                     name=\"edges\",                     fields=[Field(name=\"node\", fields=[\"name\"])]                 )             ]         )     ] )  # \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 leftComparison = Query(     name=\"hero\",     alias=\"leftComparison\",  # alias \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430     arguments=[arg_empire],     fields=[comparisonFields]  # \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u043b\u044f )  # \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 rightComparison = Query(     name=\"hero\",     alias=\"rightComparison\",  # alias \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430     arguments=[arg_jedi],     fields=[comparisonFields]  # \u0442\u043e\u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u043b\u044f )  # \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 operation = Operation(     type=\"query\",     name=\"HeroComparison\",     queries=[leftComparison, rightComparison],     fragments=[comparisonFields],     variables=[var_first] ) print(operation.render()) # query HeroComparison( #   $first: Int = 3 # ) { #   leftComparison: hero( #     episode: EMPIRE #   ) { #     ...comparisonFields #   } # #   rightComparison: hero( #     episode: JEDI #   ) { #     ...comparisonFields #   } # } # # fragment comparisonFields on Character { #   name #   friendsConnection( #     first: $first #   ) { #     totalCount #     edges { #       node { #         name #       } #     } #   } # }<\/code><\/pre>\n<p>\u042f\u0441\u043d\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 <strong><em>leftComparison<\/em><\/strong> \u0438 <strong><em>rightComparison<\/em><\/strong> \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430<\/p>\n<pre><code class=\"python\">def generate_hero(alias: str, argument: graphql_query.Argument) -> graphql_query.Query:     return Query(         name=\"hero\",         alias=alias,         arguments=[argument],         fields=[comparisonFields]  # \u0442\u043e\u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u043b\u044f     )  leftComparison = generate_hero(\"leftComparison\", arg_empire) rightComparison = generate_hero(\"rightComparison\", arg_jedi)<\/code><\/pre>\n<p>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438: <a href=\"https:\/\/denisart.github.io\/graphql-query\/#directives\" rel=\"noopener noreferrer nofollow\">\u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b<\/a>, <a href=\"https:\/\/denisart.github.io\/graphql-query\/#meta-fields\" rel=\"noopener noreferrer nofollow\">__typename<\/a> \u0438 \u0434\u0440.<\/p>\n<h3>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0434\u0430\u0442\u0430-\u043c\u043e\u0434\u0435\u043b\u0438 \u0441 \u043f\u0430\u043a\u0435\u0442\u043e\u043c graphql2python<\/h3>\n<p>\u0415\u0441\u0442\u044c \u0434\u0432\u0430 \u0445\u043e\u0440\u043e\u0448\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441\u043e\u0444\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e \u0441\u0445\u0435\u043c\u0430\u043c<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/the-guild.dev\/graphql\/codegen\" rel=\"noopener noreferrer nofollow\"><strong>graphql code generator<\/strong><\/a><strong> <\/strong>\u043d\u0430 TypeScript;<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/koxudaxi\/datamodel-code-generator\" rel=\"noopener noreferrer nofollow\"><strong>datamodel-code-generator<\/strong><\/a> \u043d\u0430 python \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u0437 openapi.<\/p>\n<\/li>\n<\/ul>\n<p><strong>graphql2python<\/strong> &#8212; \u0441\u0445\u043e\u0436\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 <strong>pydantic<\/strong> \u043a\u043b\u0430\u0441\u0441\u044b \u0438\u0437 GraphQL \u0441\u0445\u0435\u043c\u044b. \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <a href=\"https:\/\/denisart.github.io\/graphql2python\/\" rel=\"noopener noreferrer nofollow\">https:\/\/denisart.github.io\/graphql2python\/<\/a>. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 <strong>graphql2python<\/strong> c \u043f\u043e\u043c\u043e\u0449\u044c\u044e pip \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443<\/p>\n<pre><code class=\"bash\">graphql2python render --config .\/graphql2python.yaml<\/code><\/pre>\n<p>\u0433\u0434\u0435  <strong><em>graphql2python.yaml<\/em><\/strong> &#8212; \u044d\u0442\u043e \u0432\u0430\u0448 \u0444\u0430\u0439\u043b \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439. \u0412 \u0441\u0430\u043c\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0432\u0438\u0434\u0435 \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a<\/p>\n<pre><code class=\"yaml\"># graphql2python.yaml schema: .\/schema.graphql output: .\/model.py<\/code><\/pre>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043d\u0430 \u0433\u0440\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438. \u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441\u043e\u0437\u0434\u0430\u0442 (\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0448\u0435\u0442) \u0444\u0430\u0439\u043b <em>.\/output.py<\/em>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430 python. <\/p>\n<h3>\u0421\u043a\u0430\u043b\u044f\u0440\u044b<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432 GraphQL \u0441\u0445\u0435\u043c\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0441\u043a\u0430\u043b\u044f\u0440\u044b<\/p>\n<pre><code class=\"javascript\"># in schema.graphql ...  \"in the format: dd\/mm\/yyyy\" scalar DateTime  ...<\/code><\/pre>\n<p>\u0442\u043e \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c<\/p>\n<pre><code class=\"python\"># output.py  ...  # The `Boolean` scalar type represents `true` or `false`. Boolean = str   # in the format: dd\/mm\/yyyy DateTime = str   # The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most # often used by GraphQL to represent free-form human-readable text. String = str<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 GraphQL \u0441\u043a\u0430\u043b\u044f\u0440\u043e\u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u0437\u044f\u0442\u044b \u0438\u0437 <a href=\"https:\/\/github.com\/graphql-python\/graphql-core\/blob\/main\/src\/graphql\/type\/scalars.py\" rel=\"noopener noreferrer nofollow\"><strong><em>graphql-core<\/em><\/strong><\/a><em>. <\/em>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u0441\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0442\u0438\u043f\u044b \u0431\u0443\u0434\u0443\u0442 <strong><em>str<\/em><\/strong>. \u042d\u0442\u043e \u043b\u0435\u0433\u043a\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0430. \u0414\u043b\u044f<\/p>\n<pre><code class=\"yaml\"># graphql2python.yaml schema: ... output: ... options:   scalar_pytypes:     String: str     Float: float     Int: int     ID: str     Boolean: bool     DateTime: datetime<\/code><\/pre>\n<p>\u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c<\/p>\n<pre><code class=\"python\"># output.py  ...  # The `Boolean` scalar type represents `true` or `false`. Boolean = bool   # in the format: dd\/mm\/yyyy DateTime = datetime   # The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most # often used by GraphQL to represent free-form human-readable text. String = str  ...<\/code><\/pre>\n<p>\u041d\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0442\u0438\u043f\u044b python \u043f\u043e\u043a\u0430 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b. \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e \u0432 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0440\u0435\u043b\u0438\u0437\u0430\u0445, \u043a\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u044b, \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b.<\/p>\n<h4>Enum \u0438 Union<\/h4>\n<p>\u0414\u043b\u044f \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 GraphQL <a href=\"https:\/\/graphql.org\/learn\/schema\/#enumeration-types\" rel=\"noopener noreferrer nofollow\">Enum<\/a> \u0438 GraphQL <a href=\"https:\/\/graphql.org\/learn\/schema\/#union-types\" rel=\"noopener noreferrer nofollow\">Union<\/a> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f enum.Enum \u0438 typing.Union \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440<\/p>\n<pre><code class=\"javascript\"># schema.graphql  ...  enum Episode {   NEWHOPE   EMPIRE   JEDI }  \"\"\" Wherever we return a SearchResult type in our schema, we might get a Human, a Droid, or a Starship. \"\"\" union SearchResult = Human | Droid | Starship<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0442\u0430\u043a\u043e\u0439 \u0441\u0445\u0435\u043c\u044b (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 <strong><em>Human<\/em><\/strong>, <strong><em>Droid<\/em><\/strong> \u0438 <strong><em>Starship<\/em><\/strong> \u043e\u043f\u0443\u0449\u0435\u043d\u043e) \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/p>\n<pre><code class=\"python\"># output.py  ...  class Episode(enum.Enum):     \"\"\"     An Enum type     See https:\/\/graphql.org\/learn\/schema\/#enumeration-types     \"\"\"     EMPIRE = \"EMPIRE\"     JEDI = \"JEDI\"     NEWHOPE = \"NEWHOPE\"   # Wherever we return a SearchResult type in our schema, # we might get a Human, a Droid, or a Starship. SearchResult = _t.Union[     'Droid',     'Human',     'Starship', ]  ...<\/code><\/pre>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442 typing.Union \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c<\/p>\n<pre><code class=\"python\"># output.py \u0434\u043b\u044f \u0441\u0445\u0435\u043c\u044b # # \"\"\" # Wherever we return a SearchResult type in our schema, # we might get a Human, a Droid, or a Starship. # \"\"\" # union SearchResult = Human  ...  # Wherever we return a SearchResult type in our schema, # we might get a Human, a Droid, or a Starship. SearchResult = _t.TypeVar('SearchResult', bound='Human')  ...<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 <strong>_t <\/strong>\u0435\u0441\u0442\u044c \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043e\u0442 <strong>typing<\/strong>, \u0442.\u0435.<\/p>\n<pre><code class=\"python\">import typing as _t<\/code><\/pre>\n<h4>\u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440<\/h4>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u0438\u0437 <a href=\"https:\/\/countries.trevorblades.com\/\" rel=\"noopener noreferrer nofollow\">https:\/\/countries.trevorblades.com\/<\/a> \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0434\u043b\u044f \u043d\u0435\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u043c<\/p>\n<pre><code class=\"yaml\"># graphql2python.yaml schema: .\/schema.graphql output: .\/model.py options:   each_field_optional: true   scalar_pytypes:     Boolean: bool<\/code><\/pre>\n<p>\u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0444\u0430\u0439\u043b<\/p>\n<pre><code class=\"python\">\"\"\"Auto-generated by graphql2python.\"\"\"  # pylint: disable-all # mypy: ignore-errors  import enum import typing as _t from datetime import date, datetime  from pydantic import BaseModel, Field  __all__ = [     \"GraphQLBaseModel\",     # scalars     \"Boolean\",     \"ID\",     \"String\",     \"_Any\",     # enums     # unions     \"_Entity\",     # interfaces     # objects     \"Continent\",     \"Country\",     \"Language\",     \"State\",     \"_Service\", ]   class GraphQLBaseModel(BaseModel):     \"\"\"Base Model for GraphQL object.\"\"\"      class Config:         allow_population_by_field_name = True         json_encoders = {             # custom output conversion for datetime             datetime: lambda dt: dt.isoformat()         }         smart_union = True   # The `Boolean` scalar type represents `true` or `false`. Boolean = bool   # The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID # type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an # input type, any string (such as `\"4\"`) or integer (such as `4`) input value will be accepted as an ID. ID = str   # The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most # often used by GraphQL to represent free-form human-readable text. String = str   # A Scalar type # See https:\/\/graphql.org\/learn\/schema\/#scalar-types _Any = str   # A Union type # See https:\/\/graphql.org\/learn\/schema\/#union-types _Entity = _t.Union[     'Continent',     'Country',     'Language', ]   class Continent(GraphQLBaseModel):     \"\"\"     An Object type     See https:\/\/graphql.org\/learn\/schema\/#object-types-and-fields     \"\"\"     code: _t.Optional['ID'] = Field(default=None)     countries: _t.Optional[_t.List['Country']] = Field(default_factory=list)     name: _t.Optional['String'] = Field(default=None)     typename__: _t.Literal[\"Continent\"] = Field(default=\"Continent\", alias=\"__typename\")   class Country(GraphQLBaseModel):     \"\"\"     An Object type     See https:\/\/graphql.org\/learn\/schema\/#object-types-and-fields     \"\"\"     capital: _t.Optional['String'] = Field(default=None)     code: _t.Optional['ID'] = Field(default=None)     continent: _t.Optional['Continent'] = Field(default=None)     currency: _t.Optional['String'] = Field(default=None)     emoji: _t.Optional['String'] = Field(default=None)     emojiU: _t.Optional['String'] = Field(default=None)     languages: _t.Optional[_t.List['Language']] = Field(default_factory=list)     name: _t.Optional['String'] = Field(default=None)     native: _t.Optional['String'] = Field(default=None)     phone: _t.Optional['String'] = Field(default=None)     states: _t.Optional[_t.List['State']] = Field(default_factory=list)     typename__: _t.Literal[\"Country\"] = Field(default=\"Country\", alias=\"__typename\")   class Language(GraphQLBaseModel):     \"\"\"     An Object type     See https:\/\/graphql.org\/learn\/schema\/#object-types-and-fields     \"\"\"     code: _t.Optional['ID'] = Field(default=None)     name: _t.Optional['String'] = Field(default=None)     native: _t.Optional['String'] = Field(default=None)     rtl: _t.Optional['Boolean'] = Field(default=None)     typename__: _t.Literal[\"Language\"] = Field(default=\"Language\", alias=\"__typename\")   class State(GraphQLBaseModel):     \"\"\"     An Object type     See https:\/\/graphql.org\/learn\/schema\/#object-types-and-fields     \"\"\"     code: _t.Optional['String'] = Field(default=None)     country: _t.Optional['Country'] = Field(default=None)     name: _t.Optional['String'] = Field(default=None)     typename__: _t.Literal[\"State\"] = Field(default=\"State\", alias=\"__typename\")   class _Service(GraphQLBaseModel):     \"\"\"     An Object type     See https:\/\/graphql.org\/learn\/schema\/#object-types-and-fields     \"\"\"     sdl: _t.Optional['String'] = Field(default=None)     typename__: _t.Literal[\"_Service\"] = Field(default=\"_Service\", alias=\"__typename\")   Continent.update_forward_refs() Country.update_forward_refs() Language.update_forward_refs() State.update_forward_refs() _Service.update_forward_refs()<\/code><\/pre>\n<p>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 <strong><em>GraphQLBaseModel<\/em> <\/strong>\u043f\u043e\u043a\u0430 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e. \u042d\u0442\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432 \u0433\u0440\u044f\u0434\u0443\u0449\u0438\u0445 \u0440\u0435\u043b\u0438\u0437\u0430\u0445. <br \/>\u0411\u043b\u043e\u043a<\/p>\n<pre><code class=\"python\">Continent.update_forward_refs() Country.update_forward_refs() Language.update_forward_refs() State.update_forward_refs() _Service.update_forward_refs()<\/code><\/pre>\n<p>\u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b pydantic \u043c\u043e\u0433 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043f\u043e\u043b\u044f\u043c\u044f, \u0438\u043c\u0435\u044e\u0449\u0438\u043c\u0438 \u0442\u0438\u043f, \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0439 \u0441 \u0441\u0430\u043c\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c (<a href=\"https:\/\/docs.pydantic.dev\/usage\/postponed_annotations\/\" rel=\"noopener noreferrer nofollow\">https:\/\/docs.pydantic.dev\/usage\/postponed_annotations\/<\/a>).<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b <strong>graphql2python <\/strong>\u0431\u044b\u043b \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u0434\u0435\u043b\u0430\u043d \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043d\u0443\u0436\u0434. \u0412 \u0433\u0440\u044f\u0434\u0443\u0449\u0438\u0445 \u0440\u0435\u043b\u0438\u0437\u0430\u0445 <strong>graphql2python<\/strong> \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0444\u0430\u0439\u043b \u0441 \u043c\u043e\u0434\u0435\u043b\u044c\u044e. \u0412 \u043f\u043b\u0430\u043d\u0430\u0445<\/p>\n<ul>\n<li>\n<p>\u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u044b;<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 pydantic, \u0430 <a href=\"https:\/\/github.com\/lidatong\/dataclasses-json\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/lidatong\/dataclasses-json<\/a>);<\/p>\n<\/li>\n<li>\n<p>\u0430\u043b\u0438\u0430\u0441\u044b \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u0435\u0439, \u043d\u043e \u0438 \u0434\u043b\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p>\u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0440\u0435\u043d\u0434\u0435\u0440 <strong>InputObjectType<\/strong>;<\/p>\n<\/li>\n<li>\n<p>\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 GraphQL \u0441\u0445\u0435\u043c\u044b \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u0444\u0430\u0439\u043b\u0430, \u043d\u043e \u0438 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0445\u0443\u043a\u0438 (\u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 isort, black \u0438 \u0442.\u043f.):<\/p>\n<\/li>\n<li>\n<p>\u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u043b\u0438 \u0436\u0435\u043b\u0430\u0435\u043c\u043e \ud83d\ude42<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 GraphQL \u043d\u0430 python \u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u043d\u0435\u0441\u0442\u0438 \u0432\u043a\u043b\u0430\u0434 \u0432 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435  \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430  graphql-python, \u0442\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u044b <a href=\"https:\/\/github.com\/denisart\/graphql-query\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/denisart\/graphql-query<\/a>, <a href=\"https:\/\/github.com\/denisart\/graphql2python\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/denisart\/graphql2python<\/a> \u0438, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b python GraphQL \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 <a href=\"https:\/\/github.com\/graphql-python\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/graphql-python<\/a>. <\/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\/post\/707374\/\"> https:\/\/habr.com\/ru\/post\/707374\/<\/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>\u0420\u0435\u0447\u044c \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0445 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441<a href=\"https:\/\/graphql.org\/\" rel=\"noopener noreferrer nofollow\"> GraphQL<\/a> \u043d\u0430 Python \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430. \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 GraphQL \u0432 \u0441\u0432\u043e\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445 \u043d\u0430 Python, \u0442\u043e, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435 GraphQL \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043f\u0438\u0441\u0430\u0442\u044c Python \u043a\u043b\u0430\u0441\u0441\u044b \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u044d\u0442\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u0430\u043c \u0431\u044b\u043b\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e: \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0445\u043e\u0436\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u043f\u0440\u0438 \u0447\u0430\u0441\u0442\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0441\u0445\u0435\u043c\u044b \u0438 \u0442.\u043f. \u0412\u043e\u0442 \u0438 \u043c\u043d\u0435 \u0442\u043e\u0436\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0440\u0435\u0448\u0430\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u0430 \u0441\u0432\u0435\u0442 \u0434\u0432\u0430 \u043f\u0430\u043a\u0435\u0442\u0430: <a href=\"https:\/\/pypi.org\/project\/graphql-query\/\" rel=\"noopener noreferrer nofollow\">graphql-query<\/a> \u0438 <a href=\"https:\/\/pypi.org\/project\/graphql2python\/\" rel=\"noopener noreferrer nofollow\">graphql2python<\/a>.<\/p>\n<h3>\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u0441 \u043f\u0430\u043a\u0435\u0442\u043e\u043c graphql-query<\/h3>\n<p>\u041f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 GraphQL \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u043d\u0430 Python (<a href=\"https:\/\/graphql.org\/code\/#python-client\" rel=\"noopener noreferrer nofollow\">https:\/\/graphql.org\/code\/#python-client<\/a>) \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a, \u0442.\u0435. \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u0441\u0442\u0440\u043e\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438\u0437 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432, \u043e\u0431\u0449\u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u0442.\u043f.<\/p>\n<p><strong>graphql-query<\/strong> &#8212; \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u044b GraphQL \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 (<a href=\"https:\/\/graphql.org\/learn\/queries\/\" rel=\"noopener noreferrer nofollow\">https:\/\/graphql.org\/learn\/queries\/<\/a>) \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 <em>render<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0438\u0441\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/pypi.org\/project\/Jinja2\/\" rel=\"noopener noreferrer nofollow\">jinja2<\/a>.<\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f <strong>graphql-query<\/strong> \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <a href=\"https:\/\/denisart.github.io\/graphql-query\/\" rel=\"noopener noreferrer nofollow\">https:\/\/denisart.github.io\/graphql-query\/<\/a>. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043a\u0430\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 GraphQL.<\/p>\n<h3>\u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441<\/h3>\n<p>\u0414\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441. \u0422\u0430\u043a\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a<\/p>\n<pre><code class=\"javascript\">{   hero {     name   } }<\/code><\/pre>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 <strong>graphql-query<\/strong> \u043c\u043e\u0436\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c<\/p>\n<pre><code class=\"python\">from graphql_query import Operation, Query  hero = Query(name=\"hero\", fields=[\"name\"]) operation = Operation(type=\"query\", queries=[hero])  print(operation.render()) # query { #  hero { #    name #  } # }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 <em>render <\/em>\u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <strong><em>graphql_query.Operation<\/em><\/strong><em> <\/em>\u043a\u0430\u043a \u0440\u0430\u0437 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c. \u0412\u043d\u0443\u0442\u0440\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 <strong><em>fields<\/em><\/strong> \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <strong><em>graphql_query.Query<\/em><\/strong> \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c<\/p>\n<ul>\n<li>\n<p>\u0441\u0442\u0440\u043e\u043a\u0438 (\u0438\u043c\u0435\u043d\u0430 \u043f\u043e\u043b\u0435\u0439);<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u044a\u0435\u043a\u0442\u044b <strong><em>graphql_query.Field<\/em><\/strong><em>;<\/em><\/p>\n<\/li>\n<li>\n<p>\u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b (<a href=\"https:\/\/graphql.org\/learn\/queries\/#inline-fragments\" rel=\"noopener noreferrer nofollow\">Inline Fragments<\/a>);<\/p>\n<\/li>\n<\/ul>\n<h3>\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b, \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435<\/h3>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 (<a href=\"https:\/\/graphql.org\/learn\/queries\/#variables\" rel=\"noopener noreferrer nofollow\">Variables<\/a>), \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b (<a href=\"https:\/\/graphql.org\/learn\/queries\/#arguments\" rel=\"noopener noreferrer nofollow\">Arguments<\/a>) \u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b (<a href=\"https:\/\/graphql.org\/learn\/queries\/#fragments\" rel=\"noopener noreferrer nofollow\">Fragments<\/a>):<\/p>\n<pre><code class=\"javascript\">query HeroComparison($first: Int = 3) {   leftComparison: hero(episode: EMPIRE) {     ...comparisonFields   }   rightComparison: hero(episode: JEDI) {     ...comparisonFields   } }  fragment comparisonFields on Character {   name   friendsConnection(first: $first) {     totalCount     edges {       node {         name       }     }   } }<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0432\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u0432\u043c\u0435\u0441\u0442\u0435 \u0441 <a href=\"https:\/\/graphql.org\/learn\/queries\/#aliases\" rel=\"noopener noreferrer nofollow\">\u0430\u043b\u0438\u0430\u0441\u0430\u043c\u0438<\/a>) \u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u043b\u0435\u0439. \u041a\u043e\u0434 \u043d\u0430 <strong>graphql-query <\/strong>\u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a<\/p>\n<pre><code class=\"python\">from graphql_query import Argument, Operation, Query, Fragment, Field, Variable  # \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, # \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 var_first = Variable(name=\"first\", type=\"Int\", default=\"3\")  arg_first = Argument(name=\"first\", value=var_first) arg_empire = Argument(name=\"episode\", value=\"EMPIRE\") arg_jedi = Argument(name=\"episode\", value=\"JEDI\")  # \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 comparisonFields comparisonFields = Fragment(     name=\"comparisonFields\",     type=\"Character\",     fields=[         \"name\",         Field(             name=\"friendsConnection\",             # \u043e\u0431\u044a\u0435\u043a\u0442 graphql_query.Field \u0442\u043e\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u043e\u043b\u0435 arguments             arguments=[arg_first],             fields=[                 \"totalCount\",                 Field(                     name=\"edges\",                     fields=[Field(name=\"node\", fields=[\"name\"])]                 )             ]         )     ] )  # \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 leftComparison = Query(     name=\"hero\",     alias=\"leftComparison\",  # alias \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430     arguments=[arg_empire],     fields=[comparisonFields]  # \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u043b\u044f )  # \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 rightComparison = Query(     name=\"hero\",     alias=\"rightComparison\",  # alias \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430     arguments=[arg_jedi],     fields=[comparisonFields]  # \u0442\u043e\u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u043b\u044f )  # \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 operation = Operation(     type=\"query\",     name=\"HeroComparison\",     queries=[leftComparison, rightComparison],     fragments=[comparisonFields],     variables=[var_first] ) print(operation.render()) # query HeroComparison( #   $first: Int = 3 # ) { #   leftComparison: hero( #     episode: EMPIRE #   ) { #     ...comparisonFields #   } # #   rightComparison: hero( #     episode: JEDI #   ) { #     ...comparisonFields #   } # } # # fragment comparisonFields on Character { #   name #   friendsConnection( #     first: $first #   ) { #     totalCount #     edges { #       node { #         name #       } #     } #   } # }<\/code><\/pre>\n<p>\u042f\u0441\u043d\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 <strong><em>leftComparison<\/em><\/strong> \u0438 <strong><em>rightComparison<\/em><\/strong> \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430<\/p>\n<pre><code class=\"python\">def generate_hero(alias: str, argument: graphql_query.Argument) -> graphql_query.Query:     return Query(         name=\"hero\",         alias=alias,         arguments=[argument],         fields=[comparisonFields]  # \u0442\u043e\u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u043b\u044f     )  leftComparison = generate_hero(\"leftComparison\", arg_empire) rightComparison = generate_hero(\"rightComparison\", arg_jedi)<\/code><\/pre>\n<p>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438: <a href=\"https:\/\/denisart.github.io\/graphql-query\/#directives\" rel=\"noopener noreferrer nofollow\">\u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b<\/a>, <a href=\"https:\/\/denisart.github.io\/graphql-query\/#meta-fields\" rel=\"noopener noreferrer nofollow\">__typename<\/a> \u0438 \u0434\u0440.<\/p>\n<h3>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0434\u0430\u0442\u0430-\u043c\u043e\u0434\u0435\u043b\u0438 \u0441 \u043f\u0430\u043a\u0435\u0442\u043e\u043c graphql2python<\/h3>\n<p>\u0415\u0441\u0442\u044c \u0434\u0432\u0430 \u0445\u043e\u0440\u043e\u0448\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441\u043e\u0444\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e \u0441\u0445\u0435\u043c\u0430\u043c<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/the-guild.dev\/graphql\/codegen\" rel=\"noopener noreferrer nofollow\"><strong>graphql code generator<\/strong><\/a><strong> <\/strong>\u043d\u0430 TypeScript;<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/koxudaxi\/datamodel-code-generator\" rel=\"noopener noreferrer nofollow\"><strong>datamodel-code-generator<\/strong><\/a> \u043d\u0430 python \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438\u0437 openapi.<\/p>\n<\/li>\n<\/ul>\n<p><strong>graphql2python<\/strong> &#8212; \u0441\u0445\u043e\u0436\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 <strong>pydantic<\/strong> \u043a\u043b\u0430\u0441\u0441\u044b \u0438\u0437 GraphQL \u0441\u0445\u0435\u043c\u044b. \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <a href=\"https:\/\/denisart.github.io\/graphql2python\/\" rel=\"noopener noreferrer nofollow\">https:\/\/denisart.github.io\/graphql2python\/<\/a>. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 <strong>graphql2python<\/strong> c \u043f\u043e\u043c\u043e\u0449\u044c\u044e pip \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443<\/p>\n<pre><code class=\"bash\">graphql2python render --config .\/graphql2python.yaml<\/code><\/pre>\n<p>\u0433\u0434\u0435  <strong><em>graphql2python.yaml<\/em><\/strong> &#8212; \u044d\u0442\u043e \u0432\u0430\u0448 \u0444\u0430\u0439\u043b \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439. \u0412 \u0441\u0430\u043c\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0432\u0438\u0434\u0435 \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a<\/p>\n<pre><code class=\"yaml\"># graphql2python.yaml schema: .\/schema.graphql output: .\/model.py<\/code><\/pre>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043d\u0430 \u0433\u0440\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438. \u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441\u043e\u0437\u0434\u0430\u0442 (\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0448\u0435\u0442) \u0444\u0430\u0439\u043b <em>.\/output.py<\/em>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430 python. <\/p>\n<h3>\u0421\u043a\u0430\u043b\u044f\u0440\u044b<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432 GraphQL \u0441\u0445\u0435\u043c\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0441\u043a\u0430\u043b\u044f\u0440\u044b<\/p>\n<pre><code class=\"javascript\"># in schema.graphql ...  \"in the format: dd\/mm\/yyyy\" scalar DateTime  ...<\/code><\/pre>\n<p>\u0442\u043e \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c<\/p>\n<pre><code class=\"python\"># output.py  ...  # The `Boolean` scalar type represents `true` or `false`. Boolean = str   # in the format: dd\/mm\/yyyy DateTime = str   # The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most # often used by GraphQL to represent free-form human-readable text. String = str<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 GraphQL \u0441\u043a\u0430\u043b\u044f\u0440\u043e\u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u0437\u044f\u0442\u044b \u0438\u0437 <a href=\"https:\/\/github.com\/graphql-python\/graphql-core\/blob\/main\/src\/graphql\/type\/scalars.py\" rel=\"noopener noreferrer nofollow\"><strong><em>graphql-core<\/em><\/strong><\/a><em>. <\/em>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u0441\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0442\u0438\u043f\u044b \u0431\u0443\u0434\u0443\u0442 <strong><em>str<\/em><\/strong>. \u042d\u0442\u043e \u043b\u0435\u0433\u043a\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0430. \u0414\u043b\u044f<\/p>\n<pre><code class=\"yaml\"># graphql2python.yaml schema: ... output: ... options:   scalar_pytypes:     String: str     Float: float     Int: int     ID: str     Boolean: bool     DateTime: datetime<\/code><\/pre>\n<p>\u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c<\/p>\n<pre><code class=\"python\"># output.py  ...  # The `Boolean` scalar type represents `true` or `false`. Boolean = bool   # in the format: dd\/mm\/yyyy DateTime = datetime   # The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most # often used by GraphQL to represent free-form human-readable text. String = str  ...<\/code><\/pre>\n<p>\u041d\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0442\u0438\u043f\u044b python \u043f\u043e\u043a\u0430 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b. \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e \u0432 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0445 \u0440\u0435\u043b\u0438\u0437\u0430\u0445, \u043a\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u044b, \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b.<\/p>\n<h4>Enum \u0438 Union<\/h4>\n<p>\u0414\u043b\u044f \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 GraphQL <a href=\"https:\/\/graphql.org\/learn\/schema\/#enumeration-types\" rel=\"noopener noreferrer nofollow\">Enum<\/a> \u0438 GraphQL <a href=\"https:\/\/graphql.org\/learn\/schema\/#union-types\" rel=\"noopener noreferrer nofollow\">Union<\/a> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f enum.Enum \u0438 typing.Union \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440<\/p>\n<pre><code class=\"javascript\"># schema.graphql  ...  enum Episode {   NEWHOPE   EMPIRE   JEDI }  \"\"\" Wherever we return a SearchResult type in our schema, we might get a Human, a Droid, or a Starship. \"\"\" union SearchResult = Human | Droid | Starship<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0442\u0430\u043a\u043e\u0439 \u0441\u0445\u0435\u043c\u044b (\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 <strong><em>Human<\/em><\/strong>, <strong><em>Droid<\/em><\/strong> \u0438 <strong><em>Starship<\/em><\/strong> \u043e\u043f\u0443\u0449\u0435\u043d\u043e) \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/p>\n<pre><code class=\"python\"># output.py  ...  class Episode(enum.Enum):     \"\"\"     An Enum type     See https:\/\/graphql.org\/learn\/schema\/#enumeration-types     \"\"\"     EMPIRE = \"EMPIRE\"     JEDI = \"JEDI\"     NEWHOPE = \"NEWHOPE\"   # Wherever we return a SearchResult type in our schema, # we might get a Human, a Droid, or a Starship. SearchResult = _t.Union[     'Droid',     'Human',     'Starship', ]  ...<\/code><\/pre>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442 typing.Union \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c<\/p>\n<pre><code class=\"python\"># output.py \u0434\u043b\u044f \u0441\u0445\u0435\u043c\u044b # # \"\"\" # Wherever we return a SearchResult type in our schema, # we might get a Human, a Droid, or a Starship. # \"\"\" # union SearchResult = Human  ...  # Wherever we return a SearchResult type in our schema, # we might get a Human, a Droid, or a Starship. SearchResult = _t.TypeVar('SearchResult', bound='Human')  ...<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 <strong>_t <\/strong>\u0435\u0441\u0442\u044c \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043e\u0442 <strong>typing<\/strong>, \u0442.\u0435.<\/p>\n<pre><code class=\"python\">import typing as _t<\/code><\/pre>\n<h4>\u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440<\/h4>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u0438\u0437 <a href=\"https:\/\/countries.trevorblades.com\/\" rel=\"noopener noreferrer nofollow\">https:\/\/countries.trevorblades.com\/<\/a> \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0434\u043b\u044f \u043d\u0435\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u043c<\/p>\n<pre><code class=\"yaml\"># graphql2python.yaml schema: .\/schema.graphql output: .\/model.py options:   each_field_optional: true   scalar_pytypes:     Boolean: bool<\/code><\/pre>\n<p>\u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0444\u0430\u0439\u043b<\/p>\n<pre><code class=\"python\">\"\"\"Auto-generated by graphql2python.\"\"\"  # pylint: disable-all # mypy: ignore-errors  import enum import typing as _t from datetime import date, datetime  from pydantic import BaseModel, Field  __all__ = [     \"GraphQLBaseModel\",     # scalars     \"Boolean\",     \"ID\",     \"String\",     \"_Any\",     # enums     # unions     \"_Entity\",     # interfaces     # objects     \"Continent\",     \"Country\",     \"Language\",     \"State\",     \"_Service\", ]   class GraphQLBaseModel(BaseModel):     \"\"\"Base Model for GraphQL object.\"\"\"      class Config:         allow_population_by_field_name = True         json_encoders = {             # custom output conversion for datetime             datetime: lambda dt: dt.isoformat()         }         smart_union = True   # The `Boolean` scalar type represents `true` or `false`.<\/code><\/pre>\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-343062","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/343062","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=343062"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/343062\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=343062"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=343062"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=343062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}