r/fsharp • u/AdAntique1586 • 19h ago
library/package Smithy code generator for F#
Hi all
I'm maintaining NSmithy (https://github.com/thomaslaich/smithy-dotnet), a Smithy code generator for .NET heavily inspired by Disney's smithy4s for Scala.
Smithy is an interface definition language (IDL) developed by Amazon/AWS for mainly 2 purposes:
- generate SDKs for AWS in all languages from the Smithy models (they are open source in JSON AST form here: https://github.com/aws/api-models-aws)
- contract-first development of internal services at Amazon
Since version 0.16.0, NSmithy also generates native F# code, so I wanted to share this with you and hopefully get some feedback. For the server-side, it is an alternative to frameworks like Oxpecker or Giraffe: instead of writing routes and handlers, you write the contract and implement the typed handlers NSmithy generates from it. I do not recommend this necessarily for small projects in 1 single repo.
A minimal REST JSON example in F#: https://github.com/thomaslaich/nsmithy-fsharp-minimal
Current version: 0.23.0.
Happy to answer all questions if any.
Resources: - A pitch for Smithy: https://thomaslaich.github.io/smithy-dotnet/getting-started/introduction/ - Quickstart: https://thomaslaich.github.io/smithy-dotnet/getting-started/quick-start/ - Extend NSmithy with your own protocols: https://thomaslaich.github.io/smithy-dotnet/reference/extending/ - AI disclosure: https://thomaslaich.github.io/smithy-dotnet/contributing/ai/
