This directory contains the OpenAPI 3.0 specification for hoist-core's HTTP API, covering all controller endpoints provided by the framework plugin.
| File | Purpose |
|---|---|
openapi.yaml |
The OpenAPI 3.0.3 spec β 122 paths across 30 tags |
validate-openapi.sh |
Shell wrapper to run validation |
validate-openapi.py |
Python validation script β cross-references spec against controller source |
Serve the spec with any Swagger UI instance:
# Quick local viewer via Docker
docker run -p 8080:8080 -e SWAGGER_JSON=/spec/openapi.yaml \
-v $(pwd)/openapi:/spec swaggerapi/swagger-ui
# Or use the online editor at https://editor.swagger.io
# (paste/upload openapi.yaml)The spec can be used with standard OpenAPI tooling:
# Generate a mock server with Prism
npx @stoplight/prism-cli mock openapi/openapi.yaml
# Generate client SDKs with openapi-generator
npx @openapitools/openapi-generator-cli generate \
-i openapi/openapi.yaml -g typescript-fetch -o generated/clientnpx @redocly/cli preview-docs openapi/openapi.yamlRun the validation script to verify the spec matches the current codebase:
# From project root
./openapi/validate-openapi.sh
# Or directly
python3 openapi/validate-openapi.py /path/to/hoist-coreThe script checks:
- YAML syntax β ensures the file parses correctly
- Endpoint coverage β scans every
*Controller.groovyfile, extracts public actions, and verifies each has a corresponding path entry in the spec - Schema validation (optional) β suggests running
@redocly/cli lintfor full OpenAPI 3.0 schema compliance
For full schema validation, install one of:
npm install -g @redocly/cli # Recommended
npm install -g swagger-cli # AlternativeWhen adding or modifying controller endpoints in hoist-core:
-
Add the endpoint to the appropriate section in
openapi.yaml:- Core endpoints (XhController, XhViewController) β top of paths section
- Admin REST CRUD (extends AdminRestController) β "ADMIN REST CRUD" section
- Admin non-REST β "ADMIN NON-REST ENDPOINTS" section
- Cluster admin β "ADMIN CLUSTER ENDPOINTS" section
-
Follow the existing patterns:
- Use the correct tag from the
tagslist - Include
operationIdas{controllerUrlName}.{action} - Document parameters, request body, and response schema
- Note required roles in the
descriptionfield
- Use the correct tag from the
-
Run validation:
./openapi/validate-openapi.sh
If the controller extends AdminRestController, add 8 path entries following the pattern
of existing REST controllers:
GET /rest/{name}β read (list)GET /rest/{name}/{id}β read (single)POST /rest/{name}β createPUT /rest/{name}β updateDELETE /rest/{name}/{id}β deletePOST /rest/{name}/bulkUpdateβ bulk updatePOST /rest/{name}/bulkDeleteβ bulk deleteGET /rest/{name}/lookupDataβ lookup data
Add the schema to components.schemas in the spec, following existing examples
(e.g., AppConfig, Monitor, Preference).
- Tags: Group endpoints by feature area. Use
Admin:prefix for admin endpoints. - Operation IDs:
{controllerUrlName}.{actionName}(e.g.,configAdmin.read) - Roles: Document required roles in endpoint descriptions, not in the schema itself (since roles are enforced server-side and may vary by deployment).
- Response schemas: Use
$refto domain model schemas where possible. Use inlinetype: objectfor dynamic/app-specific response shapes.
| Category | Controllers | Endpoints |
|---|---|---|
| Core (XhController) | 1 | 27 |
| Views (XhViewController) | 1 | 7 |
| Proxy | 1 | 1 |
| Admin REST CRUD | 6 | 48 |
| Admin Non-REST | 10 | 25 |
| Admin Cluster | 7 | 16 |
| Total | 26 | 122 |