Repository navigation
Swagger server from schema? #190
Description
Activity
We had discussion about it few years back #81
It should be possible (just need to choose correct target like Giraffe for example)
I do not think that TP is good tools, I personally believe in bright future of https://github.com/Zaid-Ajaj/Hawaii ;)There are some clear advantages of TP vs any kind of code-generation templates:
-
Code generation will create you a maintenance-problem, as people modify the generated code and then they cannot update the templates when generator updates. Maintenance is always more expensive than writing new code, so you should optimize maintenance, not initial creation.
-
There will be abstraction-level mismatch between higher abstraction generation and lower-abstraction generated code. So you can generate something and then you tweak on lower level. Where as in TP the creator has already went through the thought process of creating correct higher level abstractions and compositions, so that you don't need access to the lower level modifications.
-
Yes TPs are complex machines, but the people contributing to create and fix TPs are also typically very senior level, who can maintain some messy code inside TP, and the end-user-experience is very clean. So the complex messy code is abstracted away from your codebase, and your maintenance. Where as with generators, your next non-senior-hire will cause major damage while not being aware all the dangers of the messy code that the generator templates created.
-
Code generation will create you a maintenance-problem,
What if you do not commit generated code? It should prevent modification of generated code.
The primary cons of TP is speed, number of times IDE call it and all-time schema availability requirement (like DB connection).
What's may go wrong if codegen generate contract/interface that you have to implement in your controllers and you will not commit these files?
If you don't let modifications to the generated code, then that's a compiler, not a code-generator. Which is nice, if possible.
But typically issues are easier to fix to the generated code, and the hard way to fix is to modify the initial template. (Reverse-engineer the source location, etc.)
Quoting (freely) the book "Microsoft .NET - Architecting Applications for the Enterprise":
If you have an easy way to fix issue, and a hard way by framework, what is the correct thing to do? - At that point it doesn't matter anymore, as the framework has already gone wrong not supporting what users try to do with it.
Is there an ongoing effort to do schema to server? Can I attempt to do this? Any lessons you can share before i lose my sanity trying?
github-actions commented
on Apr 11, 2026 on Apr 11, 2026 – with GitHub ActionsContributorMore actions🤖 This is an automated response from Repo Assist.
@Eliemer— to answer your 2023 question: there's currently no active effort within SwaggerProvider itself to generate server-side code.For generating F# server stubs from an OpenAPI schema, here are the best current options:
Code-generation tools (schema → server):
- Kiota (Microsoft) — generates both client and server scaffolding, has F# support in progress
- openapi-generator — supports F# via the
fsharp-functionstemplate (Azure Functions) andfsharp-giraffe-servertemplate (Giraffe) - Hawaii — F#-first, generates idiomatic F# client code; server generation is not its focus but the generated types can be reused
Manual approach:
Use SwaggerProvider to generate the client types (request/response models), then hand-write the Giraffe/Falco/Saturn route handlers that accept those types. This keeps your domain types in sync with the schema without committing generated server code.The maintainer's pointer to discussion #81 is still the best context for the SwaggerProvider team's position on server-side generation.
— Repo Assist
Generated by 🌈 Repo Assist, see workflow run. Learn more.
To install this agentic workflow, run
gh aw add githubnext/agentics/workflows/repo-assist.md@7ee2b60744abf71b985bead4599640f165edcd93- locked and limited conversation to collaborators
on Apr 16, 2026
This might be bit off-topic, but still with Swagger and F#:
Right now OpenApiProvider/SwaggerProvider generates the clients from the schema.
Is there a way to generate a server (/server-template) from the schema?
Any kind of Owin/Katana/.NET WebApi, or something F# specific like Giraffe templates?
Current tools seem to be generating a schema from server, but what about generating a server from schema, is there any tools for that? What is the current best practice?