Package Exports
- @openfga/syntax-transformer
- @openfga/syntax-transformer/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@openfga/syntax-transformer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
OpenFGA Language
ANTLR Grammar for the OpenFGA DSL and parser from and to the OpenFGA JSON Syntax
Table of Contents
About
OpenFGA is an open source Fine-Grained Authorization solution inspired by Google's Zanzibar paper. It was created by the FGA team at Auth0 based on Auth0 Fine-Grained Authorization (FGA), available under a permissive license (Apache-2) and welcomes community contributions.
OpenFGA is designed to make it easy for application builders to model their permission layer, and to add and integrate fine-grained authorization into their applications. OpenFGA’s design is optimized for reliability and low latency at a high scale.
Resources
- OpenFGA Documentation
- OpenFGA API Documentation
- OpenFGA Discord Community
- Zanzibar Academy
- Google's Zanzibar Paper (2019)
About This Repo
This repo contains everything needed to interact with the OpenFGA Authorization Models schema versions 1.1+, in multiple languages (currently, Go and JS are supported).
Feature | Implemented in ANTLR |
---|---|
Basic DSL | ✅ |
Nesting | ❌ (planned) |
Conditions | ❌ (planned) |
Feature | Go | JS |
---|---|---|
Transformer from the DSL to JSON and from JSON to DSL | ✅ | ✅ |
Syntactic Model Validations | ✅ | ✅ |
Semantic Model Validations | ❌ (planned) | ✅ |
Graphing & Utility Methods | ❌ (planned) | ❌ (planned) |
Installation
Go
go get github.com/openfga/language/pkg/go
Node
npm install @openfga/syntax-transformer@v0.2.0-language
Usage
Transformer
Go
import "github.com/openfga/language/pkg/go/transformer"
dslString := `model
schema 1.1
type user
type folder
relations
define viewer: [user]`
// Transform from DSL to a JSON string
jsonStringModel, err := transformer.TransformDSLToJSON(dslString)
// Transform from a JSON string to DSL
dslString, err = transformer.TransformJSONStringToDSL(jsonStringModel)
Node
import { transformer } from "@openfga/syntax-transformer"
let dslString = `model
schema 1.1
type user
type folder
relations
define viewer: [user]`;
// Transform from DSL to a JSON string
const jsonStringModel = transformer.transformDSLToJSON(dslString)
// Transform from a JSON string to DSL
dslString = transformer.transformJSONStringToDSL(jsonString)
CLI
Use the FGA CLI
Community Parsers
Repo | License | Maintainers | Language | Schema v1.0 | Schema v1.1 | Package Managers | Other Links |
---|---|---|---|---|---|---|---|
openfga language (syntax-transformer) | Apache-2.0 | @openfga | ANTLR (Go and Typescript implementations) | <0.1.5 | Yes (v0.0.8+) | ||
openfga-dsl-parser | Apache-2.0 | @maxmindlin - @dblclik | Rust | Yes | No | WASM - Python | |
openfga-rs | Apache-2.0 | @iammathew | Rust | Yes | No | ||
openfga-dsl-parser | Apache-2.0 | @craigpastro | ANTLR & Go | Yes | Partial (requires self). Supports nesting |
Community Wrapper
Repo | License | Maintainers | Language | Schema v1.0 | Schema v1.1 | Package Managers | Other Links |
---|---|---|---|---|---|---|---|
fga cli | Apache-2.0 | @openfga | Go | No | Yes | ||
fga-transformer-cli | MIT | @ozee-io | Javascript | Yes | Yes |
Contributing
See CONTRIBUTING.
Author
License
This project is licensed under the Apache-2.0 license. See the LICENSE file for more info.