HTTP APIs to resolve git merge conflicts in USFM files via considering the parse structure.
Built in rust.
Uses mergiraf and tree-sitter-usfm3.
The /resolve
API endpoint processes three input values (base
, left
, and right
) and returns a conflict resolved result.
POST /resolve
The request should include a JSON payload with the following structure:
On success, the API responds with:
{
"result": "string" // Processed result of the inputs
}
If the conflict resolution failed, you would see regions of conflict marked in the output string.
When API call fails, you may receive an error message or status code.
Here’s how you can send a request using JavaScript's fetch API:
const response = await fetch('/resolve', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ base: value1, left: value2, right: value3 })
});
if (response.ok) {
const data = await response.json();
console.log('Result:', data.result);
} else {
console.error('Error processing request');
}