{"id":318757,"date":"2021-02-28T15:00:11","date_gmt":"2021-02-28T15:00:11","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=318757"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=318757","title":{"rendered":"Json api \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430 aiohttp: middleware \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f json api \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0441 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/aio-libs\/aiohttp\" rel=\"nofollow noopener noreferrer\">aiohttp<\/a>. \u042d\u0442\u043e \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439, \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 python, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 <code>asyncio<\/code>.<\/p>\n<p>  <\/p>\n<p><strong>\u041e\u0431 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u0445:<\/strong><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u0432 <code>python<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0434 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c. \u0422\u0430\u043a \u0436\u0435, \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u0418\u043c\u0435\u043d\u043d\u043e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0438\u0433\u0440\u0430\u044e\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u0443\u044e \u0440\u043e\u043b\u044c \u043f\u0440\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 api-\u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p><strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438:<\/strong><\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/aio-libs\/aiohttp\" rel=\"nofollow noopener noreferrer\">aiohttp<\/a> \u2014 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f web-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439<\/li>\n<li><a href=\"https:\/\/github.com\/samuelcolvin\/pydantic\" rel=\"nofollow noopener noreferrer\">pydantic<\/a> \u2014 \u043a\u043b\u0430\u0441\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445<\/li>\n<li><a href=\"https:\/\/github.com\/EvgeniyBurdin\/valdec\" rel=\"nofollow noopener noreferrer\">valdec<\/a> \u2014 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/li>\n<\/ul>\n<p>  <\/p>\n<p><strong>\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435:<\/strong><\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"#1-fayly-i-papki-prilozheniya\">1. \u0424\u0430\u0439\u043b\u044b \u0438 \u043f\u0430\u043f\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/a><\/li>\n<li><a href=\"#2-json-middlewares\">2. json middlewares<\/a><br \/> \n<ul>\n<li><a href=\"#21-prostaya-middleware-dlya-json-servisa\">2.1. \u041f\u0440\u043e\u0441\u0442\u0430\u044f middleware \u0434\u043b\u044f json \u0441\u0435\u0440\u0432\u0438\u0441\u0430<\/a><br \/> \n<ul>\n<li><a href=\"#211-obyavlenie-obrabotchika\">2.1.1. \u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430<\/a><\/li>\n<li><a href=\"#212-klass-simplehandler-dlya-middleware\">2.1.2. \u041a\u043b\u0430\u0441\u0441 SimpleHandler \u0434\u043b\u044f middleware<\/a><br \/> \n<ul>\n<li><a href=\"#2121-metod-middleware\">2.1.2.1. \u041c\u0435\u0442\u043e\u0434 middleware<\/a><\/li>\n<li><a href=\"#2122-metod-dlya-polucheniya-dannyh-otveta-s-oshibkoy\">2.1.2.2. \u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u0430 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439<\/a><\/li>\n<li><a href=\"#2123-metod-zapuska-obrabotchika\">2.1.2.3. \u041c\u0435\u0442\u043e\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#213-primery\">2.1.3. \u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/a><br \/> \n<ul>\n<li>2.1.3.1. \u041e\u0442\u0432\u0435\u0442 \u0441 \u043a\u043e\u0434\u043e\u043c 200<\/li>\n<li>2.1.3.2. \u041e\u0442\u0432\u0435\u0442 \u0441 \u043a\u043e\u0434\u043e\u043c 400<\/li>\n<li>2.1.3.3. \u041e\u0442\u0432\u0435\u0442 \u0441 \u043a\u043e\u0434\u043e\u043c 500<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#22-middleware-dlya-kwargs-obrabotchikov\">2.2. middleware \u0434\u043b\u044f &quot;kwargs-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432&quot;<\/a><br \/> \n<ul>\n<li><a href=\"#221-obyavlenie-obrabotchika\">2.2.1. \u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430<\/a><\/li>\n<li><a href=\"#222-vspomogatelnyy-klass-argumentsmanager\">2.2.2. \u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 ArgumentsManager<\/a><\/li>\n<li><a href=\"#223-klass-kwargshandler-dlya-middleware\">2.2.3. \u041a\u043b\u0430\u0441\u0441 KwargsHandler \u0434\u043b\u044f middleware<\/a><br \/> \n<ul>\n<li><a href=\"#2231-metod-zapuska-obrabotchika\">2.2.3.1. \u041c\u0435\u0442\u043e\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430<\/a><\/li>\n<li><a href=\"#2232-metod-formirovaniya-slovarya-s-imenami-argumentov-i-ih-znacheniyami\">2.2.3.2. \u041c\u0435\u0442\u043e\u0434 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0441 \u0438\u043c\u0435\u043d\u0430\u043c\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#224-primery\">2.2.4. \u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/a><br \/> \n<ul>\n<li>2.2.4.1. \u041c\u0435\u0442\u043e\u0434 \/create<\/li>\n<li>2.2.4.2. \u041c\u0435\u0442\u043e\u0434 \/read<\/li>\n<li>2.2.4.3. \u041c\u0435\u0442\u043e\u0434 \/info\/{info_id}<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#23-middleware-c-obolochkami-zaprosaotveta-i-validaciey\">2.3. middleware c \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\/\u043e\u0442\u0432\u0435\u0442\u0430 \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0435\u0439<\/a><br \/> \n<ul>\n<li><a href=\"#231-klass-dannyh-pydanticbasemodel\">2.3.1. \u041a\u043b\u0430\u0441\u0441 \u0434\u0430\u043d\u043d\u044b\u0445 pydantic.BaseModel<\/a><br \/> \n<ul>\n<li><a href=\"#2311-strogie-tipy\">2.3.1.1. \u0421\u0442\u0440\u043e\u0433\u0438\u0435 \u0442\u0438\u043f\u044b<\/a><\/li>\n<li><a href=\"#2312-strogaya-signatura-pri-sozdanii-ekzemplyara\">2.3.1.2. \u0421\u0442\u0440\u043e\u0433\u0430\u044f \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#232-dekorator-valdecvalidate\">2.3.2. \u0414\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 valdec.validate<\/a><br \/> \n<ul>\n<li><a href=\"#2321-funkcii-validatory\">2.3.2.1. \u0424\u0443\u043d\u043a\u0446\u0438\u0438-\u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u044b<\/a><\/li>\n<li><a href=\"#2322-nastroyka-dekoratora\">2.3.2.2. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u0430<\/a><\/li>\n<li><a href=\"#2323-esche-raz-pro-privedenie-tipov\">2.3.2.3. \u0415\u0449\u0435 \u0440\u0430\u0437 \u043f\u0440\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432<\/a><\/li>\n<li><a href=\"#2324-isklyucheniya\">2.3.2.4. \u0418\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#233-bazovyy-klass-dannyh\">2.3.3. \u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u0430\u043d\u043d\u044b\u0445<\/a><\/li>\n<li><a href=\"#234-obyavlenie-obrabotchika\">2.3.4. \u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430<\/a><\/li>\n<li><a href=\"#235-klassy-dannyh-dlya-obolochek\">2.3.5. \u041a\u043b\u0430\u0441\u0441\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0431\u043e\u043b\u043e\u0447\u0435\u043a<\/a><\/li>\n<li><a href=\"#236-klass-wrapskwargshandler-dlya-middleware\">2.3.6. \u041a\u043b\u0430\u0441\u0441 WrapsKwargsHandler \u0434\u043b\u044f middleware<\/a><br \/> \n<ul>\n<li><a href=\"#2361-metod-zapuska-obrabotchika\">2.3.6.1. \u041c\u0435\u0442\u043e\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430<\/a><\/li>\n<li><a href=\"#2362-metod-dlya-polucheniya-dannyh-otveta-s-oshibkoy\">2.3.6.2. \u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u0430 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#237-primery\">2.3.7. \u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/a><br \/> \n<ul>\n<li>2.3.7.1. \u041c\u0435\u0442\u043e\u0434 \/create<\/li>\n<li>2.3.7.2. \u041c\u0435\u0442\u043e\u0434 \/read<\/li>\n<li>2.3.7.3. \u041c\u0435\u0442\u043e\u0434 \/info\/{info_id}<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#3-o-nerealizovannoy-dokumentacii\">3. \u041e \u043d\u0435\u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a><\/li>\n<li><a href=\"#4-zaklyuchenie\">4. \u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<h2 id=\"1-fayly-i-papki-prilozheniya-anchor1-fayly-i-papki-prilozheniyaanchor\">1. \u0424\u0430\u0439\u043b\u044b \u0438 \u043f\u0430\u043f\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f <a name=\"1-fayly-i-papki-prilozheniya\"><\/a><\/h2>\n<p>  <\/p>\n<pre><code class=\"plaintext\">- sources - \u041f\u0430\u043f\u043a\u0430 \u0441 \u043a\u043e\u0434\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f     - data_classes - \u041f\u0430\u043f\u043a\u0430 \u0441 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445         - base.py - \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u0430\u043d\u043d\u044b\u0445         - person.py - \u043a\u043b\u0430\u0441\u0441\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u043f\u0435\u0440\u0441\u043e\u043d\u0435         - wraps.py - \u043a\u043b\u0430\u0441\u0441\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0431\u043e\u043b\u043e\u0447\u0435\u043a \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432\/\u043e\u0442\u0432\u0435\u0442\u043e\u0432     - handlers - \u041f\u0430\u043f\u043a\u0430 \u0441 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432         - kwargs.py - \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 `KwargsHandler.middleware`         - simple.py - \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 `SimpleHandler.middleware`         - wraps.py - \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 `WrapsKwargsHandler.middleware`     - middlewares - \u041f\u0430\u043f\u043a\u0430 \u0441 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438 \u0434\u043b\u044f middlewares         - exceptions.py - \u043a\u043b\u0430\u0441\u0441\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439         - kwargs_handler.py - \u043a\u043b\u0430\u0441\u0441 `KwargsHandler`         - simple_handler.py - \u043a\u043b\u0430\u0441\u0441 `SimpleHandler`         - utils.py - \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f middlewares         - wraps_handler.py - \u043a\u043b\u0430\u0441\u0441 `WrapsKwargsHandler`     - requirements.txt - \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f     - run_kwargs.py - \u0437\u0430\u043f\u0443\u0441\u043a \u0441 `KwargsHandler.middleware`     - run_simple.py - \u0437\u0430\u043f\u0443\u0441\u043a c `SimpleHandler.middleware`     - run_wraps.py - \u0437\u0430\u043f\u0443\u0441\u043a c `WrapsKwargsHandler.middleware`     - settings.py - \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f - Dockerfile - \u0434\u043e\u043a\u0435\u0440\u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043e\u0431\u0440\u0430\u0437\u0430<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431: <a href=\"https:\/\/github.com\/EvgeniyBurdin\/api_service\" rel=\"nofollow noopener noreferrer\">https:\/\/github.com\/EvgeniyBurdin\/api_service<\/a><\/p>\n<p>  <\/p>\n<h2 id=\"2-json-middlewares-anchor2-json-middlewaresanchor\">2. json middlewares <a name=\"2-json-middlewares\"><\/a><\/h2>\n<p>  <\/p>\n<p><code>middleware<\/code> \u0432 <code>aiohttp.web.Application()<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u043e\u0439 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>middleware<\/code>, \u0442\u043e \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0432\u0448\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 \u043d\u0435\u0451, \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a. \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0438 \u043e\u0442\u0434\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442. \u042d\u0442\u043e\u0442 \u043e\u0442\u0432\u0435\u0442 \u0441\u043d\u043e\u0432\u0430 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 <code>middleware<\/code> \u0438 \u0443\u0436\u0435 \u043e\u043d\u0430 \u043e\u0442\u0434\u0430\u0435\u0442 \u0435\u0433\u043e \u043d\u0430\u0440\u0443\u0436\u0443.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043d\u043e <code>middleware<\/code>, \u0442\u043e \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u043d\u0438\u0445 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<p>\u041c\u0435\u0436\u0434\u0443 <code>middleware<\/code> \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f &quot;\u0437\u0430\u043f\u0440\u043e\u0441&quot; \u0438 &quot;\u043e\u0442\u0432\u0435\u0442&quot; \u0432 \u0432\u0438\u0434\u0435 <code>web.Request<\/code> \u0438 <code>web.Response<\/code>. \u0414\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432 <code>middleware<\/code> \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0430\u0434 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438\/\u043e\u0442\u0432\u0435\u0442\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 <strong>\u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438 \u0434\u043b\u044f \u0432\u0441\u0435\u0445<\/strong> \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435, \u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u0435 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>  <\/p>\n<h3 id=\"21-prostaya-middleware-dlya-json-servisa-anchor21-prostaya-middleware-dlya-json-servisaanchor\">2.1. \u041f\u0440\u043e\u0441\u0442\u0430\u044f middleware \u0434\u043b\u044f json \u0441\u0435\u0440\u0432\u0438\u0441\u0430 <a name=\"21-prostaya-middleware-dlya-json-servisa\"><\/a><\/h3>\n<p>  <\/p>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 <code>aiohttp.web.Application()<\/code> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442, \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e, \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from aiohttp import web  async def some_handler(request: web.Request) -&gt; web.Response:     data = await request.json()     ...     text = json.dumps(some_data)     ...     return web.Response(text=text, ...)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e &quot;\u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c&quot; \u0438\u0437 <code>web.Request<\/code> \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u043f\u0435\u0440\u0435\u0434\u0430\u043b \u0432 json. \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0435\u0433\u043e, \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430. \u0417\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 json \u0438 \u043e\u0442\u0434\u0430\u0442\u044c &quot;\u043d\u0430\u0440\u0443\u0436\u0443&quot; <code>web.Response<\/code> (\u043c\u043e\u0436\u043d\u043e \u043e\u0442\u0434\u0430\u0442\u044c \u0438 \u0441\u0440\u0430\u0437\u0443 <code>web.json_response()<\/code>).<\/p>\n<p>  <\/p>\n<h4 id=\"211-obyavlenie-obrabotchika-anchor211-obyavlenie-obrabotchikaanchor\">2.1.1. \u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 <a name=\"211-obyavlenie-obrabotchika\"><\/a><\/h4>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0448\u0430\u0433\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0441\u043e\u0437\u0434\u0430\u0442\u044c <code>middleware<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u044c\u043c\u0435\u0442 \u043d\u0430 \u0441\u0435\u0431\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043e\u0448\u0438\u0431\u043e\u043a, \u0430 \u0441\u0430\u043c\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0431\u044b \u0441\u0442\u0430\u043b\u0438 \u0442\u0430\u043a\u0438\u043c\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from aiohttp import web  async def some_handler(request: web.Request, data: Any) -&gt; Any:     ...     return some_data<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0430 \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430. \u0412 \u043f\u0435\u0440\u0432\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <code>web.Request<\/code> (\u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439), \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 python, \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0432\u0442\u043e\u0440\u043e\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0438\u043c\u0435\u0435\u0442 \u0442\u0430\u043a\u043e\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435: <code>data: Any<\/code>. \u0418\u043c\u044f \u0443 \u043d\u0435\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u044b\u043c (\u043a\u0430\u043a \u0438 \u0443 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430), \u0430 \u0432\u043e\u0442 \u0432 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u043b\u0443\u0447\u0448\u0435 \u0441\u0440\u0430\u0437\u0443 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u0438\u043f \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 &quot;\u0436\u0434\u0435\u0442&quot; \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a. \u042d\u0442\u043e \u043f\u043e\u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e \u0438 \u0434\u043b\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430.<\/p>\n<p>  <\/p>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c, \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u0434\u0435, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u0438\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from aiohttp import web from typing import Union, List  async def some_handler(     request: web.Request, data: Union[str, List[str]] ) -&gt; List[int]:     ...     return some_data<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"212-klass-simplehandler-dlya-middleware-anchor212-klass-simplehandler-dlya-middlewareanchor\">2.1.2. \u041a\u043b\u0430\u0441\u0441 <code>SimpleHandler<\/code> \u0434\u043b\u044f middleware <a name=\"212-klass-simplehandler-dlya-middleware\"><\/a><\/h4>\n<p>  <\/p>\n<p>\u041a\u043b\u0430\u0441\u0441 <code>SimpleHandler<\/code> \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0439 <code>middleware<\/code> \u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c\/\u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b <code>middleware<\/code> (<a href=\"https:\/\/github.com\/EvgeniyBurdin\/api_service\/blob\/main\/sources\/middlewares\/simple_handler.py\" rel=\"nofollow noopener noreferrer\">\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430<\/a>).<\/p>\n<p>  <\/p>\n<p>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u044e\u0441\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445.<\/p>\n<p>  <\/p>\n<h5 id=\"2121-metod-middleware-anchor2121-metod-middlewareanchor\">2.1.2.1. \u041c\u0435\u0442\u043e\u0434 <code>middleware<\/code> <a name=\"2121-metod-middleware\"><\/a><\/h5>\n<p>  <\/p>\n<pre><code class=\"python\">    @web.middleware     async def middleware(self, request: web.Request, handler: Callable):         &quot;&quot;&quot; middleware \u0434\u043b\u044f json-\u0441\u0435\u0440\u0432\u0438\u0441\u0430.         &quot;&quot;&quot;         if not self.is_json_service_handler(request, handler):             return await handler(request)          try:             request_body = await self.get_request_body(request, handler)          except Exception as error:             response_body = self.get_error_body(request, error)             status = 400          else:             # \u0417\u0430\u043f\u0443\u0441\u043a \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430             response_body, status = await self.get_response_body_and_status(                 request, handler, request_body             )          finally:             # \u0421\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0435\u043b\u0430\u0435\u043c \u0434\u0430\u043c\u043f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 python (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432             # response_body) \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 json.             text, status = await self.get_response_text_and_status(                 request, response_body, status             )          return web.Response(             text=text, status=status, content_type=&quot;application\/json&quot;,         )<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u043f\u0438\u0441\u043e\u043a <code>middlewares<\/code> \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">    ...     app = web.Application()     service_handler = SimpleHandler()     app.middlewares.append(service_handler.middleware)     ...<\/code><\/pre>\n<p>  <\/p>\n<h5 id=\"2122-metod-dlya-polucheniya-dannyh-otveta-s-oshibkoy-anchor2122-metod-dlya-polucheniya-dannyh-otveta-s-oshibkoyanchor\">2.1.2.2. \u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u0430 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 <a name=\"2122-metod-dlya-polucheniya-dannyh-otveta-s-oshibkoy\"><\/a><\/h5>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 json \u0441\u0435\u0440\u0432\u0438\u0441, \u0442\u043e, \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0448\u0438\u0431\u043a\u0438 \u0432\u043e \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0441 \u043a\u043e\u0434\u043e\u043c 400), \u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 (\u0441 \u043a\u043e\u0434\u043e\u043c 500), \u043e\u0442\u0434\u0430\u0432\u0430\u043b\u0438\u0441\u044c \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 json.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d \u043c\u0435\u0442\u043e\u0434 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f &quot;\u0442\u0435\u043b\u0430&quot; \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">    def get_error_body(self, request: web.Request, error: Exception) -&gt; dict:         &quot;&quot;&quot; \u041e\u0442\u0434\u0430\u0435\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441 \u0442\u0435\u043b\u043e\u043c \u043e\u0442\u0432\u0435\u0442\u0430 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439.         &quot;&quot;&quot;         return {&quot;error_type&quot;: str(type(error)), &quot;error_message&quot;: str(error)}<\/code><\/pre>\n<p>  <\/p>\n<p>\u0425\u043e\u0447\u0443 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u0435\u0437 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 json. \u0415\u0441\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c, \u0442\u043e \u043c\u044b \u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u043c json \u0432 \u0442\u0435\u043b\u0435 \u043e\u0442\u0432\u0435\u0442\u0430.<\/p>\n<p>  <\/p>\n<h5 id=\"2123-metod-zapuska-obrabotchika-anchor2123-metod-zapuska-obrabotchikaanchor\">2.1.2.3. \u041c\u0435\u0442\u043e\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 <a name=\"2123-metod-zapuska-obrabotchika\"><\/a><\/h5>\n<p>  <\/p>\n<p>\u0412 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u043e\u043d \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">    async def run_handler(         self, request: web.Request, handler: Callable, request_body: Any     ) -&gt; Any:         &quot;&quot;&quot; \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b.         &quot;&quot;&quot;         return await handler(request, request_body)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a \u0432\u044b\u0434\u0435\u043b\u0435\u043d \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0434\u043e\/\u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430.<\/p>\n<p>  <\/p>\n<h4 id=\"213-primery-anchor213-primeryanchor\">2.1.3. \u041f\u0440\u0438\u043c\u0435\u0440\u044b <a name=\"213-primery\"><\/a><\/h4>\n<p>  <\/p>\n<p>\u0418\u043c\u0435\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">async def some_handler(request: web.Request, data: dict) -&gt; dict:     return data<\/code><\/pre>\n<p>  <\/p>\n<p>\u0411\u0443\u0434\u0435\u043c \u043f\u043e\u0441\u044b\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 url \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0442\u0435\u043a\u0441\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432&#8230;<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<h5 id=\"2131-otvet-s-kodom-200\">2.1.3.1. \u041e\u0442\u0432\u0435\u0442 \u0441 \u043a\u043e\u0434\u043e\u043c 200<\/h5>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 <code>POST<\/code> \u043d\u0430 <code>\/some_handler<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;name&quot;: &quot;test&quot;,     &quot;age&quot;: 25 }<\/code><\/pre>\n<p>  <\/p>\n<p>\u2026 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e \u0432\u0435\u0440\u043d\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0441 \u043a\u043e\u0434\u043e\u043c 200:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;name&quot;: &quot;test&quot;,     &quot;age&quot;: 25 }<\/code><\/pre>\n<p>  <\/p>\n<h5 id=\"2132-otvet-s-kodom-400\">2.1.3.2. \u041e\u0442\u0432\u0435\u0442 \u0441 \u043a\u043e\u0434\u043e\u043c 400<\/h5>\n<p>  <\/p>\n<p>\u0421\u0434\u0435\u043b\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u0442\u0435\u043b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 <code>POST<\/code> \u043d\u0430 <code>\/some_handler<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;name&quot;: &quot;test&quot;, 111111111111     &quot;age&quot;: 25 }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u0432\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;error_type&quot;: &quot;&lt;class 'json.decoder.JSONDecodeError'&gt;&quot;,     &quot;error_message&quot;: &quot;Expecting property name enclosed in double quotes: line 2 column 21 (char 22)&quot; }<\/code><\/pre>\n<p>  <\/p>\n<h5 id=\"2133-otvet-s-kodom-500\">2.1.3.3. \u041e\u0442\u0432\u0435\u0442 \u0441 \u043a\u043e\u0434\u043e\u043c 500<\/h5>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043a\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 (\u044d\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u0430).<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">async def handler500(request: web.Request, data: dict) -&gt; dict:     raise Exception(&quot;\u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0448\u0438\u0431\u043a\u0438 500&quot;)     return data<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 <code>POST<\/code> \u043d\u0430 <code>\/handler500<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;name&quot;: &quot;test&quot;,     &quot;age&quot;: 25 }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0432 \u043e\u0442\u0432\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0442\u0430\u043a\u043e\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;error_type&quot;: &quot;&lt;class 'Exception'&gt;&quot;,     &quot;error_message&quot;: &quot;\u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0448\u0438\u0431\u043a\u0438 500&quot; }<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h3 id=\"22-middleware-dlya-kwargs-obrabotchikov-anchor22-middleware-dlya-kwargs-obrabotchikovanchor\">2.2. middleware \u0434\u043b\u044f &quot;kwargs-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432&quot; <a name=\"22-middleware-dlya-kwargs-obrabotchikov\"><\/a><\/h3>\n<p>  <\/p>\n<p><code>middleware<\/code> \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0430 \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u0445 \u043d\u0435 \u0440\u0435\u0448\u0435\u043d\u0430 \u0434\u043e \u043a\u043e\u043d\u0446\u0430.<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">async def some_handler(request: web.Request, data: dict) -&gt; dict:      storage = request.app[&quot;storage&quot;]     logger = request.app[&quot;logger&quot;]     user_id = request.match_info[&quot;user_id&quot;]     # \u0438 \u0442.\u0434. \u0438 \u0442.\u043f...      return data<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a <code>storage<\/code>, \u0438\u043b\u0438 <code>logger<\/code> (\u0438\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0435\u0449\u0435), \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0443\u0436\u043d\u044b \u0438 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u0445, \u0442\u043e \u0432\u0435\u0437\u0434\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f &quot;\u0434\u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c&quot; \u0438\u0445 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<p>  <\/p>\n<h4 id=\"221-obyavlenie-obrabotchika-anchor221-obyavlenie-obrabotchikaanchor\">2.2.1. \u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 <a name=\"221-obyavlenie-obrabotchika\"><\/a><\/h4>\n<p>  <\/p>\n<p>\u0425\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u043b\u0438\u0441\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">async def some_handler_1(data: dict) -&gt; int:     # ...     return some_data  async def some_handler_2(storage: StorageClass, data: List[int]) -&gt; dict:     # ...     return some_data  async def some_handler_3(     data: Union[dict, List[str]], logger: LoggerClass, request: web.Request ) -&gt; str:     # ...     return some_data<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043d\u0443\u0436\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u0432 \u0435\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0435 \u0438 \u0441\u0440\u0430\u0437\u0443 \u0431\u044b\u043b\u0438 \u0431\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<p>  <\/p>\n<h4 id=\"222-vspomogatelnyy-klass-argumentsmanager-anchor222-vspomogatelnyy-klass-argumentsmanageranchor\">2.2.2. \u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <code>ArgumentsManager<\/code> <a name=\"222-vspomogatelnyy-klass-argumentsmanager\"><\/a><\/h4>\n<p>  <\/p>\n<p>\u041f\u0440\u043e \u043d\u0443\u0436\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u043b\u0436\u043d\u0430 \u0437\u043d\u0430\u0442\u044c <code>middleware<\/code>, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0441\u043c\u043e\u0433\u043b\u0430 &quot;\u0432\u044b\u0442\u0430\u0449\u0438\u0442\u044c&quot; \u043d\u0435\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0438 &quot;\u043f\u043e\u0434\u0441\u0443\u043d\u0443\u0442\u044c&quot; \u0435\u043c\u0443 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435.<\/p>\n<p>  <\/p>\n<p>\u0417\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e, \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438 &quot;\u0432\u044b\u0434\u0430\u0447\u0443&quot; \u0442\u0430\u043a\u0438\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043a\u043b\u0430\u0441\u0441 <code>ArgumentsManager<\/code>. \u041e\u043d \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 <code>middlewares\/utils.py<\/code> (<a href=\"https:\/\/github.com\/EvgeniyBurdin\/api_service\/blob\/main\/sources\/middlewares\/utils.py\" rel=\"nofollow noopener noreferrer\">\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430<\/a>).<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0432\u044f\u0437\u0438 &quot;\u0438\u043c\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430&quot; \u2014 &quot;\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430&quot; \u0432 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043b\u043e\u0432\u0430\u0440\u044c, \u0433\u0434\u0435 \u043a\u043b\u044e\u0447\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f &quot;\u0438\u043c\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430&quot;, \u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u2014 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f &quot;\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430&quot;.<\/p>\n<p>  <\/p>\n<p>\u0417\u0432\u0443\u0447\u0438\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043e, \u043d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">@dataclass class RawDataForArgument:      request: web.Request     request_body: Any     arg_name: Optional[str] = None  class ArgumentsManager:     &quot;&quot;&quot; \u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0434\u043b\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430.          \u0421\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u043c\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0441 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0430\u0434\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0434\u043b\u044f         \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430.     &quot;&quot;&quot;      def __init__(self) -&gt; None:          self.getters: Dict[str, Callable] = {}      # \u0422\u0435\u043b\u043e json \u0437\u0430\u043f\u0440\u043e\u0441\u0430 ------------------------------------------------------      def reg_request_body(self, arg_name) -&gt; None:         &quot;&quot;&quot; \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0438\u043c\u0435\u043d\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u0442\u0435\u043b\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430.         &quot;&quot;&quot;         self.getters[arg_name] = self.get_request_body      def get_request_body(self, raw_data: RawDataForArgument):         return raw_data.request_body      # \u041a\u043b\u044e\u0447\u0438 \u0432 request --------------------------------------------------------      def reg_request_key(self, arg_name) -&gt; None:         &quot;&quot;&quot; \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0438\u043c\u0435\u043d\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 request.         &quot;&quot;&quot;         self.getters[arg_name] = self.get_request_key      def get_request_key(self, raw_data: RawDataForArgument):         return raw_data.request[raw_data.arg_name]      # \u041a\u043b\u044e\u0447\u0438 \u0432 request.app ----------------------------------------------------      def reg_app_key(self, arg_name) -&gt; None:         &quot;&quot;&quot; \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0438\u043c\u0435\u043d\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 app.         &quot;&quot;&quot;         self.getters[arg_name] = self.get_app_key      def get_app_key(self, raw_data: RawDataForArgument):         return raw_data.request.app[raw_data.arg_name]      # \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u0430 ------------------------------------------------------      def reg_match_info_key(self, arg_name) -&gt; None:         &quot;&quot;&quot; \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0438\u043c\u0435\u043d\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430.         &quot;&quot;&quot;         self.getters[arg_name] = self.get_match_info_key      def get_match_info_key(self, raw_data: RawDataForArgument):         return raw_data.request.match_info[raw_data.arg_name]      # \u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u044b...<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0438\u043c\u0435\u043d \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 <code>web.Application()<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"> # ...  app = web.Application()  arguments_manager = ArgumentsManager()  # \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0438\u043c\u0435\u043d\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f # \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0438\u0437 json-\u0442\u0435\u043b\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 arguments_manager.reg_request_body(&quot;data&quot;)  # \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0438\u043c\u0435\u043d\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f # \u043e\u0434\u043d\u043e\u0438\u043c\u0435\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u0437 \u0441\u043b\u043e\u0432\u0430\u0440\u044f request.match_info arguments_manager.reg_match_info_key(&quot;info_id&quot;)  # \u0412 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 # (\u043a\u043b\u0430\u0441\u0441 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 &quot;\u0432\u0437\u044f\u0442 \u0441 \u043f\u043e\u0442\u043e\u043b\u043a\u0430&quot; \u0438 \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430) app[&quot;storage&quot;] = SomeStorageClass(login=&quot;user&quot;, password=&quot;123&quot;) # \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0438\u043c\u0435\u043d\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f # \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 arguments_manager.reg_app_key(&quot;storage&quot;)  # ...<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <code>ArgumentsManager<\/code> \u0445\u0440\u0430\u043d\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432. \u041e\u043d \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f <code>middleware<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">... service_handler = KwargsHandler(arguments_manager=arguments_manager) app.middlewares.append(service_handler.middleware) ...<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439. \u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043d\u0435\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u043e\u0434\u043d\u043e\u0433\u043e \u0432\u0438\u0434\u0430, \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u0432 \u0438\u043c\u0435\u043d, \u0438 \u043f\u0440\u043e\u0447\u2026 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438 \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<h4 id=\"223-klass-kwargshandler-dlya-middleware-anchor223-klass-kwargshandler-dlya-middlewareanchor\">2.2.3. \u041a\u043b\u0430\u0441\u0441 <code>KwargsHandler<\/code> \u0434\u043b\u044f middleware <a name=\"223-klass-kwargshandler-dlya-middleware\"><\/a><\/h4>\n<p>  <\/p>\n<p>\u041a\u043b\u0430\u0441\u0441 <code>KwargsHandler<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u043e\u043c <code>SimpleHandler<\/code> \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442 \u0435\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044e <a href=\"#221-obyavlenie-obrabotchika\">\u043f.2.2.1<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434 \u2014 <code>run_handler<\/code>, \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0449\u0435 \u0434\u0432\u0430 \u2014 <code>make_handler_kwargs<\/code> \u0438 <code>build_error_message_for_invalid_handler_argument<\/code> (<a href=\"https:\/\/github.com\/EvgeniyBurdin\/api_service\/blob\/main\/sources\/middlewares\/kwargs_handler.py\" rel=\"nofollow noopener noreferrer\">\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430<\/a>).<\/p>\n<p>  <\/p>\n<h5 id=\"2231-metod-zapuska-obrabotchika-anchor2231-metod-zapuska-obrabotchikaanchor\">2.2.3.1. \u041c\u0435\u0442\u043e\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 <a name=\"2231-metod-zapuska-obrabotchika\"><\/a><\/h5>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">    async def run_handler(         self, request: web.Request, handler: Callable, request_body: Any     ) -&gt; Any:         &quot;&quot;&quot; \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b.              (\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c, \u0435\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f             \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\/\u043e\u0442\u0432\u0435\u0442\u0430\/\u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439)         &quot;&quot;&quot;         kwargs = self.make_handler_kwargs(request, handler, request_body)          return await handler(**kwargs)<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0442\u0435\u043f\u0435\u0440\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u0445 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435 \u0432\u0430\u0436\u0435\u043d \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0435. \u041d\u043e \u0441\u0442\u0430\u043b\u0438 \u0432\u0430\u0436\u043d\u044b \u0441\u0430\u043c\u0438 \u0438\u043c\u0435\u043d\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<h5 id=\"2232-metod-formirovaniya-slovarya-s-imenami-argumentov-i-ih-znacheniyami-anchor2232-metod-formirovaniya-slovarya-s-imenami-argumentov-i-ih-znacheniyamianchor\">2.2.3.2. \u041c\u0435\u0442\u043e\u0434 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0441 \u0438\u043c\u0435\u043d\u0430\u043c\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 <a name=\"2232-metod-formirovaniya-slovarya-s-imenami-argumentov-i-ih-znacheniyami\"><\/a><\/h5>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>make_handler_kwargs<\/code> \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0432 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043a\u043b\u0430\u0441\u0441. \u041e\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0441 \u0438\u043c\u0435\u043d\u0430\u043c\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430. \u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0443\u0436\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 <code>ArgumentsManager<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u0432 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043c\u0435\u043d\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 <code>ArgumentsManager<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u0443 \u044d\u0442\u043e\u0433\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e, \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0441 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c <code>web.Request<\/code> \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0432 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 <strong>\u043b\u044e\u0431\u043e\u0435 \u0438\u043c\u044f<\/strong>, \u043d\u043e \u043e\u043d \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e <strong>\u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e \u0442\u0438\u043f\u043e\u043c <code>web.Request<\/code><\/strong> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>r: web.Request<\/code> \u0438\u043b\u0438 <code>req: web.Request<\/code> \u0438\u043b\u0438 <code>request: web.Request<\/code>). \u0422\u043e \u0435\u0441\u0442\u044c, \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <code>web.Request<\/code> &quot;\u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d&quot; \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0432 \u043b\u044e\u0431\u043e\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0435.<\/p>\n<p>  <\/p>\n<p>\u0418 \u0435\u0449\u0435 \u043e\u0434\u043d\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0432\u0441\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e.<\/p>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>build_error_message_for_invalid_handler_argument<\/code> \u2014 \u043f\u0440\u043e\u0441\u0442\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435. \u041e\u043d \u0441\u043e\u0437\u0434\u0430\u043d \u0434\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0430 \u0441\u0432\u043e\u0439 \u0432\u043a\u0443\u0441.<\/p>\n<p>  <\/p>\n<h4 id=\"224-primery-anchor224-primeryanchor\">2.2.4. \u041f\u0440\u0438\u043c\u0435\u0440\u044b <a name=\"224-primery\"><\/a><\/h4>\n<p>  <\/p>\n<p>\u0421\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0442\u0430\u043a\u0438\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">async def create(     data: Union[dict, List[dict]], storage: dict, ) -&gt; Union[dict, List[dict]]:     # ...  async def read(storage: dict, data: str) -&gt; dict:     # ...  async def info(info_id: int, request: web.Request) -&gt; str:     # ...<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0430 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u044e\u0442 <code>POST<\/code> \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u2014 <code>GET<\/code> (\u043f\u0440\u043e\u0441\u0442\u043e, \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430)<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0442\u0435\u043a\u0441\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432&#8230;<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<h5 id=\"2241-metod-create\">2.2.4.1. \u041c\u0435\u0442\u043e\u0434 \/create<\/h5>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">[     {         &quot;name&quot;: &quot;Ivan&quot;     },     {         &quot;name&quot;: &quot;Oleg&quot;     } ]<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u0432\u0435\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">[     {         &quot;id&quot;: &quot;5730bab1-9c1b-4b01-9979-9ad640ea5fc1&quot;,         &quot;name&quot;: &quot;Ivan&quot;     },     {         &quot;id&quot;: &quot;976d821a-e871-41b4-b5a2-2875795d6166&quot;,         &quot;name&quot;: &quot;Oleg&quot;     } ]<\/code><\/pre>\n<p>  <\/p>\n<h5 id=\"2242-metod-read\">2.2.4.2. \u041c\u0435\u0442\u043e\u0434 \/read<\/h5>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">&quot;5730bab1-9c1b-4b01-9979-9ad640ea5fc1&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u0432\u0435\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;id&quot;: &quot;5730bab1-9c1b-4b01-9979-9ad640ea5fc1&quot;,     &quot;name&quot;: &quot;Ivan&quot; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043e\u0434\u043d\u0438\u043c \u0438\u0437 <code>UUID<\/code> \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0438\u043d\u0430\u0447\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 <code>500<\/code> \u2014 <code>PersonNotFound<\/code>.<\/p>\n<p>  <\/p>\n<h5 id=\"2243-metod-infoinfo_id\">2.2.4.3. \u041c\u0435\u0442\u043e\u0434 \/info\/{info_id}<\/h5>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 <code>GET<\/code> \u043d\u0430 <code>\/info\/123<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">&quot;any json&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u0432\u0435\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">&quot;info_id=123 and request=&lt;Request GET \/info\/123 &gt;&quot;<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h3 id=\"23-middleware-c-obolochkami-zaprosaotveta-i-validaciey-anchor23-middleware-c-obolochkami-zaprosaotveta-i-validacieyanchor\">2.3. middleware c \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\/\u043e\u0442\u0432\u0435\u0442\u0430 \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0435\u0439 <a name=\"23-middleware-c-obolochkami-zaprosaotveta-i-validaciey\"><\/a><\/h3>\n<p>  <\/p>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430, \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f api-\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0432 \u0441\u0435\u0431\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0435\u043b\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a \u043c\u0435\u0442\u043e\u0434\u0443 <code>create<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u0438\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;data&quot;: [         {             &quot;name&quot;: &quot;Ivan&quot;         },         {             &quot;name&quot;: &quot;Oleg&quot;         }     ],     &quot;id&quot;: 11 }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0430 \u043e\u0442\u0432\u0435\u0442 \u0442\u0430\u043a\u0438\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{      &quot;success&quot;: true,     &quot;result&quot;: [         {             &quot;id&quot;: &quot;9738d8b8-69da-40b2-8811-b33652f92f1d&quot;,             &quot;name&quot;: &quot;Ivan&quot;         },         {             &quot;id&quot;: &quot;df0fdd43-4adc-43cd-ac17-66534529d440&quot;,             &quot;name&quot;: &quot;Oleg&quot;         }     ],     &quot;id&quot;: 11 }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c, \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u043a\u043b\u044e\u0447\u0435 <code>data<\/code> \u0430 \u043e\u0442 \u043e\u0442\u0432\u0435\u0442\u0430 \u0432 <code>result<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0418\u043c\u0435\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447 <code>id<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u043a \u0438 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435.<\/p>\n<p>  <\/p>\n<p>\u041a\u043b\u044e\u0447 \u043e\u0442\u0432\u0435\u0442\u0430 <code>success<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u043c \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0441\u0442\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n<p>  <\/p>\n<p>\u0410 \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0441\u044f \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e, \u0442\u043e \u043e\u0442\u0432\u0435\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u0438\u043c:<\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u043a \u043c\u0435\u0442\u043e\u0434\u0443 <code>read<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;data&quot;:  &quot;ddb0f2b1-0179-44b7-b94d-eb2f3b69292d&quot;,     &quot;id&quot;: 3 }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u0432\u0435\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;success&quot;: false,     &quot;result&quot;: {         &quot;error_type&quot;: &quot;&lt;class 'handlers.PersonNotFound'&gt;&quot;,         &quot;error_message&quot;: &quot;Person whith id=ddb0f2b1-0179-44b7-b94d-eb2f3b69292d not found!&quot;     },     &quot;id&quot;: 3 }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423\u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0434\u043b\u044f json <code>middleware<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430\u043c\u0438 \u0432 \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f <code>middleware<\/code>. \u041d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>run_handler<\/code>, \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c (\u0438\u043b\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c) \u043c\u0435\u0442\u043e\u0434 <code>get_error_body<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 &quot;\u043f\u0440\u0438\u043b\u0435\u0442\u0430\u0442\u044c&quot; \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u044b (\u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0430 <code>data<\/code>). \u0418\u0437 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 (\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0430 <code>result<\/code>). \u0410 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c <code>middleware<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0436\u0435, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b &quot;\u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u043d\u0435 \u0432\u0441\u0442\u0430\u0432\u0430\u0442\u044c&quot;, \u044f \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e. \u041d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c.<\/p>\n<p>  <\/p>\n<h4 id=\"231-klass-dannyh-pydanticbasemodel-anchor231-klass-dannyh-pydanticbasemodelanchor\">2.3.1. \u041a\u043b\u0430\u0441\u0441 \u0434\u0430\u043d\u043d\u044b\u0445 <code>pydantic.BaseModel<\/code> <a name=\"231-klass-dannyh-pydanticbasemodel\"><\/a><\/h4>\n<p>  <\/p>\n<p><code>pydantic.BaseModel<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0438\u0445 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u043c (\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e). \u0415\u0441\u043b\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u043b\u0430\u0441\u044c \u2014 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<p>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from pydantic import BaseModel from typing import Union, List  class Info(BaseModel):     foo: int  class Person(BaseModel):     name: str     info: Union[Info, List[Info]]  kwargs = {&quot;name&quot;: &quot;Ivan&quot;, &quot;info&quot;: {&quot;foo&quot;: 0}} person = Person(**kwargs) assert person.info.foo == 0  kwargs = {&quot;name&quot;: &quot;Ivan&quot;, &quot;info&quot;: [{&quot;foo&quot;: 0}, {&quot;foo&quot;: 1}]} person = Person(**kwargs) assert person.info[1].foo == 1  kwargs = {&quot;name&quot;: &quot;Ivan&quot;, &quot;info&quot;: {&quot;foo&quot;: &quot;bar&quot;}}  # &lt;- \u041e\u0448\u0438\u0431\u043a\u0430, str \u043d\u0435 int person = Person(**kwargs) # \u0412\u043e\u0437\u043d\u0438\u043a\u043b\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435: # ... # pydantic.error_wrappers.ValidationError: 2 validation errors for Person # info -&gt; foo #  value is not a valid integer (type=type_error.integer) # info #  value is not a valid list (type=type_error.list)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0443\u0442 \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438, \u043f\u043e\u043b\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u043e \u0435\u0441\u0442\u044c, \u0431\u044b\u043b \u0441\u043b\u043e\u0432\u0430\u0440\u044c, \u0441\u0442\u0430\u043b \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u0445 \u043a \u043f\u043e\u043b\u044f\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043b\u0438\u0430\u0441\u044b \u0438\u0437 <code>typing<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u043a \u043f\u043e\u043b\u044e \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u043b\u0430\u0441\u0441-\u043f\u043e\u0442\u043e\u043c\u043e\u043a <code>pydantic.BaseModel<\/code>, \u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 &quot;\u043c\u0430\u043f\u043f\u044f\u0442\u0441\u044f&quot; \u0438 \u0432 \u043d\u0435\u0433\u043e (\u0438 \u0442\u0430\u043a \u0441 \u043b\u044e\u0431\u043e\u0439 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e\u2026 \u0445\u043e\u0442\u044f, \u043d\u0430 \u0441\u0447\u0435\u0442 &quot;\u043b\u044e\u0431\u043e\u0439&quot; \u2014 \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b).<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0430\u043b \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0431\u044b\u043b\u043e \u0434\u0432\u0435 \u043e\u0448\u0438\u0431\u043a\u0438: <code>info.foo<\/code> \u043d\u0435 <code>int<\/code>, \u0438 <code>info<\/code> \u043d\u0435 <code>list<\/code>, \u0447\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0438 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0441 \u043d\u0435\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 <code>pydantic.BaseModel<\/code> \u0435\u0441\u0442\u044c \u043d\u044e\u0430\u043d\u0441\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0445\u043e\u0447\u0443 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<h5 id=\"2311-strogie-tipy-anchor2311-strogie-tipyanchor\">2.3.1.1. \u0421\u0442\u0440\u043e\u0433\u0438\u0435 \u0442\u0438\u043f\u044b <a name=\"2311-strogie-tipy\"><\/a><\/h5>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043b\u044e\u0431\u043e\u043c \u0438\u0437 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0446\u0435\u043b\u043e\u0435 \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0443, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u0446\u0438\u0444\u0440\u044b, \u0442\u043e \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">kwargs = {&quot;name&quot;: &quot;Ivan&quot;, &quot;info&quot;: {&quot;foo&quot;: &quot;0&quot;}} person = Person(**kwargs) assert person.info.foo == 0<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c, \u0438\u043c\u0435\u0435\u043c \u043d\u0435\u044f\u0432\u043d\u043e\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432. \u0418 \u0442\u0430\u043a\u043e\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 <code>str-&gt;int<\/code> (\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043f\u0440\u043e \u0442\u0438\u043f\u044b <code>pydantic<\/code> \u0441\u043c. \u0432 <a href=\"https:\/\/pydantic-docs.helpmanual.io\/usage\/types\/\" rel=\"nofollow noopener noreferrer\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>).<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432, \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445, \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>\u0441\u0442\u0440\u043e\u043a\u0430 \u0441 UUID<\/code> -&gt; <code>UUID<\/code>. \u041d\u043e, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e, \u0442\u043e \u0432 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u0445 \u043d\u0430\u0434\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0438\u043f\u044b, \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441\u043e <code>Strict...<\/code>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>pydantic.StrictInt<\/code>, <code>pydantic.StrictStr<\/code>, \u0438 \u0442.\u043f&#8230;<\/p>\n<p>  <\/p>\n<h5 id=\"2312-strogaya-signatura-pri-sozdanii-ekzemplyara-anchor2312-strogaya-signatura-pri-sozdanii-ekzemplyaraanchor\">2.3.1.2. \u0421\u0442\u0440\u043e\u0433\u0430\u044f \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 <a name=\"2312-strogaya-signatura-pri-sozdanii-ekzemplyara\"><\/a><\/h5>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438, \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">kwargs = {&quot;name&quot;: &quot;Ivan&quot;, &quot;info&quot;: {&quot;foo&quot;: 0}, &quot;bar&quot;: &quot;BAR&quot;} person = Person(**kwargs)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0442\u0435\u043c, \u0447\u0442\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u0448\u044c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0441\u0442\u0440\u043e\u0433\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from pydantic import BaseModel, Extra, StrictInt, StrictStr from typing import Union, List  class BaseApi(BaseModel):     class Config:         # \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043b\u0438 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c (ignore), \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0442\u044c (allow) \u0438\u043b\u0438         # \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0442\u044c (forbid) \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438         # \u043c\u043e\u0434\u0435\u043b\u0438, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435:         # https:\/\/pydantic-docs.helpmanual.io\/usage\/model_config\/         extra = Extra.forbid  class Info(BaseApi):     foo: StrictInt  class Person(BaseApi):     name: StrictStr     info: Union[Info, List[Info]]  kwargs = {&quot;name&quot;: &quot;Ivan&quot;, &quot;info&quot;: {&quot;foo&quot;: 0}, &quot;bar&quot;: &quot;BAR&quot;} person = Person(**kwargs) # ... # pydantic.error_wrappers.ValidationError: 1 validation error for Person # bar #   extra fields not permitted (type=value_error.extra)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u2014 \u0432\u0441\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u043b\u0430\u0441\u044c.<\/p>\n<p>  <\/p>\n<h4 id=\"232-dekorator-valdecvalidate-anchor232-dekorator-valdecvalidateanchor\">2.3.2. \u0414\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 <code>valdec.validate<\/code> <a name=\"232-dekorator-valdecvalidate\"><\/a><\/h4>\n<p>  <\/p>\n<p>\u0414\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 <a href=\"https:\/\/github.com\/EvgeniyBurdin\/valdec\" rel=\"nofollow noopener noreferrer\">valdec.validate<\/a> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438\/\u0438\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434\u0430.<\/p>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0443\u043a\u0430\u0437\u0430\u043d\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u043d\u0435\u0442 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438, \u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u0435\u0440\u043d\u0443\u0442\u044c <code>None<\/code> (\u0438\u043c\u0435\u0435\u0442 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>-&gt; None:<\/code>).<\/p>\n<p>  <\/p>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 \u043a\u0430\u043a \u0434\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439\/\u043c\u0435\u0442\u043e\u0434\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from valdec.decorators import validate  @validate  # \u0412\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0441 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u043c\u0438, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 def foo(i: int, s: str) -&gt; int:     return i  @validate(&quot;i&quot;, &quot;s&quot;)  # \u0412\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e &quot;i&quot; \u0438 &quot;s&quot; def bar(i: int, s: str) -&gt; int:     return i<\/code><\/pre>\n<p>  <\/p>\n<p>\u2026 \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 from valdec.decorators import async_validate as validate  @validate(&quot;s&quot;, &quot;return&quot;, exclude=True)  # \u0412\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e &quot;i&quot; async def foo(i: int, s: str) -&gt; int:     return int(i)  @validate(&quot;return&quot;)  # \u0412\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0442 async def bar(i: int, s: str) -&gt; int:     return int(i)<\/code><\/pre>\n<p>  <\/p>\n<h5 id=\"2321-funkcii-validatory-anchor2321-funkcii-validatoryanchor\">2.3.2.1. \u0424\u0443\u043d\u043a\u0446\u0438\u0438-\u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u044b <a name=\"2321-funkcii-validatory\"><\/a><\/h5>\n<p>  <\/p>\n<p>\u0414\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0445\/\u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0438\u0445 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 (\u044d\u0442\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e, \u043d\u043e \u043f\u043e \u0441\u0443\u0442\u0438 \u0442\u0430\u043a), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442, \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e.<\/p>\n<p>  <\/p>\n<p>\u0421\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438-\u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def validator(     annotations: Dict[str, Any],     values: Dict[str, Any],     is_replace: bool,     extra: dict ) -&gt; Optional[Dict[str, Any]]:<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li><code>annotations<\/code> \u2014 \u0421\u043b\u043e\u0432\u0430\u0440\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043c\u0435\u043d\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0438\u0445 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438.<\/li>\n<li><code>values<\/code> \u2014 \u0421\u043b\u043e\u0432\u0430\u0440\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043c\u0435\u043d\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/li>\n<li><code>is_replace<\/code> \u2014 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0435\u043c, \u0447\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f-\u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043e\u0442\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043d\u0435\u0442.<br \/> \n<ul>\n<li>\u0415\u0441\u043b\u0438 <code>True<\/code>, \u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441 \u0438\u043c\u0435\u043d\u0430\u043c\u0438 \u043e\u0442\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 <strong>\u043f\u043e\u0441\u043b\u0435 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438<\/strong>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0443 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0431\u044b\u043b\u0430 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f \u0441 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u043e\u043c <code>BaseModel<\/code> \u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044f, \u0442\u043e \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043c\u0435\u043d\u0435\u043d\u044b \u043d\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <code>BaseModel<\/code>, \u0438 \u0432 \u0434\u0435\u043a\u043e\u0440\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a \u043d\u0438\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f &quot;\u0447\u0435\u0440\u0435\u0437 \u0442\u043e\u0447\u043a\u0443&quot;.<\/li>\n<li>\u0415\u0441\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0440\u0430\u0432\u0435\u043d <code>False<\/code>, \u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0435\u0440\u043d\u0435\u0442 <code>None<\/code>, \u0430 \u0434\u0435\u043a\u043e\u0440\u0438\u0440\u0443\u0435\u043c\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 (\u0442\u043e \u0435\u0441\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0442\u0430\u043a \u0438 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u043c, \u0430 \u043d\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c <code>BaseModel<\/code>).<\/li>\n<\/ul>\n<\/li>\n<li><code>extra<\/code> \u2014 \u0421\u043b\u043e\u0432\u0430\u0440\u044c \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0432 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u0435 <code>validate<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/github.com\/EvgeniyBurdin\/valdec\/blob\/main\/valdec\/validator_pydantic.py\" rel=\"nofollow noopener noreferrer\"><code>\u0444\u0443\u043d\u043a\u0446\u0438\u044f-\u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 pydantic.BaseModel<\/code><\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043d\u0435\u0439 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u0441 \u0438\u043c\u0435\u043d\u0430\u043c\u0438 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0438\u0445 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043f\u043e\u0442\u043e\u043c\u043e\u043a <code>pydantic.BaseModel<\/code>)<\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441 \u0438\u043c\u0435\u043d\u0430\u043c\u0438 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438. \u0412 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f.<\/li>\n<li>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u0441\u043b\u0435 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0436\u0435 \u0431\u0443\u0434\u0443 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430), \u0438\u043b\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442, \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 <code>is_replace<\/code>.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0437, \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e, \u0434\u043b\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0447\u0442\u043e \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u0432 \u043f\u0435\u0440\u0432\u043e\u043c, \u0442\u0430\u043a \u0438 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435.<\/p>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f-\u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043b\u044e\u0431\u043e\u0433\u043e \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 (\u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u0430\u0440\u0438\u0438 <code>valdec<\/code> \u0435\u0441\u0442\u044c <a href=\"https:\/\/github.com\/EvgeniyBurdin\/valdec\/blob\/main\/valdec\/validator_validated_dc.py\" rel=\"nofollow noopener noreferrer\"><code>\u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 ValidatedDC<\/code><\/a>). \u041d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0447\u0435\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435: \u0434\u0430\u043b\u0435\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435, \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432 <code>pydantic.BaseModel<\/code> \u0432 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u0440\u0438 \u0434\u0440\u0443\u0433\u043e\u043c \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u044e\u0449\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0435, \u0432 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432 \u044d\u0442\u043e\u0433\u043e &quot;\u0434\u0440\u0443\u0433\u043e\u0433\u043e&quot; \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<p>  <\/p>\n<h5 id=\"2322-nastroyka-dekoratora-anchor2322-nastroyka-dekoratoraanchor\">2.3.2.2. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u0430 <a name=\"2322-nastroyka-dekoratora\"><\/a><\/h5>\n<p>  <\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 &quot;\u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0435\u0442&quot; \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from typing import List, Optional  from pydantic import BaseModel, StrictInt, StrictStr from valdec.decorators import validate  class Profile(BaseModel):     age: StrictInt     city: StrictStr  class Student(BaseModel):     name: StrictStr     profile: Profile  @validate(&quot;group&quot;) def func(group: Optional[List[Student]] = None):     for student in group:         assert isinstance(student, Student)         assert isinstance(student.name, str)         assert isinstance(student.profile.age, int)  data = [     {&quot;name&quot;: &quot;Peter&quot;, &quot;profile&quot;: {&quot;age&quot;: 22, &quot;city&quot;: &quot;Samara&quot;}},     {&quot;name&quot;: &quot;Elena&quot;, &quot;profile&quot;: {&quot;age&quot;: 20, &quot;city&quot;: &quot;Kazan&quot;}}, ]  func(data)<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 <code>assert'\u044b<\/code>.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0434\u043b\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">@validate  # \u0412\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0451 def func(group: Optional[List[Student]] = None, i: int) -&gt; List[Student]:     #...     return [         {&quot;name&quot;: &quot;Peter&quot;, &quot;profile&quot;: {&quot;age&quot;: 22, &quot;city&quot;: &quot;Samara&quot;}},         {&quot;name&quot;: &quot;Elena&quot;, &quot;profile&quot;: {&quot;age&quot;: 20, &quot;city&quot;: &quot;Kazan&quot;}},     ]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0432 <code>return<\/code> \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043d \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439, \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0435\u0440\u043d\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 <code>Student<\/code> (\u043f\u043e\u0434\u043c\u0435\u043d\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440).<\/p>\n<p>  <\/p>\n<p>\u041d\u043e\u2026 \u041d\u0430\u043c \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0430\u0434\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u0418\u043d\u043e\u0433\u0434\u0430, \u0431\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u043e\u0442\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0442\u044c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0440\u0435\u0447\u044c \u043e \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e\u0431\u044b \u0441\u0440\u0430\u0437\u0443 \u043e\u0442\u0434\u0430\u0442\u044c \u0438\u0445 \u0432 \u0411\u0414). \u0418 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u0438\u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from valdec.data_classes import Settings from valdec.decorators import validate as _validate from valdec.validator_pydantic import validator  custom_settings = Settings(     validator=validator,     # \u0424\u0443\u043d\u043a\u0446\u0438\u044f-\u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440.     is_replace_args=False,   # \u0414\u0435\u043b\u0430\u0442\u044c \u043b\u0438 \u043f\u043e\u0434\u043c\u0435\u043d\u0443 \u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0445     is_replace_result=False, # \u0414\u0435\u043b\u0430\u0442\u044c \u043b\u0438 \u043f\u043e\u0434\u043c\u0435\u043d\u0443 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435     extra={}                 # \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442                              # \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 ) # \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 def validate_without_replacement(*args, **kwargs):     kwargs[&quot;settings&quot;] = custom_settings     return _validate(*args, **kwargs)  # \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c @validate_without_replacement def func(group: Optional[List[Student]] = None, i: int) -&gt; List[Student]:     #...     return [         {&quot;name&quot;: &quot;Peter&quot;, &quot;profile&quot;: {&quot;age&quot;: 22, &quot;city&quot;: &quot;Samara&quot;}},         {&quot;name&quot;: &quot;Elena&quot;, &quot;profile&quot;: {&quot;age&quot;: 20, &quot;city&quot;: &quot;Kazan&quot;}},     ]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0442\u0435\u043f\u0435\u0440\u044c <code>func<\/code> \u0432\u0435\u0440\u043d\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439, \u0442\u0430\u043a \u043a\u0430\u043a <code>is_replace_result=False<\/code>. \u0418 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0442\u043e\u0436\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439, \u0442\u0430\u043a \u043a\u0430\u043a <code>is_replace_args=False<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u0441\u0430\u043c\u0430 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u0438 \u0440\u0430\u043d\u044c\u0448\u0435, \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043b\u0438\u0448\u044c \u043f\u043e\u0434\u043c\u0435\u043d\u044b.<\/p>\n<p>  <\/p>\n<p><em>\u0415\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u043d\u044e\u0430\u043d\u0441 \u2014 \u043b\u0438\u043d\u0442\u0435\u0440, \u0438\u043d\u043e\u0433\u0434\u0430, \u043c\u043e\u0436\u0435\u0442 &quot;\u0440\u0443\u0433\u0430\u0442\u044c\u0441\u044f&quot; \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u0432 \u0442\u0438\u043f\u0430\u0445. \u0414\u0430, \u044d\u0442\u043e \u043c\u0438\u043d\u0443\u0441. \u041d\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u043b\u0443\u0447\u0448\u0435 \u0438\u043c\u0435\u0442\u044c \u0432\u044b\u0431\u043e\u0440, \u0447\u0435\u043c \u0435\u0433\u043e \u043d\u0435 \u0438\u043c\u0435\u0442\u044c.<\/em><\/p>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441 \u2014 \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 \u043f\u043e\u043b\u0443\u0447\u0438\u0442, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043d\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044c, \u0430 \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430? \u041e\u0442\u0432\u0435\u0442 \u2014 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0442\u0438\u043f\u0443.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f-\u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440, \u0438 \u0435\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u2014 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0435\u0435 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c.<\/p>\n<p>  <\/p>\n<h5 id=\"2323-esche-raz-pro-privedenie-tipov-anchor2323-esche-raz-pro-privedenie-tipovanchor\">2.3.2.3. \u0415\u0449\u0435 \u0440\u0430\u0437 \u043f\u0440\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 <a name=\"2323-esche-raz-pro-privedenie-tipov\"><\/a><\/h5>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from valdec.decorators import validate  @validate def foo(i: int):     assert isinstance(i, int)  foo(&quot;1&quot;)<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0443. \u041d\u043e \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0448\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0438 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u043b\u043e \u0446\u0435\u043b\u043e\u0435.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0432 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u0435 <code>validate<\/code>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f-\u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 <code>pydantic.BaseModel<\/code>. \u0412 <a href=\"#2311-strogie-tipy\">\u043f.2.3.1.1.<\/a> \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u0440\u0430\u0437 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e \u043d\u0435\u044f\u0432\u043d\u043e\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u0432 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 (\u043e\u0448\u0438\u0431\u043a\u0443 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438), \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from valdec.decorators import validate from pydantic import StrictInt  @validate def foo(i: StrictInt):     pass  foo(&quot;1&quot;) # ... # valdec.errors.ValidationArgumentsError: Validation error # &lt;class 'valdec.errors.ValidationError'&gt;: 1 validation error for # argument with the name of: # i #  value is not a valid integer (type=type_error.integer).<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u0412\u044b\u0432\u043e\u0434 \u0442\u0430\u043a\u043e\u0439:<\/strong> \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430\u0434\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<p>  <\/p>\n<p>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e \u044d\u0442\u043e.<\/p>\n<p>  <\/p>\n<h5 id=\"2324-isklyucheniya-anchor2324-isklyucheniyaanchor\">2.3.2.4. \u0418\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f <a name=\"2324-isklyucheniya\"><\/a><\/h5>\n<p>  <\/p>\n<ul>\n<li><code>valdec.errors.ValidationArgumentsError<\/code> \u2014 &quot;\u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f&quot; \u0435\u0441\u043b\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0442\u0435\u0440\u043f\u0435\u043b\u0430 \u043d\u0435\u0443\u0434\u0430\u0447\u0443<\/li>\n<li><code>valdec.errors.ValidationReturnError<\/code> \u2014 \u0435\u0441\u043b\u0438 \u043d\u0435 \u043f\u0440\u043e\u0448\u0435\u043b \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u0432\u043e\u0437\u0432\u0440\u0430\u0442<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0421\u0430\u043c\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0438 \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0438\u0437 \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044d\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u043e\u0442 <code>pydantic.BaseModel<\/code>.<\/p>\n<p>  <\/p>\n<h4 id=\"233-bazovyy-klass-dannyh-anchor233-bazovyy-klass-dannyhanchor\">2.3.3. \u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u0430\u043d\u043d\u044b\u0445 <a name=\"233-bazovyy-klass-dannyh\"><\/a><\/h4>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b, \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u044b-\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0438 \u043e\u0442 <code>pydantic.BaseModel<\/code>.<\/p>\n<p>  <\/p>\n<p>C\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<p>  <\/p>\n<p><code>data_classes\/base.py<\/code><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from pydantic import BaseModel, Extra  class BaseApi(BaseModel):     &quot;&quot;&quot; \u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f api.     &quot;&quot;&quot;     class Config:         extra = Extra.forbid<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"234-obyavlenie-obrabotchika-anchor234-obyavlenie-obrabotchikaanchor\">2.3.4. \u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 <a name=\"234-obyavlenie-obrabotchika\"><\/a><\/h4>\n<p>  <\/p>\n<p>\u041a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f middleware, \u043d\u0430\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0441\u0435\u0439\u0447\u0430\u0441 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c, \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from typing import List, Union from valdec.decorators import async_validate as validate from data_classes.person import PersonCreate, PersonInfo  @validate(&quot;data&quot;, &quot;return&quot;) async def create(     data: Union[PersonCreate, List[PersonCreate]], storage: dict, ) -&gt; Union[PersonInfo, List[PersonInfo]]:     # ...     return result<\/code><\/pre>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u043e\u0441\u044c (\u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438 \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u044b\u0445 \u0433\u043b\u0430\u0432):<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 <code>validate<\/code> \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0432\u0448\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043e\u0442\u0432\u0435\u0442, \u0438 &quot;\u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0435\u0442&quot; \u0438\u0445 \u043d\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432<\/li>\n<li>\u0432 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u0445 \u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0443\u0436\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u0440\u043e \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432\/\u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442, \u0435\u043c\u0443 \u044d\u0442\u043e \u0438 \u043d\u0435 \u043d\u0430\u0434\u043e.<\/p>\n<p>  <\/p>\n<p><em>\u041f\u043e\u0437\u0432\u043e\u043b\u044e \u0441\u0435\u0431\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0440\u0435\u043c\u0430\u0440\u043a\u0443: \u0435\u0441\u043b\u0438 \u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0445 \u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043d\u0435\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 <code>web.Request()<\/code>, \u0442\u043e \u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <strong>\u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e<\/strong> \u0432 <code>wep.Aplication()<\/code>. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u043d \u0442\u0430\u043c \u0435\u0441\u0442\u044c, \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u0435\u0441\u043b\u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0439 \u0441 <code>web.Request()<\/code> \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0434\u0430\u043d\u043d\u044b\u0445.<\/em><\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043a\u043b\u0430\u0441\u0441\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u0438\u043c\u0438:<\/p>\n<p>  <\/p>\n<p><code>data_classes\/person.py<\/code><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from uuid import UUID from pydantic import Field, StrictStr from data_classes.base import BaseApi  class PersonCreate(BaseApi):     &quot;&quot;&quot; \u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0441\u043e\u043d\u044b.     &quot;&quot;&quot;     name: StrictStr = Field(description=&quot;\u0418\u043c\u044f.&quot;, example=&quot;Oleg&quot;)  class PersonInfo(BaseApi):     &quot;&quot;&quot; \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043f\u0435\u0440\u0441\u043e\u043d\u0435.     &quot;&quot;&quot;     id: UUID = Field(description=&quot;\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440.&quot;)     name: StrictStr = Field(description=&quot;\u0418\u043c\u044f.&quot;)<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"235-klassy-dannyh-dlya-obolochek-anchor235-klassy-dannyh-dlya-obolochekanchor\">2.3.5. \u041a\u043b\u0430\u0441\u0441\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043e\u0431\u043e\u043b\u043e\u0447\u0435\u043a <a name=\"235-klassy-dannyh-dlya-obolochek\"><\/a><\/h4>\n<p>  <\/p>\n<p>\u0412 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 <a href=\"#23-middleware-c-obolochkami-zaprosaotveta-i-validaciey\">\u043f.2.3.<\/a> \u0431\u044b\u043b\u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0442\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043e\u0442\u0432\u0435\u0442\u0430.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0438\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<p><code>data_classes\/wraps.py<\/code><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from typing import Any, Optional from pydantic import Field, StrictInt from data_classes.base import BaseApi  _ID_DESCRIPTION = &quot;\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0443.&quot;  class WrapRequest(BaseApi):     &quot;&quot;&quot; \u0417\u0430\u043f\u0440\u043e\u0441.     &quot;&quot;&quot;     data: Any = Field(description=&quot;\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u0430.&quot;, default=None)     id: Optional[StrictInt] = Field(description=_ID_DESCRIPTION)  class WrapResponse(BaseApi):     &quot;&quot;&quot; \u041e\u0442\u0432\u0435\u0442.     &quot;&quot;&quot;     success: bool = Field(description=&quot;\u0421\u0442\u0430\u0442\u0443\u0441 \u043e\u0442\u0432\u0435\u0442\u0430.&quot;, default=True)     result: Any = Field(description=&quot;\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0442\u0432\u0435\u0442\u0430.&quot;)     id: Optional[StrictInt] = Field(description=_ID_DESCRIPTION)<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u0438 \u043a\u043b\u0430\u0441\u0441\u044b \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u0434\u043b\u044f <code>middleware<\/code> \u043f\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043b\u043e\u0433\u0438\u043a\u0438 \u043e\u0431\u043e\u043b\u043e\u0447\u0435\u043a.<\/p>\n<p>  <\/p>\n<h4 id=\"236-klass-wrapskwargshandler-dlya-middleware-anchor236-klass-wrapskwargshandler-dlya-middlewareanchor\">2.3.6. \u041a\u043b\u0430\u0441\u0441 <code>WrapsKwargsHandler<\/code> \u0434\u043b\u044f middleware <a name=\"236-klass-wrapskwargshandler-dlya-middleware\"><\/a><\/h4>\n<p>  <\/p>\n<p>\u041a\u043b\u0430\u0441\u0441 <code>WrapsKwargsHandler<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u043e\u043c <code>KwargsHandler<\/code> \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442 \u0435\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0442\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0438 \u0438\u0445 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e (<a href=\"https:\/\/github.com\/EvgeniyBurdin\/api_service\/blob\/main\/sources\/middlewares\/wraps_handler.py\" rel=\"nofollow noopener noreferrer\">\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430<\/a>).<\/p>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u2014 <code>run_handler<\/code> \u0438 <code>get_error_body<\/code>.<\/p>\n<p>  <\/p>\n<h5 id=\"2361-metod-zapuska-obrabotchika-anchor2361-metod-zapuska-obrabotchikaanchor\">2.3.6.1. \u041c\u0435\u0442\u043e\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 <a name=\"2361-metod-zapuska-obrabotchika\"><\/a><\/h5>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">async def run_handler(         self, request: web.Request, handler: Callable, request_body: Any     ) -&gt; dict:          id_ = None          try:             # \u041f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430             wrap_request = WrapRequest(**request_body)          except Exception as error:             message = f&quot;{type(error).__name__} - {error}&quot;             raise InputDataValidationError(message)          # \u0417\u0430\u043f\u043e\u043c\u043d\u0438\u043c \u043f\u043e\u043b\u0435 id \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u043e\u0432         id_ = wrap_request.id         request[KEY_NAME_FOR_ID] = id_          try:             result = await super().run_handler(                 request, handler, wrap_request.data             )         except ValidationArgumentsError as error:             message = f&quot;{type(error).__name__} - {error}&quot;             raise InputDataValidationError(message)          # \u041f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 \u043e\u0442\u0432\u0435\u0442\u0430         wrap_response = WrapResponse(success=True, result=result, id=id_)          return wrap_response.dict()<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0418\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <code>InputDataValidationError<\/code> \u043f\u043e\u0434\u043d\u0438\u043c\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0435\u0441\u043b\u0438 \u0432 \u0442\u0435\u043b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044c (\u043f\u0443\u0441\u0442\u044c \u0434\u0430\u0436\u0435 \u043f\u0443\u0441\u0442\u043e\u0439)<\/li>\n<li>\u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u044f \u0441 \u043a\u043b\u044e\u0447\u0430\u043c\u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043e\u0442 <code>data<\/code> \u0438 <code>id<\/code><\/li>\n<li>\u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043a\u043b\u044e\u0447 <code>id<\/code> \u043d\u043e \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 <code>StrictInt<\/code> \u0438 \u043d\u0435 <code>None<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043d\u0435\u0442 \u043a\u043b\u044e\u0447\u0430 <code>id<\/code>, \u0442\u043e <code>wrap_request.id<\/code> \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>None<\/code>. \u041a\u043b\u044e\u0447 <code>data<\/code> \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438 \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. \u0422\u0430\u043a \u0436\u0435, \u0435\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0431\u044b\u0442\u044c \u0432\u043e \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u043e\u0433\u0434\u0430 <code>wrap_request.data<\/code> \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>None<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c <code>wrap_request.id<\/code> \u0432 <code>request<\/code>. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 (\u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442).<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u043d\u043e \u0434\u043b\u044f \u0435\u0433\u043e \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e <code>wrap_request.data<\/code> (\u043d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u0432\u043e <code>wrap_request.data<\/code> \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u0431\u044a\u0435\u043a\u0442 python \u0432 \u0442\u043e\u043c \u0432\u0438\u0434\u0435, \u043a\u0430\u043a \u043e\u043d \u0431\u044b\u043b \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u0438\u0437 json). \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <code>InputDataValidationError<\/code> \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <code>valdec.errors.ValidationArgumentsError<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u0438 \u0431\u044b\u043b \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b, \u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 \u043e\u0442\u0432\u0435\u0442\u0430 <code>WrapResponse<\/code> \u0432 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u0434\u043b\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430.<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u043d\u043e \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u0430\u043a\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0431\u0435\u0437 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f <code>wrap_response<\/code>, \u0430 \u0441\u0440\u0430\u0437\u0443 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u044c (\u043a\u0430\u043a \u044d\u0442\u043e \u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439). \u041d\u043e, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u043c\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u043c \u0447\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 \u043e\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439, \u0442\u0430\u043a \u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 <code>BaseApi<\/code>. \u0410 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u0430 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u043e\u0442\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442, \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0434\u043b\u044f \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 json. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u043c\u044b &quot;\u0437\u0430\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c&quot; \u043b\u044e\u0431\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u043e\u043c \u0432\u043e <code>WrapResponse.result<\/code> \u0438 \u0443\u0436\u0435 \u0438\u0437 <code>wrap_response<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 <code>wrap_response.dict()<\/code> (<a href=\"https:\/\/pydantic-docs.helpmanual.io\/usage\/exporting_models\/#modeldict\" rel=\"nofollow noopener noreferrer\">\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a>).<\/p>\n<p>  <\/p>\n<h5 id=\"2362-metod-dlya-polucheniya-dannyh-otveta-s-oshibkoy-anchor2362-metod-dlya-polucheniya-dannyh-otveta-s-oshibkoyanchor\">2.3.6.2. \u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u0430 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 <a name=\"2362-metod-dlya-polucheniya-dannyh-otveta-s-oshibkoy\"><\/a><\/h5>\n<p>  <\/p>\n<p>\u0417\u0430\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">def get_error_body(self, request: web.Request, error: Exception) -&gt; dict:         &quot;&quot;&quot; \u0424\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0438 \u043e\u0442\u0434\u0430\u0435\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441 \u0442\u0435\u043b\u043e\u043c \u043e\u0442\u0432\u0435\u0442\u0430 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439.         &quot;&quot;&quot;         result = dict(error_type=str(type(error)), error_message=str(error))         # \u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u043a\u0430\u043a\u0430\u044f \u0443 \u043d\u0430\u0441 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430 \u043e\u0442\u0432\u0435\u0442\u0430, \u0441\u0440\u0430\u0437\u0443 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0441\u043b\u043e\u0432\u0430\u0440\u044c         # \u0441 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0439 &quot;\u0441\u0445\u0435\u043c\u043e\u0439&quot;         response = dict(             # \u0414\u043b\u044f \u043f\u043e\u043b\u044f id \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0435 \u0432 request \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.             success=False, result=result, id=request.get(KEY_NAME_FOR_ID)         )         return response<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 (\u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>super()<\/code> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f <code>result<\/code>), \u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u044f \u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0442\u0430\u043a. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u0430\u043a \u0441\u043e\u0447\u0442\u0435\u0442\u0435 \u043d\u0443\u0436\u043d\u044b\u043c.<\/p>\n<p>  <\/p>\n<h4 id=\"237-primery-anchor237-primeryanchor\">2.3.7. \u041f\u0440\u0438\u043c\u0435\u0440\u044b <a name=\"237-primery\"><\/a><\/h4>\n<p>  <\/p>\n<p>\u0421\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0442\u0430\u043a\u0438\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"> @validate(&quot;data&quot;, &quot;return&quot;) async def create(     data: Union[PersonCreate, List[PersonCreate]], storage: dict, ) -&gt; Union[PersonInfo, List[PersonInfo]]:     # ...  @validate(&quot;data&quot;, &quot;return&quot;) async def read(storage: dict, req: web.Request, data: UUID) -&gt; PersonInfo:     # ...  @validate(&quot;info_id&quot;) async def info(info_id: int, request: web.Request) -&gt; Any:     return f&quot;info_id={info_id} and request={request}&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0430 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u044e\u0442 POST \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u2014 GET (\u043f\u0440\u043e\u0441\u0442\u043e, \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430)<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u0442\u0435\u043a\u0441\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432&#8230;<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<h5 id=\"2371-metod-create\">2.3.7.1. \u041c\u0435\u0442\u043e\u0434 \/create<\/h5>\n<p>  <\/p>\n<ul>\n<li>\u0417\u0430\u043f\u0440\u043e\u0441 \u21161:<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;data&quot;: [         {             &quot;name&quot;: &quot;Ivan&quot;         },         {             &quot;name&quot;: &quot;Oleg&quot;         }     ],     &quot;id&quot;: 1 }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u0432\u0435\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;success&quot;: true,     &quot;result&quot;: [         {             &quot;id&quot;: &quot;af908a90-9157-4231-89f6-560eb6a8c4c0&quot;,             &quot;name&quot;: &quot;Ivan&quot;         },         {             &quot;id&quot;: &quot;f7d554a0-1be9-4a65-bfc2-b89dbf70bb3c&quot;,             &quot;name&quot;: &quot;Oleg&quot;         }     ],     &quot;id&quot;: 1 }<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>\u0417\u0430\u043f\u0440\u043e\u0441 \u21162:<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;data&quot;: {         &quot;name&quot;: &quot;Eliza&quot;     },     &quot;id&quot;: 2 }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u0432\u0435\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;success&quot;: true,     &quot;result&quot;: {         &quot;id&quot;: &quot;f3a45a19-acd0-4939-8e0c-e10743ff8e55&quot;,         &quot;name&quot;: &quot;Eliza&quot;     },     &quot;id&quot;: 2 } <\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>\u0417\u0430\u043f\u0440\u043e\u0441 \u21163:<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 <code>data<\/code> \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;data&quot;: 123,     &quot;id&quot;: 3 }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u0432\u0435\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;success&quot;: false,     &quot;result&quot;: {         &quot;error_type&quot;: &quot;&lt;class 'middlewares.exceptions.InputDataValidationError'&gt;&quot;,         &quot;error_message&quot;: &quot;ValidationArgumentsError - Validation error &lt;class 'valdec.errors.ValidationError'&gt;: 2 validation errors for argument with the name of:\\ndata\\n  value is not a valid dict (type=type_error.dict)\\ndata\\n  value is not a valid list (type=type_error.list).&quot;     },     &quot;id&quot;: 3 }<\/code><\/pre>\n<p>  <\/p>\n<h5 id=\"2372-metod-read\">2.3.7.2. \u041c\u0435\u0442\u043e\u0434 \/read<\/h5>\n<p>  <\/p>\n<ul>\n<li>\u0417\u0430\u043f\u0440\u043e\u0441 \u21161:<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;data&quot;: &quot;f3a45a19-acd0-4939-8e0c-e10743ff8e55&quot;,     &quot;id&quot;: 4 }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u0432\u0435\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;success&quot;: true,     &quot;result&quot;: {         &quot;id&quot;: &quot;f3a45a19-acd0-4939-8e0c-e10743ff8e55&quot;,         &quot;name&quot;: &quot;Eliza&quot;     },     &quot;id&quot;: 4 <\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>\u0417\u0430\u043f\u0440\u043e\u0441 \u21162:<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;some_key&quot;: &quot;f3a45a19-acd0-4939-8e0c-e10743ff8e55&quot;,     &quot;id&quot;: 5 }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u0432\u0435\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;success&quot;: false,     &quot;result&quot;: {         &quot;error_type&quot;: &quot;&lt;class 'middlewares.exceptions.InputDataValidationError'&gt;&quot;,         &quot;error_message&quot;: &quot;ValidationError - 1 validation error for WrapRequest\\nsome_key\\n  extra fields not permitted (type=value_error.extra)&quot;     },     &quot;id&quot;: null }<\/code><\/pre>\n<p>  <\/p>\n<h5 id=\"2373-metod-infoinfo_id\">2.3.7.3. \u041c\u0435\u0442\u043e\u0434 \/info\/{info_id}<\/h5>\n<p>  <\/p>\n<ul>\n<li>\u0417\u0430\u043f\u0440\u043e\u0441 <code>GET<\/code> \u043d\u0430 <code>\/info\/123<\/code>:<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{}<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u0432\u0435\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">{     &quot;success&quot;: true,     &quot;result&quot;: &quot;info_id=123 and request=&lt;Request GET \/info\/123 &gt;&quot;,     &quot;id&quot;: null }<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h2 id=\"3-o-nerealizovannoy-dokumentacii-anchor3-o-nerealizovannoy-dokumentaciianchor\">3. \u041e \u043d\u0435\u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <a name=\"3-o-nerealizovannoy-dokumentacii\"><\/a><\/h2>\n<p>  <\/p>\n<p>\u0423 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c <code>WrapsKwargsHandler<\/code>, \u0435\u0441\u0442\u044c \u0432\u0441\u0451, \u0447\u0442\u043e\u0431\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e. \u041a \u043d\u0438\u043c \u0431\u043e\u043b\u0435\u0435 \u043d\u0435 \u043d\u0430\u0434\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c. \u0422\u0430\u043a \u043a\u0430\u043a \u043a\u043b\u0430\u0441\u0441\u044b <code>pydantic.BaseModel<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c json-schema, \u0442\u043e \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u0431\u043e\u0440\u043a\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 (\u0435\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e, \u0442\u043e \u043d\u0430\u0434\u043e: \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0439\u0442\u0438\u0441\u044c \u043f\u043e \u0432\u0441\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0438 \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u043e\u043a\u0441\u0442\u0440\u0438\u043d\u0433 \u043d\u0430 swagger-\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435, \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u0434\u043e\u043a\u0441\u0442\u0440\u0438\u043d\u0433\u0430 \u0438 json-\u0441\u0445\u0435\u043c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430).<\/p>\n<p>  <\/p>\n<p>\u0418 \u044f \u044d\u0442\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0441\u043e\u0431\u0438\u0440\u0430\u044e. \u041d\u043e \u043d\u0435 \u0441\u0442\u0430\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e \u044d\u0442\u043e \u0432 \u0441\u0442\u0430\u0442\u044c\u0435. \u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f <code>swagger<\/code> \u0438 <code>aiohttp<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u0430\u043a \u043d\u0430\u0434\u043e (\u0438\u043b\u0438 \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u043d\u0430\u0434\u043e).<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <code>aiohttp-swagger<\/code> \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 (\u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u0445 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438), \u0435\u0441\u043b\u0438 \u0432 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u0430\u043b\u0438\u0430\u0441 <code>Union<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <code>aiohttp-swagger3<\/code>, \u043d\u0430\u043f\u0440\u043e\u0442\u0438\u0432, \u0432\u0441\u0435 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043d\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0435\u0441\u043b\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0435\u0441\u0442\u044c <code>sub_app<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0437\u043d\u0430\u0435\u0442 \u043a\u0430\u043a \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0438\u043b\u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043a\u0442\u043e-\u0442\u043e \u0437\u043d\u0430\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e \u2014 \u0431\u0443\u0434\u0443 \u043e\u0447\u0435\u043d\u044c \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0435\u043d \u0437\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439.<\/p>\n<p>  <\/p>\n<h2 id=\"4-zaklyuchenie-anchor4-zaklyuchenieanchor\">4. \u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <a name=\"4-zaklyuchenie\"><\/a><\/h2>\n<p>  <\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u0443 \u043d\u0430\u0441 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f json middleware \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438. \u041b\u044e\u0431\u043e\u0439 \u0438\u0437 \u043d\u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0434 \u0441\u0432\u043e\u0438 \u043d\u0443\u0436\u0434\u044b. \u0418\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0430 \u0438\u0445 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u043e\u0432\u044b\u0439.<\/p>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 \u0434\u043b\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432. \u0422\u0430\u043a \u0436\u0435, \u043c\u043e\u0436\u043d\u043e \u0433\u0438\u0431\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e, \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0435\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043c, \u0433\u0434\u0435 \u043e\u043d\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430.<\/p>\n<p>  <\/p>\n<p>\u041d\u0435 \u0441\u043e\u043c\u043d\u0435\u0432\u0430\u044e\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b, \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u043e \u0434\u0440\u0443\u0433\u043e\u043c\u0443. \u041d\u043e \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u043c\u043e\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0435\u0441\u043b\u0438 \u0438 \u043d\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u044f\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e, \u0442\u043e \u043f\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u0441\u0442\u0432\u0443\u044e\u0442 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044e \u0438\u043d\u044b\u0445, \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0445.<\/p>\n<p>  <\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0443\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f\u043c, \u0438 \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u044f\u043c.<\/p>\n<p>  <\/p>\n<p><em>\u041f\u0440\u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b <a href=\"https:\/\/habr.com\/ru\/post\/442368\/\">MarkConv<\/a><\/em><\/p>\n<\/div>\n<p> \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\/544638\/\"> https:\/\/habr.com\/ru\/post\/544638\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f json api \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0441 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/aio-libs\/aiohttp\" rel=\"nofollow noopener noreferrer\">aiohttp<\/a>. \u042d\u0442\u043e \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439, \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044e\u0449\u0438\u0439\u0441\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 python, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 <code>asyncio<\/code>.<\/p>\n<p>  <\/p>\n<p><strong>\u041e\u0431 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f\u0445:<\/strong><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 \u0432 <code>python<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0434 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c. \u0422\u0430\u043a \u0436\u0435, \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u0418\u043c\u0435\u043d\u043d\u043e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0438\u0433\u0440\u0430\u044e\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u0443\u044e \u0440\u043e\u043b\u044c \u043f\u0440\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 api-\u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/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-318757","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/318757","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=318757"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/318757\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=318757"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=318757"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=318757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}