<@U04UQ68083H> how can I check if my OPL file for ...
# ory-copilot
l
@chilly-king-10285 how can I check if my OPL file for keto is valid?
c
A message from kapa.ai
You can check the syntax of your OPL (Ory Permission Language) file for Keto by using the
checkOplSyntax
API endpoint. Here's how you can do it: 1. Send a
POST
request to the
/opl/syntax/check
endpoint. The OPL file content should be included in the body of the request.
Copy code
json POST /opl/syntax/check Body:  {   'content': {     'text/plain': {       'schema': {         'description': 'Your OPL content here',         'type': 'string'       }     }   },   'x-originalParamName': 'Body' }
2. The response will be a
CheckOPLSyntaxResponse
object. If there are any syntax errors in your OPL file, they will be listed in the
errors
property of the response. Please note that this operation does not require authentication. For more details, you can refer to the [Ory Keto API documentation](https://www.ory.sh/docs/keto/reference/rest-api).
l
@chilly-king-10285 is there a way of doing this with a CLI or must I run a keto HTTP API server?
c
A message from kapa.ai
Yes, you can use the Ory Keto CLI to start a server that serves the HTTP REST and gRPC APIs. You can do this using the
keto serve
command. This command opens the network ports and listens to HTTP and gRPC API requests. Here's how you can do it:
Copy code
bash keto serve
Once the server is running, you can then send your
POST
request to the
/opl/syntax/check
endpoint to check the syntax of your OPL file. For more details, you can refer to the [Ory Keto CLI documentation](https://www.ory.sh/docs/keto/cli/keto-serve#keto-serve).