{"id":37043653,"url":"https://github.com/greymind/webapitotypescript","last_synced_at":"2026-01-14T05:01:14.079Z","repository":{"id":37934531,"uuid":"66123205","full_name":"greymind/WebApiToTypeScript","owner":"greymind","description":"A tool for code generating TypeScript endpoints for your ASP.NET Web API controllers","archived":false,"fork":false,"pushed_at":"2022-06-22T17:34:24.000Z","size":475,"stargazers_count":25,"open_issues_count":14,"forks_count":10,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-11-27T13:48:46.127Z","etag":null,"topics":["angular","asp-net","c-sharp","code-generation","code-generator","csharp","typescript","webapi","webapi-2"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/greymind.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-20T02:04:01.000Z","updated_at":"2024-04-20T04:20:13.000Z","dependencies_parsed_at":"2022-08-26T01:02:12.614Z","dependency_job_id":null,"html_url":"https://github.com/greymind/WebApiToTypeScript","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"purl":"pkg:github/greymind/WebApiToTypeScript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greymind%2FWebApiToTypeScript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greymind%2FWebApiToTypeScript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greymind%2FWebApiToTypeScript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greymind%2FWebApiToTypeScript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/greymind","download_url":"https://codeload.github.com/greymind/WebApiToTypeScript/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greymind%2FWebApiToTypeScript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28410078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["angular","asp-net","c-sharp","code-generation","code-generator","csharp","typescript","webapi","webapi-2"],"created_at":"2026-01-14T05:01:13.329Z","updated_at":"2026-01-14T05:01:14.072Z","avatar_url":"https://github.com/greymind.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Web API To TypeScript\n\n[![Join the chat at https://gitter.im/WebApiToTypeScript/Lobby](https://badges.gitter.im/WebApiToTypeScript/Lobby.svg)](https://gitter.im/WebApiToTypeScript/Lobby?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nA tool for code generating TypeScript endpoints for your ASP.NET Web API controllers and their actions. No more need for dumb repositories!\n* Generates typed endpoints with required and optional parameters for GET, PUT, POST and DELETE verbs\n  * Generates cached endpoints for GET verb actions\n* Generates enumerations and interfaces for DTOs used in all controller actions\n  * Generates enum descriptions based on the `[Description]` attribute\n* Generates Angular service to expose typed `call()` function to fetch response from server\n* Generates typed views to use on front-end\n* Generates resources files based on .resx files\n\n## Examples\nTake a look at the generated files and sample test files [here](https://github.com/greymind/WebApiToTypeScript/tree/master/src/TestApplication/Scripts/Generated)\n\n## Getting the tool from NuGet\n[https://www.nuget.org/packages/WebApiToTypeScript/](https://www.nuget.org/packages/WebApiToTypeScript/)\n```\nInstall-Package WebApiToTypeScript\n```\n\n## Using as standalone tool\nJust run the executable with the config file as the argument\n```\nwatts.exe \"Path/To/Config/File.json\"\n```\n\n## Using as MSBuild Target\n\u003e I haven't tested this in a while, so if you find any inconsistencies with working directory and such, feel free to file an issue or better yet, submit a pull request!\n\nEnsure the DLL is part of the build process, so you have access to it. Easiest way is to reference it in your project.\n```\n\u003cUsingTask TaskName=\"WebApiToTypeScript.WebApiToTypeScript\" AssemblyFile=\"$(ProjectDir)..\\WebApiToTypeScript\\bin\\Debug\\WebApiToTypeScript.dll\" /\u003e\n\u003cTarget Name=\"AfterBuild\"\u003e\n    \u003cWebApiToTypeScript ConfigFilePath=\"$(ProjectDir)Watts.config.json\" /\u003e\n\u003c/Target\u003e\n```\n\n## T4 Template\nIf you wish to integrate the executable as part of your workflow from within Visual Studio, you may consider wiring it up to a T4 template. [Here](https://github.com/greymind/WebApiToTypeScript/tree/master/src/WebApiTestApplication/Scripts/Watts.tt) is a sample.\n\n## Protip\nYou can build just the C# parts of the solution by adding a condition to the TypeScript target in the `csproj` file. This way you can ensure that before you run WebApiToTypeScript, you have a hassle-free build of the backend code.\n```\n  \u003cPropertyGroup\u003e\n    \u003cSkipTypeScript Condition=\"'$(SkipTypeScript)'==''\"\u003eFalse\u003c/SkipTypeScript\u003e\n  \u003c/PropertyGroup\u003e\n  \u003cImport Project=\"$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\TypeScript\\Microsoft.TypeScript.targets\" Condition=\"Exists('$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\TypeScript\\Microsoft.TypeScript.targets') AND '$(SkipTypeScript)'=='False'\" /\u003e\n```\n```\nPath\\To\\msbuild.exe /t:build /p:SkipTypeScript=True Path\\To\\Project.csproj\n```\n\n## Using Angular Endpoints Service\nYou'll need to register the Endpoints service to your app and inject it as is typical in Angular\n```\nangular.module('framework').service('AngularEndpointsService', Framework.Endpoints.AngularEndpointsService);\n```\n\n## Config\n```\n{\n  \"WebApiModuleFileName\": \"string\",\n  \"WebApiModuleFileNames\": [ \"string\" ]\n  \n  \"GenerateEndpointsReturnTypes\": \"boolean\",\n  \"GenerateEndpoints\": \"boolean\",  \n  \"EndpointsOutputDirectory\": \"string\",\n  \"EndpointsSupportCaching\": \"boolean\",\n  \"EndpointsFileName\": \"string\",\n  \"EndpointsNamespace\": \"string\",\n  \n  \"GenerateMobileEndpoints\": \"boolean\",\n  \"MobileEndpointsOutputDirectory\": \"string\",\n  \"MobileEndpointsFileName\": \"string\",\n  \"MobileEndpointsNamespace\": \"string\",\n  \"MobileEndpointAttributeName\": \"string\",\n\n  \"GenerateService\": \"boolean\",\n  \"ServiceOutputDirectory\": \"string\",\n  \"ServiceFileName\": \"string\",\n  \"ServiceNamespace\": \"string\",\n  \"ServicesName\": \"string\",\n\n  \"GenerateEnums\": \"boolean\",\n  \"GenerateEnumDescriptions\": \"boolean\",\n  \"EnumsOutputDirectory\": \"string\",\n  \"EnumsFileName\": \"string\",\n  \"EnumsNamespace\": \"string\",\n\n  \"GenerateInterfaces\": \"boolean\",\n  \"InterfacesOutputDirectory\": \"string\",\n  \"InterfacesFileName\": \"string\",\n  \"InterfacesNamespace\": \"string\",\n  \"InterfaceMembersInCamelCase\": \"boolean\",\n  \"InterfaceCamelCaseCustomAttribute\": \"string\",\n  \"InterfaceMatches\": [\n    \"Match\": \"string\",\n    \"ExcludeMatch\": \"string\",\n    \"BaseTypeName\": \"string\"\n  ],\n\n  \"GenerateViews\": \"boolean\",\n  \"ViewConfigs\": [\n    {\n      \"SourceDirectory\": \"string\",\n      \"Namespace\": \"string\",\n      \"OutputFilename\": \"string\",\n      \"Prefix\": \"string\",\n      \"UrlEncodePath\": \"boolean\"\n    }\n  ],\n  \"ViewsPattern\": \"string\",\n  \"ViewsOutputDirectory\": \"string\",\n  \"UseViewsGroupingNamespace\": \"boolean\",\n  \"ViewsIgnoredExtensions\": [\n      \"string\"\n  ]\n\n  \"ScanOtherModules\": \"boolean\",\n  \"WriteNamespaceAsModule\": \"boolean\",\n\n  \"TypeMappings\": [\n    {\n      \"WebApiTypeName\": \"string\",\n      \"TypeScriptTypeName\": \"string\",\n      \"AutoInitialize\": \"boolean\",\n      \"TreatAsAttribute\": \"boolean\"\n      \"TreatAsConstraint\": \"boolean\",\n      \"Match\": \"string\"\n    }\n  ]\n}\n```\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreymind%2Fwebapitotypescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreymind%2Fwebapitotypescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreymind%2Fwebapitotypescript/lists"}