Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions apps/docs/api-reference/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,92 @@
}
},
"/v1/campaigns": {
"get": {
"parameters": [
{
"schema": { "type": "string", "default": "1", "example": "1" },
"required": false,
Comment on lines +1712 to +1714
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong type for page

page is documented as a string ({"type":"string","default":"1"}), but it represents a page number. This will generate incorrect client types and allows non-numeric values. It should be an integer (optionally with minimum: 1) and defaults/examples should be numeric.

Suggested change
{
"schema": { "type": "string", "default": "1", "example": "1" },
"required": false,
"schema": { "type": "integer", "minimum": 1, "default": 1, "example": 1 },

"name": "page",
"in": "query",
"description": "Page number for pagination (default: 1)"
},
{
"schema": {
"type": "string",
"enum": [
"DRAFT",
"SCHEDULED",
"IN_PROGRESS",
"PAUSED",
"COMPLETED",
"CANCELLED"
],
"example": "DRAFT"
},
"required": false,
"name": "status",
"in": "query",
"description": "Filter campaigns by status"
},
{
"schema": { "type": "string", "example": "newsletter" },
"required": false,
"name": "search",
"in": "query",
"description": "Search campaigns by name or subject"
}
],
"responses": {
"200": {
"description": "Get list of campaigns",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"campaigns": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": { "type": "string" },
"name": { "type": "string" },
"from": { "type": "string" },
"subject": { "type": "string" },
"createdAt": { "type": "string", "format": "date-time" },
"updatedAt": { "type": "string", "format": "date-time" },
"status": { "type": "string" },
"scheduledAt": { "type": "string", "nullable": true, "format": "date-time" },
"total": { "type": "integer" },
Comment on lines +1764 to +1766
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enum missing for status

In the 200 response schema, each campaign’s status is currently just {"type":"string"}. Since you already define the allowed values in the status query param, leaving the response unconstrained will produce weaker/incorrect generated types and inconsistent docs. Consider adding the same enum to the response field.

Suggested change
"status": { "type": "string" },
"scheduledAt": { "type": "string", "nullable": true, "format": "date-time" },
"total": { "type": "integer" },
"status": { "type": "string", "enum": ["DRAFT","SCHEDULED","IN_PROGRESS","PAUSED","COMPLETED","CANCELLED"] },

"sent": { "type": "integer" },
"delivered": { "type": "integer" },
"unsubscribed": { "type": "integer" }
},
"required": [
"id",
"name",
"from",
"subject",
"createdAt",
"updatedAt",
"status",
"scheduledAt",
"total",
"sent",
"delivered",
"unsubscribed"
]
}
},
"totalPage": { "type": "integer" }
},
"required": ["campaigns", "totalPage"]
}
}
}
}
}
},
"post": {
"requestBody": {
"required": true,
Expand Down