{"id":29039,"date":"2019-02-19T00:00:00","date_gmt":"2019-02-18T23:00:00","guid":{"rendered":"https:\/\/blexin.com\/documentare-le-api-con-swagger\/"},"modified":"2021-05-20T19:24:05","modified_gmt":"2021-05-20T17:24:05","slug":"documenting-api-with-swagger","status":"publish","type":"post","link":"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/","title":{"rendered":"Documenting API with Swagger"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"608\" data-attachment-id=\"29021\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/attachment\/208a28b8-de1f-4321-b877-f7ca01ccaea6-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/208a28b8-de1f-4321-b877-f7ca01ccaea6.png?fit=1024%2C608&amp;ssl=1\" data-orig-size=\"1024,608\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"208a28b8-de1f-4321-b877-f7ca01ccaea6\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/208a28b8-de1f-4321-b877-f7ca01ccaea6.png?fit=1024%2C608&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/208a28b8-de1f-4321-b877-f7ca01ccaea6.png?resize=1024%2C608&#038;ssl=1\" alt=\"\" class=\"wp-image-29021\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/208a28b8-de1f-4321-b877-f7ca01ccaea6.png 1024w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/208a28b8-de1f-4321-b877-f7ca01ccaea6-980x582.png 980w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/208a28b8-de1f-4321-b877-f7ca01ccaea6-480x285.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I recently worked on the backend of an application, for one of our clients. Some&nbsp;<em>tasks<\/em>&nbsp;concerned the introduction of new API to be noticed with&nbsp;<strong>Swagger<\/strong>&nbsp;and, specifically, one of these requires to habilitate Swagger only for the&nbsp;<em>debug environment<\/em>&nbsp;and to disable it for the&nbsp;<em>production environment<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But what is Swagger? It is a tools set, that accompanies&nbsp;the specification&nbsp;<strong><a href=\"https:\/\/github.com\/OAI\/OpenAPI-Specification\" target=\"_blank\" rel=\"noreferrer noopener\">OpenApi<\/a><\/strong>&nbsp;(<strong>OAS<\/strong>), namely the standard for API Rest description, to create and document these API. The&nbsp;<strong>OAS<\/strong>&nbsp;standard is independent from the programming language, and it has been designed to be comprehensible both for people and for computers. The goal is to make understandable what is made available from a services, with no need to access to source codes or to an additional documentation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In a .Net project it\u2019s possible to integrate Swagger installing, via&nbsp;Nuget, the Open Source package&nbsp;<strong>Swashbuckle<\/strong>. Once installed, we will find in the folder&nbsp;<em>App_start<\/em>&nbsp;the file&nbsp;<em>SwaggerConfig.cs<\/em>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"205\" height=\"110\" data-attachment-id=\"29025\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/attachment\/image1-6-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image1-6.png?fit=205%2C110&amp;ssl=1\" data-orig-size=\"205,110\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image1-6\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image1-6.png?fit=205%2C110&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image1-6.png?resize=205%2C110&#038;ssl=1\" alt=\"\" class=\"wp-image-29025\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This file contains many useful comments for the configuration of&nbsp;<strong>Swagger<\/strong>&nbsp;for our application. In particular, we can indicate a&nbsp;<em>XML<\/em>&nbsp;file, where will be saved the comments in which we can save our API.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nc.IncludeXmlComments(GetXmlCommentsPath());\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">To avoid mistakes, we need to go in project properties, tab&nbsp;<em>Build<\/em>, section&nbsp;<em>Output<\/em>, flag the option &#8220;XML documentation file&#8221;, indicate the destination file&nbsp;<em>XML<\/em>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"657\" height=\"195\" data-attachment-id=\"29027\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/attachment\/image2-5-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image2-5.png?fit=657%2C195&amp;ssl=1\" data-orig-size=\"657,195\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image2-5\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image2-5.png?fit=657%2C195&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image2-5.png?resize=657%2C195&#038;ssl=1\" alt=\"\" class=\"wp-image-29027\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image2-5.png 657w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image2-5-480x142.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 657px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As soon as we finish this configuration, it\u2019s possible to notice the API with following&nbsp;<em>tags<\/em>&nbsp;:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Summary<\/li><\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\/\/\/ &lt;summary&gt;\n\/\/\/ Esempio Commenti Swagger\n\/\/\/ &lt;\/summary&gt;\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\"><li>Remarks<\/li><\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\/\/\/ &lt;remarks&gt;Osservazioni &lt;\/remarks&gt;\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\"><li>Parameter<\/li><\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\/\/\/ &lt;param name=&quot;id&quot; cref=&quot;int&quot;&gt;Value id&lt;\/param&gt;\n\/\/\/ &lt;param name=&quot;value&quot; cref=&quot;string&quot;&gt;Value string&lt;\/param&gt;\n<\/pre><\/div>\n\n\n<ul class=\"wp-block-list\"><li>Response<\/li><\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\/\/\/&lt;response code=&quot;500&quot;&gt;Ops!!! Error 500 &lt;\/response&gt;\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">We consider following&nbsp;<em>action<\/em>&nbsp;that makes a&nbsp;<em>GET<\/em>.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\/\/\/ &lt;summary&gt;\n\/\/\/ Esempio Commenti Swagger\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;id&quot; cref=&quot;int&quot;&gt;Value id&lt;\/param&gt;\n\/\/\/ &lt;param name=&quot;value&quot; cref=&quot;string&quot;&gt;Value string&lt;\/param&gt;\n\/\/\/ &lt;remarks&gt;Osservazioni &lt;\/remarks&gt;\n\/\/\/&lt;response code=&quot;500&quot;&gt;Ops!!! Error 500 &lt;\/response&gt;\npublic string Get(int id, string value)\n{\n\u00a0\u00a0\u00a0\u00a0return value+id.ToString();\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">We can see the result of the notice in the&nbsp;<strong><a rel=\"noreferrer noopener\" href=\"https:\/\/swagger.io\/tools\/swagger-ui\/\" target=\"_blank\">SwaggerUI<\/a><\/strong>&nbsp;reachable to the address: [host]:[port]\/swagger.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"378\" data-attachment-id=\"29031\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/attachment\/image3-5-2-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image3-5.png?fit=960%2C378&amp;ssl=1\" data-orig-size=\"960,378\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image3-5\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image3-5.png?fit=960%2C378&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image3-5.png?resize=960%2C378&#038;ssl=1\" alt=\"\" class=\"wp-image-29031\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image3-5.png 960w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image3-5-480x189.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 960px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">How can we configure Swagger, making it available only for development&nbsp;<em>environment<\/em>&nbsp;and disabling it for the production environment? There are some simple steps to do. We&nbsp;define in the file&nbsp;<em>web.config<\/em>&nbsp;a new&nbsp;<em>key<\/em>&nbsp;inside the&nbsp;<em>tag<\/em>&nbsp;&lt;<em>appsettings<\/em>&gt; for first:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&lt;appSettings&gt;\n\u00a0\u00a0\u00a0\u00a0&lt;add key=&quot;DisableSwagger&quot; value=&quot;False&quot; \/&gt;\n&lt;\/appSettings&gt;\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Later, inside the file&nbsp;<em>SwaggerConfig.cs<\/em>&nbsp;and specifically inside the methos&nbsp;<em>Register()<\/em>, we insert a control on the&nbsp;<em>key<\/em>&nbsp;value, previously defined.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nif (ConfigurationManager.AppSettings&#x5B;&quot;DisableSwagger&quot;] == &quot;True&quot;)\n{\n\u00a0\u00a0\u00a0\u00a0return;\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">We create then a transformation rule inside the&nbsp;<em>Web.Release.config<\/em>, thanks to which the parameter&nbsp;<em>DisableSwagger<\/em>&nbsp;will be set at value&nbsp;<strong><em>true<\/em><\/strong>, so that the condition will not take place for the production&nbsp;<em>environment<\/em>.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n&lt;add key=&quot;DisableSwagger&quot; value=&quot;True&quot; xdt:Transform=&quot;Replace&quot; xdt:Locator=&quot;Match(key)&quot; \/&gt;\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">If we right click on&nbsp;<em>Web.Release.config<\/em>&nbsp;we can see the effect of this transformation and, selecting&nbsp;<em>\u201cPreview Transform\u201d<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"396\" height=\"328\" data-attachment-id=\"29034\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/attachment\/image4-5-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image4-5.png?fit=396%2C328&amp;ssl=1\" data-orig-size=\"396,328\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image4-5\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image4-5.png?fit=396%2C328&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image4-5.png?resize=396%2C328&#038;ssl=1\" alt=\"\" class=\"wp-image-29034\" srcset=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image4-5.png?w=396&amp;ssl=1 396w, https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image4-5.png?resize=300%2C248&amp;ssl=1 300w\" sizes=\"auto, (max-width: 396px) 100vw, 396px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">We will obtan the intended effect:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"68\" data-attachment-id=\"29037\" data-permalink=\"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/attachment\/image5-4-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image5-4.png?fit=1380%2C92&amp;ssl=1\" data-orig-size=\"1380,92\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image5-4\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image5-4.png?fit=1024%2C68&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/image5-4.png?resize=1024%2C68&#038;ssl=1\" alt=\"\" class=\"wp-image-29037\" srcset=\"https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image5-4-980x65.png 980w, https:\/\/blexin.com\/wp-content\/uploads\/2020\/12\/image5-4-480x32.png 480w\" sizes=\"auto, (min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Fast and simple! I wish it could be useful to you, as it was for me.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">See you next<\/p>\n\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>Let\u2019s automatize the boring part of the API development with Swagger and .Net<\/p>\n","protected":false},"author":196716251,"featured_media":29021,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","inline_featured_image":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_wpcom_ai_launchpad_first_post":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"{title}\n\n{excerpt}\n\n{url}","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_wpas_customize_per_network":false,"jetpack_post_was_ever_published":false},"categories":[688637524],"tags":[688637447],"class_list":["post-29039","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-en","tag-tools-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Documenting API with Swagger - Blexin<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Documenting API with Swagger - Blexin\" \/>\n<meta property=\"og:description\" content=\"Let\u2019s automatize the boring part of the API development with Swagger and .Net\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/\" \/>\n<meta property=\"og:site_name\" content=\"Blexin\" \/>\n<meta property=\"article:published_time\" content=\"2019-02-18T23:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-20T17:24:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/208a28b8-de1f-4321-b877-f7ca01ccaea6.png?fit=1024%2C608&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"608\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Genny Paudice\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Genny Paudice\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/documenting-api-with-swagger\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/documenting-api-with-swagger\\\/\"},\"author\":{\"name\":\"Genny Paudice\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/ae0e97a3ebb79d2f73e4411c1eb28973\"},\"headline\":\"Documenting API with Swagger\",\"datePublished\":\"2019-02-18T23:00:00+00:00\",\"dateModified\":\"2021-05-20T17:24:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/documenting-api-with-swagger\\\/\"},\"wordCount\":468,\"image\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/documenting-api-with-swagger\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/208a28b8-de1f-4321-b877-f7ca01ccaea6.png?fit=1024%2C608&ssl=1\",\"keywords\":[\"Tools\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/documenting-api-with-swagger\\\/\",\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/documenting-api-with-swagger\\\/\",\"name\":\"Documenting API with Swagger - Blexin\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/documenting-api-with-swagger\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/documenting-api-with-swagger\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/208a28b8-de1f-4321-b877-f7ca01ccaea6.png?fit=1024%2C608&ssl=1\",\"datePublished\":\"2019-02-18T23:00:00+00:00\",\"dateModified\":\"2021-05-20T17:24:05+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/ae0e97a3ebb79d2f73e4411c1eb28973\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/documenting-api-with-swagger\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/documenting-api-with-swagger\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/documenting-api-with-swagger\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/208a28b8-de1f-4321-b877-f7ca01ccaea6.png?fit=1024%2C608&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/blexin.com\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/208a28b8-de1f-4321-b877-f7ca01ccaea6.png?fit=1024%2C608&ssl=1\",\"width\":1024,\"height\":608},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/blog-en\\\/documenting-api-with-swagger\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/blexin.com\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Documenting API with Swagger\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/\",\"name\":\"Blexin\",\"description\":\"Con noi \u00e8 semplice\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blexin.com\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blexin.com\\\/en\\\/#\\\/schema\\\/person\\\/ae0e97a3ebb79d2f73e4411c1eb28973\",\"name\":\"Genny Paudice\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3093a6ee7b7f555e94e4a5d6f19cb09f3af33635007643b2076eb89329789828?s=96&d=identicon&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3093a6ee7b7f555e94e4a5d6f19cb09f3af33635007643b2076eb89329789828?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3093a6ee7b7f555e94e4a5d6f19cb09f3af33635007643b2076eb89329789828?s=96&d=identicon&r=g\",\"caption\":\"Genny Paudice\"},\"url\":\"https:\\\/\\\/blexin.com\\\/en\\\/author\\\/genny-paudiceblexin-com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Documenting API with Swagger - Blexin","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/","og_locale":"en_US","og_type":"article","og_title":"Documenting API with Swagger - Blexin","og_description":"Let\u2019s automatize the boring part of the API development with Swagger and .Net","og_url":"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/","og_site_name":"Blexin","article_published_time":"2019-02-18T23:00:00+00:00","article_modified_time":"2021-05-20T17:24:05+00:00","og_image":[{"width":1024,"height":608,"url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/208a28b8-de1f-4321-b877-f7ca01ccaea6.png?fit=1024%2C608&ssl=1","type":"image\/png"}],"author":"Genny Paudice","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Genny Paudice","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/#article","isPartOf":{"@id":"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/"},"author":{"name":"Genny Paudice","@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/ae0e97a3ebb79d2f73e4411c1eb28973"},"headline":"Documenting API with Swagger","datePublished":"2019-02-18T23:00:00+00:00","dateModified":"2021-05-20T17:24:05+00:00","mainEntityOfPage":{"@id":"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/"},"wordCount":468,"image":{"@id":"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/208a28b8-de1f-4321-b877-f7ca01ccaea6.png?fit=1024%2C608&ssl=1","keywords":["Tools"],"articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/","url":"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/","name":"Documenting API with Swagger - Blexin","isPartOf":{"@id":"https:\/\/blexin.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/#primaryimage"},"image":{"@id":"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/208a28b8-de1f-4321-b877-f7ca01ccaea6.png?fit=1024%2C608&ssl=1","datePublished":"2019-02-18T23:00:00+00:00","dateModified":"2021-05-20T17:24:05+00:00","author":{"@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/ae0e97a3ebb79d2f73e4411c1eb28973"},"breadcrumb":{"@id":"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/#primaryimage","url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/208a28b8-de1f-4321-b877-f7ca01ccaea6.png?fit=1024%2C608&ssl=1","contentUrl":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/208a28b8-de1f-4321-b877-f7ca01ccaea6.png?fit=1024%2C608&ssl=1","width":1024,"height":608},{"@type":"BreadcrumbList","@id":"https:\/\/blexin.com\/en\/blog-en\/documenting-api-with-swagger\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blexin.com\/en\/"},{"@type":"ListItem","position":2,"name":"Documenting API with Swagger"}]},{"@type":"WebSite","@id":"https:\/\/blexin.com\/en\/#website","url":"https:\/\/blexin.com\/en\/","name":"Blexin","description":"Con noi \u00e8 semplice","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blexin.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blexin.com\/en\/#\/schema\/person\/ae0e97a3ebb79d2f73e4411c1eb28973","name":"Genny Paudice","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3093a6ee7b7f555e94e4a5d6f19cb09f3af33635007643b2076eb89329789828?s=96&d=identicon&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/3093a6ee7b7f555e94e4a5d6f19cb09f3af33635007643b2076eb89329789828?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3093a6ee7b7f555e94e4a5d6f19cb09f3af33635007643b2076eb89329789828?s=96&d=identicon&r=g","caption":"Genny Paudice"},"url":"https:\/\/blexin.com\/en\/author\/genny-paudiceblexin-com\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/blexin.com\/wp-content\/uploads\/2020\/12\/208a28b8-de1f-4321-b877-f7ca01ccaea6.png?fit=1024%2C608&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pcyUBx-7yn","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/29039","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/users\/196716251"}],"replies":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/comments?post=29039"}],"version-history":[{"count":3,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/29039\/revisions"}],"predecessor-version":[{"id":32007,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/posts\/29039\/revisions\/32007"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/media\/29021"}],"wp:attachment":[{"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/media?parent=29039"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/categories?post=29039"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blexin.com\/en\/wp-json\/wp\/v2\/tags?post=29039"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}