The create endpoint expects a POST request with a JSON body that contains at minimum a ruleType.
An example request body might look like:
{
"ruleType": "regex",
"pattern": "/example/",
"description": "A perfectly fine word"
}
The update endpoint expects a POST request with a JSON body that contains at minimum an id.
An example request body might look like:
{
"pattern": "/embiggens/",
"id": 53
}
The validation rules are pretty sparse currently - for create the only custom validation is checking that the ruleType is one of "regex", "languageToolXML" or "languageToolCore".
N.b. The rules displayed in the rule-manager UI will not be updated currently as a result of your changes to the rules in the DB - they're only updated by re-ingesting the Google Sheet.
How to test
Automated tests:
Run the application from the project root with ./script/start
In another tab, run sbt from the project root
Use the rule-manager project with project ruleManager in the sbt shell
Run the tests with test
Do all the tests pass?
Manual testing:
You may want to do some testing of the endpoints using something like Postman. I found I needed to grab some cookies from the browser in order to be validated, specifically PLAY_SESSION, guToolsAuth and gutoolsAuth-assym.
I used application/json as the Content-Type header with the json listed at the top of this page as the request body.
What does this change?
This PR adds endpoints for creating and editing rules in the rule manager.
The endpoints are:
/create
e.g. https://manager.typerighter.local.dev-gutools.co.uk/create/update
e.g. https://manager.typerighter.local.dev-gutools.co.uk/updateThe
create
endpoint expects a POST request with a JSON body that contains at minimum a ruleType.An example request body might look like:
The
update
endpoint expects a POST request with a JSON body that contains at minimum anid
.An example request body might look like:
The validation rules are pretty sparse currently - for
create
the only custom validation is checking that the ruleType is one of "regex", "languageToolXML" or "languageToolCore".N.b. The rules displayed in the rule-manager UI will not be updated currently as a result of your changes to the rules in the DB - they're only updated by re-ingesting the Google Sheet.
How to test
Automated tests:
./script/start
sbt
from the project rootrule-manager
project withproject ruleManager
in the sbt shelltest
Do all the tests pass?Manual testing:
You may want to do some testing of the endpoints using something like
Postman
. I found I needed to grab some cookies from the browser in order to be validated, specificallyPLAY_SESSION
,guToolsAuth
andgutoolsAuth-assym
.I used
application/json
as theContent-Type
header with the json listed at the top of this page as the request body.