π API Documentation SystemΒΆ
π― OverviewΒΆ
The API Documentation System automatically generates comprehensive OpenAPI/Swagger documentation for all Continuum APIs. Every time a collection is created or modified, the documentation is automatically updated, providing an always-current, interactive API reference.
π PurposeΒΆ
The API Documentation System provides: - Automatic Generation: OpenAPI 3.0 specifications generated from schema - Interactive Interface: Swagger UI for testing APIs directly - Real-Time Updates: Documentation syncs with schema changes - Per-Collection Docs: Separate documentation for each collection - API Discovery: Browse all available endpoints and schemas
ποΈ ArchitectureΒΆ
graph TB
Schema[Collection Schema]
subgraph "Documentation Generator"
Analyzer[Schema Analyzer]
OpenAPIGen[OpenAPI Generator]
SwaggerUI[Swagger UI]
end
subgraph "Documentation Endpoints"
GetURLs[Get URLs Endpoint]
GetSpec[Get Specification]
CoreDocs[Core API Docs]
CollectionDocs[Collection Docs]
end
subgraph "Outputs"
Interactive[Interactive UI]
JSONSpec[JSON Specification]
YAMLSpec[YAML Specification]
end
Schema --> Analyzer
Analyzer --> OpenAPIGen
OpenAPIGen --> GetURLs
OpenAPIGen --> GetSpec
OpenAPIGen --> CoreDocs
OpenAPIGen --> CollectionDocs
GetSpec --> SwaggerUI
SwaggerUI --> Interactive
GetSpec --> JSONSpec
GetSpec --> YAMLSpec
classDef generator fill:#e3f2fd,stroke:#1565c0,stroke-width:2px
classDef endpoint fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef output fill:#e8f5e8,stroke:#2e7d32,stroke-width:2px
class Analyzer,OpenAPIGen,SwaggerUI generator
class GetURLs,GetSpec,CoreDocs,CollectionDocs endpoint
class Interactive,JSONSpec,YAMLSpec output π Accessing DocumentationΒΆ
π Interactive Swagger UIΒΆ
Access the interactive documentation at:
Features: - β Browse all available endpoints - β View request/response schemas - β Test APIs directly from browser - β See example requests and responses - β View authentication requirements
π‘ API EndpointsΒΆ
Get Available Documentation URLsΒΆ
Response:
{
"data": [
{
"name": "Core API",
"url": "/api/swagger:get?ns=core"
},
{
"name": "Collections API",
"url": "/api/swagger:get?ns=collections"
},
{
"name": "Articles Collection",
"url": "/api/swagger:get?ns=collections/articles"
},
{
"name": "Users Collection",
"url": "/api/swagger:get?ns=collections/users"
}
]
}
Get Complete DocumentationΒΆ
Returns complete OpenAPI 3.0 specification for all APIs.
Get Core API DocumentationΒΆ
Returns documentation for core system APIs (collections, fields, applications, etc.).
Get Collection-Specific DocumentationΒΆ
Returns documentation for a specific collection's CRUD APIs.
π OpenAPI SpecificationΒΆ
ποΈ Generated StructureΒΆ
openapi: 3.0.0
info:
title: Continuum API
version: 1.0.0
description: API documentation for Continuum MAAAS platform
servers:
- url: https://your-domain.com/api
description: Production server
security:
- BearerAuth: []
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
# Auto-generated from collections
Article:
type: object
properties:
id:
type: integer
title:
type: string
content:
type: string
# ... more fields
# List response wrapper
ArticleListResponse:
type: object
properties:
data:
type: object
properties:
count:
type: integer
rows:
type: array
items:
$ref: '#/components/schemas/Article'
paths:
/articles:list:
get:
summary: List articles
tags:
- Articles
parameters:
- $ref: '#/components/parameters/Page'
- $ref: '#/components/parameters/PageSize'
- $ref: '#/components/parameters/Sort'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/ArticleListResponse'
π Schema ComponentsΒΆ
Each collection automatically generates:
1οΈβ£ Model SchemaΒΆ
{
"Article": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "Unique identifier"
},
"title": {
"type": "string",
"description": "Article title"
},
"status": {
"type": "string",
"enum": ["draft", "published", "archived"],
"default": "draft"
},
"author": {
"$ref": "#/components/schemas/User"
}
},
"required": ["title"]
}
}
2οΈβ£ Request/Response SchemasΒΆ
{
"ArticleCreateRequest": {
"type": "object",
"properties": {
"title": {"type": "string"},
"content": {"type": "string"}
}
},
"ArticleResponse": {
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/Article"
}
}
}
}
3οΈβ£ Relationship SchemasΒΆ
{
"ArticleWithRelations": {
"allOf": [
{"$ref": "#/components/schemas/Article"},
{
"type": "object",
"properties": {
"author": {
"$ref": "#/components/schemas/User"
},
"comments": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Comment"
}
}
}
}
]
}
}
π― Using Swagger UIΒΆ
π Testing APIsΒΆ
-
Navigate to Swagger UI:
https://your-domain.com/admin/settings/api-doc/documentation -
Authorize:
- Click "Authorize" button
- Enter your API key:
Bearer {your-api-key} -
Click "Authorize" then "Close"
-
Select Endpoint:
- Browse collections on left sidebar
-
Click on the endpoint you want to test
-
Try It Out:
- Click "Try it out" button
- Fill in parameters and request body
-
Click "Execute"
-
View Results:
- See actual request sent
- View response code and body
- Check response headers
π Example WorkflowΒΆ
Testing Article Creation:
- Find
POST /articles:createendpoint - Click "Try it out"
- Enter request body:
- Click "Execute"
- View response:
π§ Customizing DocumentationΒΆ
π Collection DescriptionsΒΆ
Add descriptions when creating collections:
POST /api/collections:create
X-App: main
Content-Type: application/json
{
"name": "articles",
"title": "Articles",
"description": "Blog articles and content pieces",
"fields": [...]
}
Appears in Swagger UI as collection description.
π·οΈ Field DescriptionsΒΆ
Add descriptions to fields:
POST /api/fields:create
X-App: main
Content-Type: application/json
{
"collectionName": "articles",
"name": "title",
"type": "string",
"description": "The main title of the article"
}
π UI Schema HintsΒΆ
Provide UI hints for better documentation:
{
"name": "status",
"type": "string",
"uiSchema": {
"title": "Publication Status",
"enum": [
{"label": "Draft", "value": "draft"},
{"label": "Published", "value": "published"},
{"label": "Archived", "value": "archived"}
]
}
}
π Documentation FeaturesΒΆ
π Search FunctionalityΒΆ
Swagger UI includes built-in search: - Search by endpoint path - Search by tag/collection name - Search within descriptions
π·οΈ Tagging & OrganizationΒΆ
Endpoints are automatically organized by: - Collection Name: All endpoints for a collection grouped together - Operation Type: Create, Read, Update, Delete - Resource Type: Core APIs vs Collection APIs
π ExamplesΒΆ
Auto-generated examples include: - Request Examples: Sample JSON for create/update operations - Response Examples: Expected response structures - Parameter Examples: Valid query parameter values - Error Examples: Common error responses
π Relationship DocumentationΒΆ
Relationship endpoints are fully documented:
/articles/{id}/comments:list:
get:
summary: List comments for an article
parameters:
- name: id
in: path
required: true
schema:
type: integer
responses:
'200':
description: Success
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Comment'
π‘ Best PracticesΒΆ
π Documentation QualityΒΆ
DO: - β Add clear descriptions to collections - β Document field purposes - β Provide example values - β Keep documentation in sync with schema - β Use consistent terminology
DON'T: - β Leave descriptions empty - β Use technical jargon without explanation - β Forget to update after schema changes - β Skip documenting relationships
π― API DesignΒΆ
DO: - β Design consistent endpoint patterns - β Use descriptive collection names - β Follow REST conventions - β Provide clear error messages - β Version your APIs
DON'T: - β Create overly complex endpoints - β Use inconsistent naming - β Expose internal implementation details - β Skip input validation
π External Tools IntegrationΒΆ
π¦ PostmanΒΆ
Import OpenAPI specification into Postman:
-
Get Specification:
-
Import to Postman:
- Open Postman
- File β Import
- Select
continuum-api.json - All endpoints imported as collection
π§ InsomniaΒΆ
Similar process for Insomnia REST client:
- Export OpenAPI spec
- Import β From File
- Select exported JSON/YAML
π» Code GenerationΒΆ
Use OpenAPI generators to create client SDKs:
# Generate TypeScript SDK
openapi-generator-cli generate \
-i continuum-api.json \
-g typescript-fetch \
-o ./generated-sdk
# Generate Python SDK
openapi-generator-cli generate \
-i continuum-api.json \
-g python \
-o ./generated-sdk
π Related DocumentationΒΆ
- API Gateway: Overall API architecture
- Collection Manager: Schema that drives documentation
- Authentication: Security schemes in documentation
- Best Practices: API design guidelines
Note: The auto-generated documentation ensures that your API reference is always accurate and up-to-date with minimal effort.