{"id":18023678,"url":"https://github.com/falcoframework/Falco.OpenApi","last_synced_at":"2025-10-25T00:31:08.550Z","repository":{"id":258600809,"uuid":"874218513","full_name":"pimbrouwers/Falco.OpenApi","owner":"pimbrouwers","description":"OpenAPI integration for Falco.","archived":false,"fork":false,"pushed_at":"2025-01-25T01:22:08.000Z","size":43,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-25T02:20:03.565Z","etag":null,"topics":["fsharp","openapi","openapi-generator","openapi-spec","openapi-specification","openapi3"],"latest_commit_sha":null,"homepage":"","language":"F#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pimbrouwers.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-17T12:58:45.000Z","updated_at":"2025-01-25T01:22:12.000Z","dependencies_parsed_at":"2025-01-25T02:20:06.600Z","dependency_job_id":"f914cb9e-dc8d-4d4d-813e-15ae47db3eca","html_url":"https://github.com/pimbrouwers/Falco.OpenApi","commit_stats":null,"previous_names":["pimbrouwers/falco.openapi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pimbrouwers%2FFalco.OpenApi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pimbrouwers%2FFalco.OpenApi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pimbrouwers%2FFalco.OpenApi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pimbrouwers%2FFalco.OpenApi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pimbrouwers","download_url":"https://codeload.github.com/pimbrouwers/Falco.OpenApi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238053519,"owners_count":19408699,"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":["fsharp","openapi","openapi-generator","openapi-spec","openapi-specification","openapi3"],"created_at":"2024-10-30T07:10:15.673Z","updated_at":"2025-10-25T00:31:08.544Z","avatar_url":"https://github.com/pimbrouwers.png","language":"F#","readme":"# Falco.OpenAPI\n\n[![NuGet Version](https://img.shields.io/nuget/v/Falco.OpenApi.svg)](https://www.nuget.org/packages/Falco.OpenApi)\n[![build](https://github.com/FalcoFramework/Falco.OpenApi/actions/workflows/build.yml/badge.svg)](https://github.com/FalcoFramework/Falco.OpenApi/actions/workflows/build.yml)\n\n```fsharp\nopen Falco\nopen Falco.OpenApi\nopen Falco.Routing\n\nlet endpoints =\n    [\n        get \"/\" (Response.ofPlainText \"Hello World!\")\n            |\u003e OpenApi.name \"HelloWorld\"\n            |\u003e OpenApi.summary \"This is a summary\"\n            |\u003e OpenApi.description \"This is a test description, which is the long form of the summary.\"\n            |\u003e OpenApi.returnType typeof\u003cstring\u003e\n    ]\n```\n\n[Falco.OpenAPI](https://github.com/FalcoFramework/Falco.OpenAPI) is a library for generating OpenAPI documentation for [Falco](https://github.com/FalcoFramework/Falco) applications. It provides a set of combinators for annotating Falco routes with OpenAPI metadata, which can be used to generate OpenAPI documentation.\n\n## Key Features\n\n- Generates OpenAPI 3.0 documentation.\n- Provides a set of combinators for annotating Falco routes with OpenAPI metadata.\n- Generates OpenAPI documentation from metadata associated to Falco routes.\n- Allows for customization of the generated OpenAPI documentation.\n\n## Design Goals\n\n- Minimalistic and easy to use.\n- Explicit, allowing for fine-grained control over the generated OpenAPI documentation.\n- Type-safe and to leverage the type system to prevent common mistakes.\n- Composable, allowing for the generation of complex OpenAPI documentation.\n\n## Getting Started\n\nThis guide assumes you have a [Falco](https://github.com/FalcoFramework/Falco) project setup. If you don't, you can create a new Falco project using the following command:\n\n```shell\n\u003e dotnet new web -lang F# -o HelloWorld\n\u003e cd HelloWorldApp\n```\n\nInstall the nuget package:\n\n```shell\n\u003e dotnet add package Falco\n\u003e dotnet add package Falco.OpenApi\n```\n\nRemove any `*.fs` files created automatically, create a new file named `Program.fs` and set the contents to the following:\n\n```fsharp\nopen Falco\nopen Falco.Routing\nopen Microsoft.AspNetCore.Builder\n\nlet bldr = WebApplication.CreateBuilder()\nlet wapp = bldr.Build()\n\nlet endpoints =\n    [\n        get \"/\" (Response.ofPlainText \"Hello World!\")\n    ]\n\nwapp.UseRouting()\n    .UseFalco(endpoints)\n    .Run()\n```\n\nNow, let's incorporate OpenAPI documentation into our Falco application. Update the `Program.fs` file to the following:\n\n```fsharp\n// ..\n\nlet endpoints =\n    [\n        get \"/\" (Response.ofPlainText \"Hello World!\")\n            |\u003e OpenApi.name \"HelloWorld\"\n            |\u003e OpenApi.summary \"This is a summary\"\n            |\u003e OpenApi.description \"This is a test description, which is the long form of the summary.\"\n            |\u003e OpenApi.returnType typeof\u003cstring\u003e\n    ]\n\n// ..\n```\n\nWhich produces the following OpenAPI documentation:\n\n```json\n{\n  \"openapi\": \"x.x.x\",\n  \"info\": {\n    \"title\": \"HelloWorld\",\n    \"version\": \"1.0\"\n  },\n  \"paths\": {\n    \"/\": {\n      \"get\": {\n        \"tags\": [\n          \"HelloWorld\"\n        ],\n        \"summary\": \"This is a summary\",\n        \"description\": \"This is a test description, which is the long form of the summary\",\n        \"operationId\": \"HelloWorld\",\n        \"responses\": {\n          \"200\": {\n            \"description\": \"OK\",\n            \"content\": {\n              \"text/plain\": {\n                \"schema\": {\n                  \"type\": \"string\"\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  },\n  \"components\": { }\n}\n```\n\n## Specs\n\n### Name (Operation ID)\n\n```fsharp\nopen Falco\nopen Falco.OpenApi\nopen Falco.Routing\n\nlet endpoints =\n    [\n        get \"/\" (Response.ofPlainText \"Hello World!\")\n            |\u003e OpenApi.name \"HelloWorld\"\n    ]\n```\n\n### Summary\n\n```fsharp\nopen Falco\nopen Falco.OpenApi\nopen Falco.Routing\n\nlet endpoints =\n    [\n        get \"/\" (Response.ofPlainText \"Hello World!\")\n            |\u003e OpenApi.summary \"This is a summary\"\n    ]\n```\n\n### Description\n\n```fsharp\nopen Falco\nopen Falco.OpenApi\nopen Falco.Routing\n\nlet endpoints =\n    [\n        get \"/\" (Response.ofPlainText \"Hello World!\")\n            |\u003e OpenApi.description \"This is a description\"\n    ]\n```\n\n### Return Type\n\n```fsharp\nopen Falco\nopen Falco.OpenApi\nopen Falco.Routing\n\nlet endpoints =\n    [\n        get \"/\" (Response.ofPlainText \"Hello World!\")\n            |\u003e OpenApi.returns typeof\u003cstring\u003e\n            // or,\n            // |\u003e OpenApi.returns { Return = typeof\u003cstring\u003e; ContentType = [\"text/plain\"]; Status = 200 }\n    ]\n```\n\n### Route Parameters\n\n```fsharp\nopen Falco\nopen Falco.OpenApi\nopen Falco.Routing\n\nlet endpoints =\n    [\n        mapGet \"/hello/{name?}\"\n            (fun route -\u003e route?name.AsString(\"world\"))\n            Response.ofPlainText\n            |\u003e OpenApi.route [\n                { Type = typeof\u003cstring\u003e; Name = \"name\"; Required = false } ]\n    ]\n```\n\n### Query Parameters\n\n```fsharp\nopen Falco\nopen Falco.OpenApi\nopen Falco.Routing\n\nlet endpoints =\n    [\n        mapGet \"/hello\"\n            (fun route -\u003e\n                let age = route?age.AsInt(0)\n                $\"Hello there, your are {age} years old.\")\n            Response.ofPlainText\n            |\u003e OpenApi.route [\n                { Type = typeof\u003cint\u003e; Name = \"age\"; Required = false } ]\n    ]\n```\n\n### Header Parameters\n\n```fsharp\nopen Falco\nopen Falco.OpenApi\nopen Falco.Routing\n\nlet endpoints =\n    [\n        get \"/\"\n            (fun ctx -\u003e\n                let headers = Request.getHeaders ctx\n                let versionId = headers.GetString \"X-Version-ID\"\n                $\"Hello, you are using version {versionId}\")\n            |\u003e OpenApi.header [\n                { Type = typeof\u003cstring\u003e; Name = \"X-Version-ID\"; Required = true } ]\n    ]\n```\n\n### Tags\n\n```fsharp\nopen Falco\nopen Falco.OpenApi\nopen Falco.Routing\n\nlet endpoints =\n    [\n        get \"/\" (Response.ofPlainText \"Hello World!\")\n            |\u003e OpenApi.tags [\n                \"tag1\"\n                \"tag2\" ]\n    ]\n```\n\n## Find a bug?\n\nThere's an [issue](https://github.com/FalcoFramework/Falco.OpenApi/issues) for that.\n\n## License\n\nLicensed under [Apache License 2.0](https://github.com/FalcoFramework/Falco.OpenApi/blob/master/LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffalcoframework%2FFalco.OpenApi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffalcoframework%2FFalco.OpenApi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffalcoframework%2FFalco.OpenApi/lists"}