Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: validate OpenFGA YAML #95

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ See the [DEVELOPMENT](./docs/DEVELOPMENT.md) and [CONTRIBUTING](https://github.c

## Acknowledgments
- CEL Textmate Grammar was taken from [vscode-cel](https://github.com/hmarr/vscode-cel)
- Range conversion from `yaml` to `vscode` from [actions/languageservices](https://github.com/actions/languageservices/blob/4280a967a8aa058dd3c8825349b90bc932d82283/workflow-parser/src/workflows/yaml-object-reader.ts#L220)

## License

Expand Down
2 changes: 1 addition & 1 deletion client/src/extension.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let client: LanguageClient;
export function activate(context: ExtensionContext) {

// Register the server for all document types
const documentSelector = [{ language: "openfga" }, { language: "yaml" }];
const documentSelector = [{ language: "openfga" }, { language: "yaml-store-openfga" }];

// Options to control the language client
const clientOptions: LanguageClientOptions = {
Expand Down
2 changes: 1 addition & 1 deletion client/src/extension.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function activate(context: ExtensionContext) {
// Options to control the language client
const clientOptions: LanguageClientOptions = {
// Register the server for all document types
documentSelector: [{ language: "openfga" }, { language: "yaml" }],
documentSelector: [{ language: "openfga" }, { language: "yaml-store-openfga" }],
synchronize: {
// Notify the server about file changes to '.clientrc files contained in the workspace
fileEvents: workspace.createFileSystemWatcher("**/.clientrc")
Expand Down
21 changes: 18 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@
"CEL",
"cel"
]
},
{
"id": "yaml-store-openfga",
"aliases": [
"YAML (OpenFGA)"
],
"extensions": [
".fga.yaml",
".openfga.yaml"
]
}
],
"snippets": [
Expand Down Expand Up @@ -101,12 +111,17 @@
"path": "./syntaxes/openfga.injection.json",
"scopeName": "openfga-yaml.injection",
"injectTo": [
"source.yaml"
"source.yaml-store-openfga"
],
"embeddedLanguages": {
"meta.embedded.inline.openfga": "openfga"
}
}
},
{
"language": "yaml-store-openfga",
"scopeName": "source.yaml-store-openfga",
"path": "./syntaxes/yaml.tmLanguage.json"
}
],
"themes": [
{
Expand All @@ -132,7 +147,7 @@
},
"activationEvents": [
"onLanguage:openfga",
"onLanguage:yaml"
"onLanguage:yaml-store-openfga"
],
"scripts": {
"vscode:prepublish": "npm run compile",
Expand Down
118 changes: 111 additions & 7 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@
},
"dependencies": {
"@openfga/syntax-transformer": "^0.2.0-beta.4",
"ajv": "^8.12.0",
"vscode-languageserver": "^8.1.0",
"vscode-languageserver-textdocument": "^1.0.11",
"yaml": "^2.3.2"
"yaml": "^2.3.3"
},
"scripts": {}
"scripts": {},
"devDependencies": {
"@types/js-yaml": "^4.0.8"
}
}
Loading