Documentation
¶
Index ¶
- func DefaultEndpointToolName(entityName, method, path string) string
- func EndpointInputSchema(ep entity.Endpoint) map[string]any
- func EndpointOutputSchema(ep entity.Endpoint) map[string]any
- func EntityEndpointPath(ent *entity.Entity, path string) string
- func EntityOpenAPI(registry entity.Registry, title, version string, basePath ...string) *openapi.Spec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultEndpointToolName ¶
DefaultEndpointToolName synthesises an MCP tool name from an entity + method + path triple. Used as a fallback when an Endpoint doesn't supply an explicit MCPName.
func EndpointInputSchema ¶ added in v0.3.3
EndpointInputSchema returns the JSON-Schema object describing an endpoint's request body. When ep.InputSchema is set it is converted via the same FieldsToSchema machinery the entity CRUD body uses; otherwise the historical {type:object} fallback is returned. This is the single source the OpenAPI requestBody and the generated MCP tool input schema both consume.
func EndpointOutputSchema ¶ added in v0.3.3
EndpointOutputSchema returns the JSON-Schema object describing an endpoint's success (200) response body, falling back to {type:object} when ep.OutputSchema is unset.
func EntityEndpointPath ¶
EntityEndpointPath builds the absolute URL path for a custom Endpoint declared on an entity. Relative paths are joined under the entity's table; absolute paths pass through. ":id"-style params are converted to "{id}".
func EntityOpenAPI ¶
func EntityOpenAPI(registry entity.Registry, title, version string, basePath ...string) *openapi.Spec
EntityOpenAPI generates a full OpenAPI Spec from all registered entities. It produces:
- Schema components for each entity with typed fields
- CRUD paths (GET, POST, PUT, DELETE) with request/response schemas
- List endpoint with pagination parameters
- Proper error response schemas
EntityOpenAPI builds the spec for every registered entity. An optional basePath (e.g. "/api", from AppConfig.APIPrefix) is expressed as the server URL so the documented paths match where the routes actually mount — the per-path keys stay relative (e.g. "/posts"), and clients prepend the server.
Types ¶
This section is empty.