External collector and formatter plugins communicate with api-master via stdin/stdout using newline-delimited JSON.
Collectors can optionally support the --supported-languages flag to report their capabilities:
./my-collector --supported-languagesExpected output (JSON array of strings):
["java", "kotlin"]If the flag is not supported or fails, the method returns nil.
api-master writes a single JSON object representing CollectContext:
{
"sourceDir": "/path/to/project",
"frameworks": ["spring-mvc"],
"config": {
"key": "value"
}
}The plugin writes a JSON array of ApiEndpoint objects:
[
{
"name": "Get User",
"folder": "Users",
"path": "/users/{id}",
"method": "GET",
"protocol": "http",
"parameters": [
{ "name": "id", "in": "path", "type": "text", "required": true }
]
}
]An empty result is [].
0— success- non-zero — failure; write a human-readable error message to stderr
Formatters can optionally support the --supported-formats flag to report their capabilities:
./my-formatter --supported-formatsExpected output (JSON array of strings):
["markdown", "json", "yaml"]If the flag is not supported or fails, the method returns nil.
api-master writes a single JSON envelope:
{
"endpoints": [ /* []ApiEndpoint */ ],
"options": {
"format": "simple",
"config": {}
}
}The plugin writes the raw formatted bytes (Markdown text, JSON, etc.) directly to stdout. No JSON wrapping.
0— success- non-zero — failure; write a human-readable error message to stderr
See api-model.md for the full field reference.
# Test a collector plugin
echo '{"sourceDir":"/path/to/project"}' | ./my-collector-binary
# Test a formatter plugin
echo '{"endpoints":[],"options":{"format":"simple"}}' | ./my-formatter-binary