Merge pull request #4379 from SierraJC/fix/misc-server-api-fixes
Fix: `/servers` API invalid responses / OpenAPI schema
This commit is contained in:
@@ -567,6 +567,9 @@ class ServersController extends Controller
|
|||||||
['bearerAuth' => []],
|
['bearerAuth' => []],
|
||||||
],
|
],
|
||||||
tags: ['Servers'],
|
tags: ['Servers'],
|
||||||
|
parameters: [
|
||||||
|
new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Server UUID', schema: new OA\Schema(type: 'string')),
|
||||||
|
],
|
||||||
requestBody: new OA\RequestBody(
|
requestBody: new OA\RequestBody(
|
||||||
required: true,
|
required: true,
|
||||||
description: 'Server updated.',
|
description: 'Server updated.',
|
||||||
@@ -596,8 +599,7 @@ class ServersController extends Controller
|
|||||||
new OA\MediaType(
|
new OA\MediaType(
|
||||||
mediaType: 'application/json',
|
mediaType: 'application/json',
|
||||||
schema: new OA\Schema(
|
schema: new OA\Schema(
|
||||||
type: 'array',
|
ref: '#/components/schemas/Server'
|
||||||
items: new OA\Items(ref: '#/components/schemas/Server')
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
@@ -678,9 +680,7 @@ class ServersController extends Controller
|
|||||||
ValidateServer::dispatch($server);
|
ValidateServer::dispatch($server);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json([
|
return response()->json(serializeApiResponse($server))->setStatusCode(201);
|
||||||
|
|
||||||
])->setStatusCode(201);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[OA\Delete(
|
#[OA\Delete(
|
||||||
|
@@ -42,8 +42,7 @@ use Symfony\Component\Yaml\Yaml;
|
|||||||
'validation_logs' => ['type' => 'string', 'description' => 'The validation logs.'],
|
'validation_logs' => ['type' => 'string', 'description' => 'The validation logs.'],
|
||||||
'log_drain_notification_sent' => ['type' => 'boolean', 'description' => 'The flag to indicate if the log drain notification has been sent.'],
|
'log_drain_notification_sent' => ['type' => 'boolean', 'description' => 'The flag to indicate if the log drain notification has been sent.'],
|
||||||
'swarm_cluster' => ['type' => 'string', 'description' => 'The swarm cluster configuration.'],
|
'swarm_cluster' => ['type' => 'string', 'description' => 'The swarm cluster configuration.'],
|
||||||
'delete_unused_volumes' => ['type' => 'boolean', 'description' => 'The flag to indicate if the unused volumes should be deleted.'],
|
'settings' => ['$ref' => '#/components/schemas/ServerSetting'],
|
||||||
'delete_unused_networks' => ['type' => 'boolean', 'description' => 'The flag to indicate if the unused networks should be deleted.'],
|
|
||||||
]
|
]
|
||||||
)]
|
)]
|
||||||
|
|
||||||
@@ -814,7 +813,7 @@ $schema://$host {
|
|||||||
{
|
{
|
||||||
return Attribute::make(
|
return Attribute::make(
|
||||||
get: function ($value) {
|
get: function ($value) {
|
||||||
return preg_replace('/[^0-9]/', '', $value);
|
return (int) preg_replace('/[^0-9]/', '', $value);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -45,6 +45,8 @@ use OpenApi\Attributes as OA;
|
|||||||
'wildcard_domain' => ['type' => 'string'],
|
'wildcard_domain' => ['type' => 'string'],
|
||||||
'created_at' => ['type' => 'string'],
|
'created_at' => ['type' => 'string'],
|
||||||
'updated_at' => ['type' => 'string'],
|
'updated_at' => ['type' => 'string'],
|
||||||
|
'delete_unused_volumes' => ['type' => 'boolean', 'description' => 'The flag to indicate if the unused volumes should be deleted.'],
|
||||||
|
'delete_unused_networks' => ['type' => 'boolean', 'description' => 'The flag to indicate if the unused networks should be deleted.'],
|
||||||
]
|
]
|
||||||
)]
|
)]
|
||||||
class ServerSetting extends Model
|
class ServerSetting extends Model
|
||||||
|
33
openapi.json
33
openapi.json
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"openapi": "3.0.0",
|
"openapi": "3.1.0",
|
||||||
"info": {
|
"info": {
|
||||||
"title": "Coolify",
|
"title": "Coolify",
|
||||||
"version": "0.1"
|
"version": "0.1"
|
||||||
@@ -5391,6 +5391,17 @@
|
|||||||
"summary": "Update",
|
"summary": "Update",
|
||||||
"description": "Update Server.",
|
"description": "Update Server.",
|
||||||
"operationId": "update-server-by-uuid",
|
"operationId": "update-server-by-uuid",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "uuid",
|
||||||
|
"in": "path",
|
||||||
|
"description": "Server UUID",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
"description": "Server updated.",
|
"description": "Server updated.",
|
||||||
"required": true,
|
"required": true,
|
||||||
@@ -5451,13 +5462,10 @@
|
|||||||
"content": {
|
"content": {
|
||||||
"application\/json": {
|
"application\/json": {
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"$ref": "#\/components\/schemas\/Server"
|
"$ref": "#\/components\/schemas\/Server"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"401": {
|
"401": {
|
||||||
"$ref": "#\/components\/responses\/401"
|
"$ref": "#\/components\/responses\/401"
|
||||||
@@ -7441,13 +7449,8 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The swarm cluster configuration."
|
"description": "The swarm cluster configuration."
|
||||||
},
|
},
|
||||||
"delete_unused_volumes": {
|
"settings": {
|
||||||
"type": "boolean",
|
"$ref": "#\/components\/schemas\/ServerSetting"
|
||||||
"description": "The flag to indicate if the unused volumes should be deleted."
|
|
||||||
},
|
|
||||||
"delete_unused_networks": {
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "The flag to indicate if the unused networks should be deleted."
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"type": "object"
|
"type": "object"
|
||||||
@@ -7556,6 +7559,14 @@
|
|||||||
},
|
},
|
||||||
"updated_at": {
|
"updated_at": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"delete_unused_volumes": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "The flag to indicate if the unused volumes should be deleted."
|
||||||
|
},
|
||||||
|
"delete_unused_networks": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "The flag to indicate if the unused networks should be deleted."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
24
openapi.yaml
24
openapi.yaml
@@ -3671,6 +3671,14 @@ paths:
|
|||||||
summary: Update
|
summary: Update
|
||||||
description: 'Update Server.'
|
description: 'Update Server.'
|
||||||
operationId: update-server-by-uuid
|
operationId: update-server-by-uuid
|
||||||
|
parameters:
|
||||||
|
-
|
||||||
|
name: uuid
|
||||||
|
in: path
|
||||||
|
description: 'Server UUID'
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
requestBody:
|
requestBody:
|
||||||
description: 'Server updated.'
|
description: 'Server updated.'
|
||||||
required: true
|
required: true
|
||||||
@@ -3713,8 +3721,6 @@ paths:
|
|||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: '#/components/schemas/Server'
|
$ref: '#/components/schemas/Server'
|
||||||
'401':
|
'401':
|
||||||
$ref: '#/components/responses/401'
|
$ref: '#/components/responses/401'
|
||||||
@@ -4967,12 +4973,8 @@ components:
|
|||||||
swarm_cluster:
|
swarm_cluster:
|
||||||
type: string
|
type: string
|
||||||
description: 'The swarm cluster configuration.'
|
description: 'The swarm cluster configuration.'
|
||||||
delete_unused_volumes:
|
settings:
|
||||||
type: boolean
|
$ref: '#/components/schemas/ServerSetting'
|
||||||
description: 'The flag to indicate if the unused volumes should be deleted.'
|
|
||||||
delete_unused_networks:
|
|
||||||
type: boolean
|
|
||||||
description: 'The flag to indicate if the unused networks should be deleted.'
|
|
||||||
type: object
|
type: object
|
||||||
ServerSetting:
|
ServerSetting:
|
||||||
description: 'Server Settings model'
|
description: 'Server Settings model'
|
||||||
@@ -5045,6 +5047,12 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
updated_at:
|
updated_at:
|
||||||
type: string
|
type: string
|
||||||
|
delete_unused_volumes:
|
||||||
|
type: boolean
|
||||||
|
description: 'The flag to indicate if the unused volumes should be deleted.'
|
||||||
|
delete_unused_networks:
|
||||||
|
type: boolean
|
||||||
|
description: 'The flag to indicate if the unused networks should be deleted.'
|
||||||
type: object
|
type: object
|
||||||
Service:
|
Service:
|
||||||
description: 'Service model'
|
description: 'Service model'
|
||||||
|
Reference in New Issue
Block a user