From cd9bb1737007ca6352b877762c98ccc709f9db3c Mon Sep 17 00:00:00 2001 From: Quaternions Date: Sat, 14 Dec 2024 11:48:24 -0800 Subject: [PATCH] openapi: move internal functions to separate api spec --- generate.go | 1 + openapi-internal.yaml | 98 +++++++++++++++++++++++++++++++++++++++++++ openapi.yaml | 40 ++---------------- 3 files changed, 102 insertions(+), 37 deletions(-) create mode 100644 openapi-internal.yaml diff --git a/generate.go b/generate.go index a27289b..6a2f0b5 100644 --- a/generate.go +++ b/generate.go @@ -1,3 +1,4 @@ package main //go:generate go run github.com/ogen-go/ogen/cmd/ogen@latest --target pkg/api --clean openapi.yaml +//go:generate go run github.com/ogen-go/ogen/cmd/ogen@latest --target pkg/internal --clean openapi-internal.yaml diff --git a/openapi-internal.yaml b/openapi-internal.yaml new file mode 100644 index 0000000..86d3d29 --- /dev/null +++ b/openapi-internal.yaml @@ -0,0 +1,98 @@ +openapi: 3.1.0 +info: + title: StrafesNET Internal - OpenAPI 3.1 + description: Internal operations inaccessible from the public internet. + version: 0.1.0 +tags: + - name: Submissions + description: Submission operations +paths: + /submissions/{SubmissionID}/status/validator-validated: + post: + summary: (Internal endpoint) Role Validator changes status from Validating -> Validated + operationId: actionSubmissionValidated + tags: + - Submissions + parameters: + - $ref: '#/components/parameters/SubmissionID' + responses: + "204": + description: Successful response + default: + description: General Error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + /submissions/{SubmissionID}/status/validator-uploaded: + post: + summary: (Internal endpoint) Role Validator changes status from Uploading -> Uploaded + operationId: actionSubmissionUploaded + tags: + - Submissions + parameters: + - $ref: '#/components/parameters/SubmissionID' + responses: + "204": + description: Successful response + default: + description: General Error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + /submissions/{SubmissionID}/status/releaser-released: + post: + summary: (Internal endpoint) Role Releaser changes status from releasing -> released + operationId: actionSubmissionReleased + tags: + - Submissions + parameters: + - $ref: '#/components/parameters/SubmissionID' + responses: + "204": + description: Successful response + default: + description: General Error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" +components: + parameters: + SubmissionID: + name: SubmissionID + in: path + required: true + description: The unique identifier for a submission. + schema: + type: integer + format: int64 + schemas: + Pagination: + type: object + required: + - Page + - Limit + properties: + Page: + type: integer + format: int32 + minimum: 1 + Limit: + type: integer + format: int32 + minimum: 1 + maximum: 100 + Error: + description: Represents error object + type: object + properties: + code: + type: integer + format: int64 + message: + type: string + required: + - code + - message diff --git a/openapi.yaml b/openapi.yaml index c31dd1c..2377936 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -243,44 +243,10 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" - /submissions/{SubmissionID}/status/validator-validated: + /submissions/{SubmissionID}/status/trigger-upload: post: - summary: (Internal endpoint) Role Validator changes status from Validating -> Validated - operationId: actionSubmissionValidate - tags: - - Submissions - parameters: - - $ref: '#/components/parameters/SubmissionID' - responses: - "204": - description: Successful response - default: - description: General Error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - /submissions/{SubmissionID}/status/validator-published: - post: - summary: (Internal endpoint) Role Validator changes status from Publishing -> Published - operationId: actionSubmissionPublish - tags: - - Submissions - parameters: - - $ref: '#/components/parameters/SubmissionID' - responses: - "204": - description: Successful response - default: - description: General Error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - /submissions/{SubmissionID}/status/trigger-publish: - post: - summary: Role Admin changes status from Validated -> Publishing - operationId: actionSubmissionTriggerPublish + summary: Role Admin changes status from Validated -> Uploading + operationId: actionSubmissionTriggerUpload tags: - Submissions parameters: