{"id":20007562,"url":"https://github.com/kevm/fubumvc-swagger","last_synced_at":"2025-06-10T18:32:34.495Z","repository":{"id":2471783,"uuid":"3444404","full_name":"KevM/fubumvc-swagger","owner":"KevM","description":"FubuMVC convention for creating API documentation for your content negotiation enabled actions ","archived":false,"fork":false,"pushed_at":"2015-09-18T17:25:46.000Z","size":595,"stargazers_count":12,"open_issues_count":2,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-04T18:49:50.364Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KevM.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-02-14T22:02:17.000Z","updated_at":"2018-02-09T18:56:54.000Z","dependencies_parsed_at":"2022-09-12T11:44:37.859Z","dependency_job_id":null,"html_url":"https://github.com/KevM/fubumvc-swagger","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevM%2Ffubumvc-swagger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevM%2Ffubumvc-swagger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevM%2Ffubumvc-swagger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevM%2Ffubumvc-swagger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KevM","download_url":"https://codeload.github.com/KevM/fubumvc-swagger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevM%2Ffubumvc-swagger/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259124212,"owners_count":22808892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T06:22:10.825Z","updated_at":"2025-06-10T18:32:34.468Z","avatar_url":"https://github.com/KevM.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"FubuMVC Swagger\r\n===============\r\n\r\nThis project helps your [FubuMVC](https://github.com/DarthFubuMVC/fubumvc) web application\r\n generate API documentation via [Swagger](http://swagger.wordnik.com/).\r\n \r\n[![swagger demo](https://github.com/KevM/fubumvc-swagger/raw/gh-pages/images/hellofubuswagger.png)](http://fubuswagger.apphb.com/)\r\n\r\nSee our [Hello Swagger](http://fubuswagger.apphb.com/) live demo.\r\n\r\n### How do I get it? ###\r\n\r\nWe have a [nuget package](https://nuget.org/packages/FubuMVC.Swagger) available.\r\n\r\n```PM\u003e Install-Package FubuMVC.Swagger```\r\n\r\n#### Building Swagger\r\n\r\nTo build just run rake grabbing the albacore gem if you don't already have it. \r\n\r\n```rb\r\ngem install albacore\r\nrake\r\n```\r\n\r\n### How do I put this in my peanut butter?\r\n\r\n**Note:** This should all be simplified when I find the time to figure out Fubu Bottles. \r\n\r\nYour API documented should support content negitiation and be grouped under the route **/api**. Take a look at the [HelloSwagger](https://github.com/KevM/fubumvc-swagger/tree/master/src/HelloSwagger) for examples. \r\n\r\n#### Checklist\r\n\r\nAdd a reference to this project. Why not [use nuget](https://nuget.org/packages/FubuMVC.Swagger)!\r\n\r\nAdd the following to your FubuRegistry:\r\n\r\n```cs\r\nApplyConvention\u003cSwaggerConvention\u003e();\r\nServices(s=\u003e s.AddService\u003cIActionGrouper, APIRouteGrouper\u003e());\r\n```\r\n\r\nCopy the swagger-ui directory into your **/content** direcotry.\r\n\r\nLaunch your web app and take a look at the **/api** to see if it is working.\r\n\r\n### What does this convention do?\r\n\r\nThree routes will be added to your application:\r\n\r\n```html\r\nGET /api\r\n```\r\nThis route serves up the Swagger-UI page currently embedded into FubuSwagger. _This part needs work._\r\n\r\n```html\r\nGET /api/resources.json\r\n```\r\nSwagger UI does some resource discovery and uses the output of this route to find all of the API groups in your project. \r\n\r\n```html\r\nGET /api/{GroupKey}.json\r\n```\r\nDetails of each API group present in your app. \r\n\r\nPointing a Swagger UI web site at ```http://localhost:port/api/``` should render pretty API documentation for your web application.\r\n\r\n### Why do I not see documentation for my actions?\r\n\r\nMake sure the actions you wish to document are enabled for \"Conneg\"\r\n\r\nIn this example I have two marker interfaces which are used to mark input models on actions which will be APIs. \r\n\r\n```cs\r\ngraph.Behaviors\r\n .Where(x =\u003e x.InputType().CanBeCastTo\u003cIApi\u003e() || x.InputType().CanBeCastTo\u003cIUnauthenticatedApi\u003e())\r\n .Each(x =\u003e x.MakeAsymmetricJson());\r\n```\r\n\r\nThis example will force the result of these actions to be JSON. Note: This configuration is working around a bug in FubuMVC where normal browser usage will return XML for Conneg enabled endpoints. :( \r\n\r\nBetter yet take a look at the [HelloSwagger](https://github.com/KevM/fubumvc-swagger/tree/master/src/HelloSwagger) demo application and see how it is wired up and organized.\r\n\r\n### How do I add more detail to my APIs\r\n\r\nYou can use data annotations to mark up your input models and their properties.\r\n\r\n```cs\r\n[Description(\"Workflow object history\")]\r\npublic class HistoryRequest : IApi \r\n{\r\n    [Required, Description(\"Type of workflow object. Typically this is 'case'.\")]\r\n    [AllowableValues(\"case\", \"subcase\", \"solution\", \"\u003cany workflow object name\u003e\")]\r\n    public string Type { get; set; }\r\n    [Required, Description(\"Id of the workflow object.\")]\r\n    public string Id { get; set; }\r\n\r\n    [Description(\"Limit the amout of history returned the given number of days. When this parameter is not specified. All history items will be returned.\")]\r\n\tpublic int DaysOfHistory { get; set; }\r\n}\r\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevm%2Ffubumvc-swagger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevm%2Ffubumvc-swagger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevm%2Ffubumvc-swagger/lists"}