-
Notifications
You must be signed in to change notification settings - Fork 3
MT-20082 Add Organizations API to OpenAPI specs #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,7 +84,90 @@ tags: | |
| x-page-title: Billing | ||
| x-page-description: Billing information | ||
| description: Account Billing | ||
|
|
||
| - name: Organizations | ||
| x-parent: general-api | ||
| x-page-title: Organizations | ||
| x-page-description: Organization Sub Accounts management | ||
| description: Create and manage organization sub accounts | ||
| paths: | ||
| '/api/organizations/{organization_id}/sub_accounts': | ||
| get: | ||
| operationId: getOrganizationSubAccounts | ||
| summary: Get organization sub accounts | ||
| description: Get a list of sub accounts for the specified organization. You must have sub account management permissions for this organization. | ||
| tags: | ||
| - Organizations | ||
| responses: | ||
| '200': | ||
| description: Returns the list of sub accounts belonging to the organization. | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: array | ||
| items: | ||
| $ref: '#/components/schemas/SubAccount' | ||
| example: | ||
| - id: 12345 | ||
| name: Development Team Account | ||
| - id: 12346 | ||
| name: QA Team Account | ||
| '401': | ||
| $ref: '#/components/responses/UNAUTHENTICATED' | ||
| '403': | ||
| $ref: '#/components/responses/PERMISSION_DENIED' | ||
| post: | ||
| operationId: createOrganizationSubAccount | ||
| summary: Create organization sub account | ||
| description: Create a new sub account under the specified organization. You must have sub account management permissions for this organization. | ||
| tags: | ||
| - Organizations | ||
| requestBody: | ||
| required: true | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| required: | ||
| - account | ||
| properties: | ||
| account: | ||
| type: object | ||
| required: | ||
| - name | ||
| properties: | ||
| name: | ||
| type: string | ||
| description: Name of the sub account to create | ||
| example: New Team Account | ||
| responses: | ||
| '200': | ||
| description: Sub account created successfully. | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/SubAccount' | ||
| example: | ||
| id: 12347 | ||
| name: New Team Account | ||
| '400': | ||
| description: Bad request - invalid parameters. | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/ErrorResponse' | ||
| '401': | ||
| $ref: '#/components/responses/UNAUTHENTICATED' | ||
| '403': | ||
| $ref: '#/components/responses/PERMISSION_DENIED' | ||
| '422': | ||
| description: Unprocessable entity - validation errors. | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/UnprocessableEntity' | ||
|
Comment on lines
+119
to
+168
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Add code samples for the POST operation. The POST operation is missing Add Based on coding guidelines: "Include code samples in |
||
| parameters: | ||
| - $ref: '#/components/parameters/organization_id' | ||
| /api/accounts: | ||
| get: | ||
| operationId: getAllAccounts | ||
|
|
@@ -820,6 +903,19 @@ paths: | |
| - $ref: '#/components/parameters/account_id' | ||
| components: | ||
| schemas: | ||
| SubAccount: | ||
| title: SubAccount | ||
| description: Represents a sub account within an organization | ||
| type: object | ||
| properties: | ||
| id: | ||
| type: integer | ||
| example: 12345 | ||
| description: The unique identifier of the sub account | ||
| name: | ||
| type: string | ||
| example: Development Team Account | ||
| description: The name of the sub account | ||
| AccountAccess: | ||
| title: AccountAccess | ||
| description: Assigns resource-specific permissions to a specifier. | ||
|
|
@@ -954,6 +1050,21 @@ components: | |
| type: string | ||
| description: Error message | ||
| example: Incorrect API token | ||
| ErrorResponse: | ||
| title: ErrorResponse | ||
| type: object | ||
| properties: | ||
| errors: | ||
| type: string | ||
| description: Error message | ||
| example: Unexpected error | ||
| UnprocessableEntity: | ||
| title: UnprocessableEntity | ||
| type: object | ||
| properties: | ||
| errors: | ||
| type: object | ||
| description: Validation errors per attribute. Entire record errors are under `base` key. | ||
| securitySchemes: | ||
| HeaderAuth: | ||
| type: apiKey | ||
|
|
@@ -984,6 +1095,16 @@ components: | |
| schema: | ||
| $ref: '#/components/schemas/NotFoundResponse' | ||
| parameters: | ||
| organization_id: | ||
| description: Unique organization ID | ||
| name: organization_id | ||
| in: path | ||
| required: true | ||
| schema: | ||
| type: integer | ||
| format: int64 | ||
| minimum: 1 | ||
| example: 1001 | ||
| account_id: | ||
| description: Unique account ID | ||
| name: account_id | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Add code samples for the GET operation.
The GET operation is missing
x-codeSamples, which are required per coding guidelines. All other operations in this spec include code samples in the priority order: Node.js, PHP, Python, Ruby, .NET, Java, cURL.Add
x-codeSamplesusing the official Mailtrap SDKs with environment variables for API keys (e.g.,process.env.MAILTRAP_API_KEY).Based on coding guidelines: "Include code samples in
x-codeSamplesin this priority order: Node.js, PHP, Python, Ruby, .NET, Java, cURL" and "Use official Mailtrap SDKs for language-specific code samples."🧰 Tools
🪛 Checkov (3.2.334)
[medium] 107-111: Ensure that arrays have a maximum number of items
(CKV_OPENAPI_21)
🤖 Prompt for AI Agents