Merge pull request #5577 from LaurenceJJones/openapi_uuid_definition
enhance: Add missing UUID to openapi spec
This commit is contained in:
		@@ -1610,6 +1610,18 @@ class ApplicationsController extends Controller
 | 
				
			|||||||
            ['bearerAuth' => []],
 | 
					            ['bearerAuth' => []],
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
        tags: ['Applications'],
 | 
					        tags: ['Applications'],
 | 
				
			||||||
 | 
					        parameters: [
 | 
				
			||||||
 | 
					            new OA\Parameter(
 | 
				
			||||||
 | 
					                name: 'uuid',
 | 
				
			||||||
 | 
					                in: 'path',
 | 
				
			||||||
 | 
					                description: 'UUID of the application.',
 | 
				
			||||||
 | 
					                required: true,
 | 
				
			||||||
 | 
					                schema: new OA\Schema(
 | 
				
			||||||
 | 
					                    type: 'string',
 | 
				
			||||||
 | 
					                    format: 'uuid',
 | 
				
			||||||
 | 
					                )
 | 
				
			||||||
 | 
					            ),
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
        requestBody: new OA\RequestBody(
 | 
					        requestBody: new OA\RequestBody(
 | 
				
			||||||
            description: 'Application updated.',
 | 
					            description: 'Application updated.',
 | 
				
			||||||
            required: true,
 | 
					            required: true,
 | 
				
			||||||
@@ -3006,73 +3018,73 @@ class ApplicationsController extends Controller
 | 
				
			|||||||
    //     ]);
 | 
					    //     ]);
 | 
				
			||||||
    // }
 | 
					    // }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
     private function validateDataApplications(Request $request, Server $server)
 | 
					    private function validateDataApplications(Request $request, Server $server)
 | 
				
			||||||
     {
 | 
					    {
 | 
				
			||||||
         $teamId = getTeamIdFromToken();
 | 
					        $teamId = getTeamIdFromToken();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         // Validate ports_mappings
 | 
					        // Validate ports_mappings
 | 
				
			||||||
         if ($request->has('ports_mappings')) {
 | 
					        if ($request->has('ports_mappings')) {
 | 
				
			||||||
             $ports = [];
 | 
					            $ports = [];
 | 
				
			||||||
             foreach (explode(',', $request->ports_mappings) as $portMapping) {
 | 
					            foreach (explode(',', $request->ports_mappings) as $portMapping) {
 | 
				
			||||||
                 $port = explode(':', $portMapping);
 | 
					                $port = explode(':', $portMapping);
 | 
				
			||||||
                 if (in_array($port[0], $ports)) {
 | 
					                if (in_array($port[0], $ports)) {
 | 
				
			||||||
                     return response()->json([
 | 
					                    return response()->json([
 | 
				
			||||||
                         'message' => 'Validation failed.',
 | 
					                        'message' => 'Validation failed.',
 | 
				
			||||||
                         'errors' => [
 | 
					                        'errors' => [
 | 
				
			||||||
                             'ports_mappings' => 'The first number before : should be unique between mappings.',
 | 
					                            'ports_mappings' => 'The first number before : should be unique between mappings.',
 | 
				
			||||||
                         ],
 | 
					                        ],
 | 
				
			||||||
                     ], 422);
 | 
					                    ], 422);
 | 
				
			||||||
                 }
 | 
					                }
 | 
				
			||||||
                 $ports[] = $port[0];
 | 
					                $ports[] = $port[0];
 | 
				
			||||||
             }
 | 
					            }
 | 
				
			||||||
         }
 | 
					        }
 | 
				
			||||||
         // Validate custom_labels
 | 
					        // Validate custom_labels
 | 
				
			||||||
         if ($request->has('custom_labels')) {
 | 
					        if ($request->has('custom_labels')) {
 | 
				
			||||||
             if (! isBase64Encoded($request->custom_labels)) {
 | 
					            if (! isBase64Encoded($request->custom_labels)) {
 | 
				
			||||||
                 return response()->json([
 | 
					                return response()->json([
 | 
				
			||||||
                     'message' => 'Validation failed.',
 | 
					                    'message' => 'Validation failed.',
 | 
				
			||||||
                     'errors' => [
 | 
					                    'errors' => [
 | 
				
			||||||
                         'custom_labels' => 'The custom_labels should be base64 encoded.',
 | 
					                        'custom_labels' => 'The custom_labels should be base64 encoded.',
 | 
				
			||||||
                     ],
 | 
					                    ],
 | 
				
			||||||
                 ], 422);
 | 
					                ], 422);
 | 
				
			||||||
             }
 | 
					            }
 | 
				
			||||||
             $customLabels = base64_decode($request->custom_labels);
 | 
					            $customLabels = base64_decode($request->custom_labels);
 | 
				
			||||||
             if (mb_detect_encoding($customLabels, 'ASCII', true) === false) {
 | 
					            if (mb_detect_encoding($customLabels, 'ASCII', true) === false) {
 | 
				
			||||||
                 return response()->json([
 | 
					                return response()->json([
 | 
				
			||||||
                     'message' => 'Validation failed.',
 | 
					                    'message' => 'Validation failed.',
 | 
				
			||||||
                     'errors' => [
 | 
					                    'errors' => [
 | 
				
			||||||
                         'custom_labels' => 'The custom_labels should be base64 encoded.',
 | 
					                        'custom_labels' => 'The custom_labels should be base64 encoded.',
 | 
				
			||||||
                     ],
 | 
					                    ],
 | 
				
			||||||
                 ], 422);
 | 
					                ], 422);
 | 
				
			||||||
             }
 | 
					            }
 | 
				
			||||||
         }
 | 
					        }
 | 
				
			||||||
         if ($request->has('domains') && $server->isProxyShouldRun()) {
 | 
					        if ($request->has('domains') && $server->isProxyShouldRun()) {
 | 
				
			||||||
             $uuid = $request->uuid;
 | 
					            $uuid = $request->uuid;
 | 
				
			||||||
             $fqdn = $request->domains;
 | 
					            $fqdn = $request->domains;
 | 
				
			||||||
             $fqdn = str($fqdn)->replaceEnd(',', '')->trim();
 | 
					            $fqdn = str($fqdn)->replaceEnd(',', '')->trim();
 | 
				
			||||||
             $fqdn = str($fqdn)->replaceStart(',', '')->trim();
 | 
					            $fqdn = str($fqdn)->replaceStart(',', '')->trim();
 | 
				
			||||||
             $errors = [];
 | 
					            $errors = [];
 | 
				
			||||||
             $fqdn = str($fqdn)->trim()->explode(',')->map(function ($domain) use (&$errors) {
 | 
					            $fqdn = str($fqdn)->trim()->explode(',')->map(function ($domain) use (&$errors) {
 | 
				
			||||||
                 if (filter_var($domain, FILTER_VALIDATE_URL) === false) {
 | 
					                if (filter_var($domain, FILTER_VALIDATE_URL) === false) {
 | 
				
			||||||
                     $errors[] = 'Invalid domain: '.$domain;
 | 
					                    $errors[] = 'Invalid domain: '.$domain;
 | 
				
			||||||
                 }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                 return str($domain)->trim()->lower();
 | 
					                return str($domain)->trim()->lower();
 | 
				
			||||||
             });
 | 
					            });
 | 
				
			||||||
             if (count($errors) > 0) {
 | 
					            if (count($errors) > 0) {
 | 
				
			||||||
                 return response()->json([
 | 
					                return response()->json([
 | 
				
			||||||
                     'message' => 'Validation failed.',
 | 
					                    'message' => 'Validation failed.',
 | 
				
			||||||
                     'errors' => $errors,
 | 
					                    'errors' => $errors,
 | 
				
			||||||
                 ], 422);
 | 
					                ], 422);
 | 
				
			||||||
             }
 | 
					            }
 | 
				
			||||||
             if (checkIfDomainIsAlreadyUsed($fqdn, $teamId, $uuid)) {
 | 
					            if (checkIfDomainIsAlreadyUsed($fqdn, $teamId, $uuid)) {
 | 
				
			||||||
                 return response()->json([
 | 
					                return response()->json([
 | 
				
			||||||
                     'message' => 'Validation failed.',
 | 
					                    'message' => 'Validation failed.',
 | 
				
			||||||
                     'errors' => [
 | 
					                    'errors' => [
 | 
				
			||||||
                         'domains' => 'One of the domain is already used.',
 | 
					                        'domains' => 'One of the domain is already used.',
 | 
				
			||||||
                     ],
 | 
					                    ],
 | 
				
			||||||
                 ], 422);
 | 
					                ], 422);
 | 
				
			||||||
             }
 | 
					            }
 | 
				
			||||||
         }
 | 
					        }
 | 
				
			||||||
     }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -333,6 +333,40 @@ class DeployController extends Controller
 | 
				
			|||||||
            ['bearerAuth' => []],
 | 
					            ['bearerAuth' => []],
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
        tags: ['Deployments'],
 | 
					        tags: ['Deployments'],
 | 
				
			||||||
 | 
					        parameters: [
 | 
				
			||||||
 | 
					            new OA\Parameter(
 | 
				
			||||||
 | 
					                name: 'uuid',
 | 
				
			||||||
 | 
					                in: 'path',
 | 
				
			||||||
 | 
					                description: 'UUID of the application.',
 | 
				
			||||||
 | 
					                required: true,
 | 
				
			||||||
 | 
					                schema: new OA\Schema(
 | 
				
			||||||
 | 
					                    type: 'string',
 | 
				
			||||||
 | 
					                    format: 'uuid',
 | 
				
			||||||
 | 
					                )
 | 
				
			||||||
 | 
					            ),
 | 
				
			||||||
 | 
					            new OA\Parameter(
 | 
				
			||||||
 | 
					                name: 'skip',
 | 
				
			||||||
 | 
					                in: 'query',
 | 
				
			||||||
 | 
					                description: 'Number of records to skip.',
 | 
				
			||||||
 | 
					                required: false,
 | 
				
			||||||
 | 
					                schema: new OA\Schema(
 | 
				
			||||||
 | 
					                    type: 'integer',
 | 
				
			||||||
 | 
					                    minimum: 0,
 | 
				
			||||||
 | 
					                    default: 0,
 | 
				
			||||||
 | 
					                )
 | 
				
			||||||
 | 
					            ),
 | 
				
			||||||
 | 
					            new OA\Parameter(
 | 
				
			||||||
 | 
					                name: 'take',
 | 
				
			||||||
 | 
					                in: 'query',
 | 
				
			||||||
 | 
					                description: 'Number of records to take.',
 | 
				
			||||||
 | 
					                required: false,
 | 
				
			||||||
 | 
					                schema: new OA\Schema(
 | 
				
			||||||
 | 
					                    type: 'integer',
 | 
				
			||||||
 | 
					                    minimum: 1,
 | 
				
			||||||
 | 
					                    default: 10,
 | 
				
			||||||
 | 
					                )
 | 
				
			||||||
 | 
					            ),
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
        responses: [
 | 
					        responses: [
 | 
				
			||||||
            new OA\Response(
 | 
					            new OA\Response(
 | 
				
			||||||
                response: 200,
 | 
					                response: 200,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -267,6 +267,18 @@ class ProjectController extends Controller
 | 
				
			|||||||
            ['bearerAuth' => []],
 | 
					            ['bearerAuth' => []],
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
        tags: ['Projects'],
 | 
					        tags: ['Projects'],
 | 
				
			||||||
 | 
					        parameters: [
 | 
				
			||||||
 | 
					            new OA\Parameter(
 | 
				
			||||||
 | 
					                name: 'uuid',
 | 
				
			||||||
 | 
					                in: 'path',
 | 
				
			||||||
 | 
					                description: 'UUID of the project.',
 | 
				
			||||||
 | 
					                required: true,
 | 
				
			||||||
 | 
					                schema: new OA\Schema(
 | 
				
			||||||
 | 
					                    type: 'string',
 | 
				
			||||||
 | 
					                    format: 'uuid',
 | 
				
			||||||
 | 
					                )
 | 
				
			||||||
 | 
					            ),
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
        requestBody: new OA\RequestBody(
 | 
					        requestBody: new OA\RequestBody(
 | 
				
			||||||
            required: true,
 | 
					            required: true,
 | 
				
			||||||
            description: 'Project updated.',
 | 
					            description: 'Project updated.',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -527,6 +527,18 @@ class ServicesController extends Controller
 | 
				
			|||||||
            ['bearerAuth' => []],
 | 
					            ['bearerAuth' => []],
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
        tags: ['Services'],
 | 
					        tags: ['Services'],
 | 
				
			||||||
 | 
					        parameters: [
 | 
				
			||||||
 | 
					            new OA\Parameter(
 | 
				
			||||||
 | 
					                name: 'uuid',
 | 
				
			||||||
 | 
					                in: 'path',
 | 
				
			||||||
 | 
					                description: 'UUID of the service.',
 | 
				
			||||||
 | 
					                required: true,
 | 
				
			||||||
 | 
					                schema: new OA\Schema(
 | 
				
			||||||
 | 
					                    type: 'string',
 | 
				
			||||||
 | 
					                    format: 'uuid',
 | 
				
			||||||
 | 
					                )
 | 
				
			||||||
 | 
					            ),
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
        requestBody: new OA\RequestBody(
 | 
					        requestBody: new OA\RequestBody(
 | 
				
			||||||
            description: 'Service updated.',
 | 
					            description: 'Service updated.',
 | 
				
			||||||
            required: true,
 | 
					            required: true,
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										66
									
								
								openapi.yaml
									
									
									
									
									
								
							
							
						
						
									
										66
									
								
								openapi.yaml
									
									
									
									
									
								
							@@ -1277,6 +1277,15 @@ paths:
 | 
				
			|||||||
      summary: Update
 | 
					      summary: Update
 | 
				
			||||||
      description: 'Update application by UUID.'
 | 
					      description: 'Update application by UUID.'
 | 
				
			||||||
      operationId: update-application-by-uuid
 | 
					      operationId: update-application-by-uuid
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        -
 | 
				
			||||||
 | 
					          name: uuid
 | 
				
			||||||
 | 
					          in: path
 | 
				
			||||||
 | 
					          description: 'UUID of the application.'
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: string
 | 
				
			||||||
 | 
					            format: uuid
 | 
				
			||||||
      requestBody:
 | 
					      requestBody:
 | 
				
			||||||
        description: 'Application updated.'
 | 
					        description: 'Application updated.'
 | 
				
			||||||
        required: true
 | 
					        required: true
 | 
				
			||||||
@@ -3135,6 +3144,33 @@ paths:
 | 
				
			|||||||
      summary: 'List application deployments'
 | 
					      summary: 'List application deployments'
 | 
				
			||||||
      description: 'List application deployments by using the app uuid'
 | 
					      description: 'List application deployments by using the app uuid'
 | 
				
			||||||
      operationId: list-deployments-by-app-uuid
 | 
					      operationId: list-deployments-by-app-uuid
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        -
 | 
				
			||||||
 | 
					          name: uuid
 | 
				
			||||||
 | 
					          in: path
 | 
				
			||||||
 | 
					          description: 'UUID of the application.'
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: string
 | 
				
			||||||
 | 
					            format: uuid
 | 
				
			||||||
 | 
					        -
 | 
				
			||||||
 | 
					          name: skip
 | 
				
			||||||
 | 
					          in: query
 | 
				
			||||||
 | 
					          description: 'Number of records to skip.'
 | 
				
			||||||
 | 
					          required: false
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: integer
 | 
				
			||||||
 | 
					            default: 0
 | 
				
			||||||
 | 
					            minimum: 0
 | 
				
			||||||
 | 
					        -
 | 
				
			||||||
 | 
					          name: take
 | 
				
			||||||
 | 
					          in: query
 | 
				
			||||||
 | 
					          description: 'Number of records to take.'
 | 
				
			||||||
 | 
					          required: false
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: integer
 | 
				
			||||||
 | 
					            default: 10
 | 
				
			||||||
 | 
					            minimum: 1
 | 
				
			||||||
      responses:
 | 
					      responses:
 | 
				
			||||||
        '200':
 | 
					        '200':
 | 
				
			||||||
          description: 'List application deployments by using the app uuid.'
 | 
					          description: 'List application deployments by using the app uuid.'
 | 
				
			||||||
@@ -3377,6 +3413,15 @@ paths:
 | 
				
			|||||||
      summary: Update
 | 
					      summary: Update
 | 
				
			||||||
      description: 'Update Project.'
 | 
					      description: 'Update Project.'
 | 
				
			||||||
      operationId: update-project-by-uuid
 | 
					      operationId: update-project-by-uuid
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        -
 | 
				
			||||||
 | 
					          name: uuid
 | 
				
			||||||
 | 
					          in: path
 | 
				
			||||||
 | 
					          description: 'UUID of the project.'
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: string
 | 
				
			||||||
 | 
					            format: uuid
 | 
				
			||||||
      requestBody:
 | 
					      requestBody:
 | 
				
			||||||
        description: 'Project updated.'
 | 
					        description: 'Project updated.'
 | 
				
			||||||
        required: true
 | 
					        required: true
 | 
				
			||||||
@@ -3630,6 +3675,14 @@ paths:
 | 
				
			|||||||
          $ref: '#/components/responses/400'
 | 
					          $ref: '#/components/responses/400'
 | 
				
			||||||
        '404':
 | 
					        '404':
 | 
				
			||||||
          description: 'Private Key not found.'
 | 
					          description: 'Private Key not found.'
 | 
				
			||||||
 | 
					        '422':
 | 
				
			||||||
 | 
					          description: 'Private Key is in use and cannot be deleted.'
 | 
				
			||||||
 | 
					          content:
 | 
				
			||||||
 | 
					            application/json:
 | 
				
			||||||
 | 
					              schema:
 | 
				
			||||||
 | 
					                properties:
 | 
				
			||||||
 | 
					                  message: { type: string, example: 'Private Key is in use and cannot be deleted.' }
 | 
				
			||||||
 | 
					                type: object
 | 
				
			||||||
      security:
 | 
					      security:
 | 
				
			||||||
        -
 | 
					        -
 | 
				
			||||||
          bearerAuth: []
 | 
					          bearerAuth: []
 | 
				
			||||||
@@ -4145,6 +4198,15 @@ paths:
 | 
				
			|||||||
      summary: Update
 | 
					      summary: Update
 | 
				
			||||||
      description: 'Update service by UUID.'
 | 
					      description: 'Update service by UUID.'
 | 
				
			||||||
      operationId: update-service-by-uuid
 | 
					      operationId: update-service-by-uuid
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        -
 | 
				
			||||||
 | 
					          name: uuid
 | 
				
			||||||
 | 
					          in: path
 | 
				
			||||||
 | 
					          description: 'UUID of the service.'
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            type: string
 | 
				
			||||||
 | 
					            format: uuid
 | 
				
			||||||
      requestBody:
 | 
					      requestBody:
 | 
				
			||||||
        description: 'Service updated.'
 | 
					        description: 'Service updated.'
 | 
				
			||||||
        required: true
 | 
					        required: true
 | 
				
			||||||
@@ -4769,6 +4831,10 @@ components:
 | 
				
			|||||||
          type: string
 | 
					          type: string
 | 
				
			||||||
          nullable: true
 | 
					          nullable: true
 | 
				
			||||||
          description: 'Ports mappings.'
 | 
					          description: 'Ports mappings.'
 | 
				
			||||||
 | 
					        custom_network_aliases:
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					          nullable: true
 | 
				
			||||||
 | 
					          description: 'Network aliases for Docker container.'
 | 
				
			||||||
        base_directory:
 | 
					        base_directory:
 | 
				
			||||||
          type: string
 | 
					          type: string
 | 
				
			||||||
          description: 'Base directory for all commands.'
 | 
					          description: 'Base directory for all commands.'
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user