From cc0da080c6d45f408f87afb6f5495f17090b7fba Mon Sep 17 00:00:00 2001 From: Ingo Oppermann Date: Thu, 15 May 2025 12:17:17 +0200 Subject: [PATCH] Fix omitting empty cleanup rules --- docs/docs.go | 54 ++++++++++++++++++++++++++++++++++++- docs/swagger.json | 54 ++++++++++++++++++++++++++++++++++++- docs/swagger.yaml | 35 +++++++++++++++++++++++- http/api/process.go | 2 +- http/handler/api/process.go | 1 + 5 files changed, 142 insertions(+), 4 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index 9b1452f1..371f0a6b 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -3597,7 +3597,7 @@ const docTemplate = `{ "tags": [ "v16.?.?" ], - "summary": "Add a new process", + "summary": "Probe a process config", "operationId": "process-3-probe-config", "parameters": [ { @@ -3632,6 +3632,58 @@ const docTemplate = `{ } } }, + "/api/v3/process/validate": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "Probe a process to get a detailed stream information on the inputs.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "v16.?.?" + ], + "summary": "Validate a process config", + "operationId": "process-3-validate-config", + "parameters": [ + { + "description": "Process config", + "name": "config", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/api.ProcessConfig" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/api.Probe" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + } + } + }, "/api/v3/process/{id}": { "get": { "security": [ diff --git a/docs/swagger.json b/docs/swagger.json index 88611c5e..7ce79286 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -3590,7 +3590,7 @@ "tags": [ "v16.?.?" ], - "summary": "Add a new process", + "summary": "Probe a process config", "operationId": "process-3-probe-config", "parameters": [ { @@ -3625,6 +3625,58 @@ } } }, + "/api/v3/process/validate": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "Probe a process to get a detailed stream information on the inputs.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "v16.?.?" + ], + "summary": "Validate a process config", + "operationId": "process-3-validate-config", + "parameters": [ + { + "description": "Process config", + "name": "config", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/api.ProcessConfig" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/api.Probe" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.Error" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/api.Error" + } + } + } + } + }, "/api/v3/process/{id}": { "get": { "security": [ diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 95498e94..26785bbe 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -5964,7 +5964,40 @@ paths: $ref: '#/definitions/api.Error' security: - ApiKeyAuth: [] - summary: Add a new process + summary: Probe a process config + tags: + - v16.?.? + /api/v3/process/validate: + post: + consumes: + - application/json + description: Probe a process to get a detailed stream information on the inputs. + operationId: process-3-validate-config + parameters: + - description: Process config + in: body + name: config + required: true + schema: + $ref: '#/definitions/api.ProcessConfig' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/api.Probe' + "400": + description: Bad Request + schema: + $ref: '#/definitions/api.Error' + "403": + description: Forbidden + schema: + $ref: '#/definitions/api.Error' + security: + - ApiKeyAuth: [] + summary: Validate a process config tags: - v16.?.? /api/v3/report/process: diff --git a/http/api/process.go b/http/api/process.go index 2563ebb2..5cfb57bb 100644 --- a/http/api/process.go +++ b/http/api/process.go @@ -144,7 +144,7 @@ type ProcessConfigIO struct { ID string `json:"id"` Address string `json:"address" validate:"required" jsonschema:"minLength=1"` Options []string `json:"options"` - Cleanup []ProcessConfigIOCleanup `json:"cleanup,omitempty"` + Cleanup []ProcessConfigIOCleanup `json:"cleanup"` } type ProcessConfigIOCleanup struct { diff --git a/http/handler/api/process.go b/http/handler/api/process.go index 6ea0b1f7..0deed321 100644 --- a/http/handler/api/process.go +++ b/http/handler/api/process.go @@ -303,6 +303,7 @@ func (h *ProcessHandler) Update(c echo.Context) error { process := api.ProcessConfig{ ID: id, Owner: ctxuser, + Domain: domain, Type: "ffmpeg", Autostart: true, }