https://github.com/jet/falanx
Generates F# code from protobuf schema for binary and json format
https://github.com/jet/falanx
codegenerator fsharp proto3 protobuf
Last synced: 14 days ago
JSON representation
Generates F# code from protobuf schema for binary and json format
- Host: GitHub
- URL: https://github.com/jet/falanx
- Owner: jet
- License: other
- Created: 2018-09-11T15:11:49.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-10-17T17:08:46.000Z (over 3 years ago)
- Last Synced: 2025-04-08T15:51:12.894Z (21 days ago)
- Topics: codegenerator, fsharp, proto3, protobuf
- Language: F#
- Homepage:
- Size: 617 KB
- Stars: 143
- Watchers: 22
- Forks: 26
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: code_of_conduct.md
- Security: security.md
Awesome Lists containing this project
README
[](https://dev.azure.com/jet-opensource/opensource/_build/latest?definitionId=8?branchName=master)
[](https://www.nuget.org/packages/Falanx.Tool/)# Falanx code generation
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.## How to use
In a .NET Sdk library project, add the following packages
```xml
```
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
```xml
```and an auto generated file will be created on build
More info in [example-sdk/README.md](example-sdk/README.md)
### Template
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`)
### Tool
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](example/README.md)
## How to build Falanx
More info in [docs/developer_guide.md](docs/developer_guide.md)
Use the `src/Falanx.sln` solution for development, or directly the projects with .NET Core Sdk (`dotnet`).
Projects:
- `src/Falanx.Tool` the falanx console app, run with `dotnet run`
- `test/Falanx.Tests` the unit test, run with `dotnet run`
- `test/Falanx.IntegrationTests` the integration tests, run with `dotnet run`As shortcuts, from root:
- `dotnet build` to build the falanx executable `Falanx.Tool`.
- `dotnet pack` to generate packages in `bin/nupks`
- `dotnet test -v n` to run tests### To build packages
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`
### Info
Falanx uses:
- `Type Provider SDK` common type for quotation and AST support
- `FsAst` untyped F# AST to code via the code formatter Fantomas
- `Froto` protobuf parser and binary serializer
- `Fantomas` code formatter and linter## Security
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](security.md)