This repository contains the code generator to generate F# source (.fs files) from Protobuf v3 schema.
The general concepts are as follows:
- Code generation, to generate F# source code, rather than types being injected as a type provider.
- Idiomatic F# code is generated rather than simple .NET 1.1 era code. This means records, discriminated unions, etc., are generated where appropriate.
In a .NET Sdk library project, add the following packages
<PackageReference Include="Falanx.Proto.Codec.Binary" Version="0.5.*" />
<PackageReference Include="Falanx.Proto.Codec.Json" Version="0.5.*" />
<PackageReference Include="Falanx.Sdk" Version="0.5.*" PrivateAssets="All" />It's possibile to use only one of Falanx.Proto.Codec.Binary and Falanx.Proto.Codec.Json or both, the generated code will depends on the packages referenced
Now specify the .proto file path like
<ItemGroup>
<ProtoFile Include="..\proto\bundle.proto" />
</ItemGroup>and an auto generated file will be created on build
More info in example-sdk/README.md
Install the .NET template for an example library sample
dotnet new -i Falanx.Templates
dotnet new falanx
use --codec argument to specify the codecs (values json,binary,all)
It's possibile to use falanx as command line .NET global tool
dotnet tool install -g Falanx.Tool
falanx --help
To generate a .fs file for a specified .proto file:
falanx --inputfile test\examples\schemas\bundle.proto --defaultnamespace test --outputfile bundle.fs
More info in example\README.md
More info in docs/developer_guide.md
Use the src/Falanx.sln solution for development, or directly the projects with .NET Core Sdk (dotnet).
Projects:
src/Falanx.Toolthe falanx console app, run withdotnet runtest/Falanx.Teststhe unit test, run withdotnet runtest/Falanx.IntegrationTeststhe integration tests, run withdotnet run
As shortcuts, from root:
dotnet buildto build the falanx executableFalanx.Tool.dotnet packto generate packages inbin/nupksdotnet test -v nto run tests
From root
dotnet pack
The nupkgs will be in bin/nupkg
To specify a version pass the Version property like /p:Version=0.1.0-alpha7
Falanx uses:
Type Provider SDKcommon type for quotation and AST supportFsAstuntyped F# AST to code via the code formatter FantomasFrotoprotobuf parser and binary serializerFantomascode formatter and linter
This repository is actively monitored by Jet Engineers and the Jet Security team. Please monitor this repo for security updates and advisories. For more information and contacts, please see SECURITY