From 410ef73168727f2325de7f99054c207180575794 Mon Sep 17 00:00:00 2001 From: SoXX The Fennec Date: Mon, 14 Jul 2025 19:07:37 +0000 Subject: [PATCH 1/4] fix: added staffNotes to schema --- api/api.yaml | 2 ++ openapi.dereferenced.yaml | 30 +++++++++++++++++ openapi.yaml | 70 ++++++++++++++++++++------------------- 3 files changed, 68 insertions(+), 34 deletions(-) diff --git a/api/api.yaml b/api/api.yaml index e56b4ed..9db5a96 100644 --- a/api/api.yaml +++ b/api/api.yaml @@ -142,6 +142,8 @@ components: $ref: "./components/schemas/postVersion.yaml" RelatedTag: $ref: "./components/schemas/relatedTag.yaml" + StaffNote: + $ref: ./components/schemas/staffNote.yaml Tag: $ref: "./components/schemas/tag.yaml" TagAlias: diff --git a/openapi.dereferenced.yaml b/openapi.dereferenced.yaml index e6ff568..81b6db1 100644 --- a/openapi.dereferenced.yaml +++ b/openapi.dereferenced.yaml @@ -3082,6 +3082,36 @@ components: - 6 - 7 - 8 + StaffNote: + type: object + required: + - id + - created_at + - updated_at + - user_id + - creator_id + - body + - is_deleted + - updater_id + properties: + id: + type: integer + created_at: + type: string + format: date-time + updated_at: + type: string + format: date-time + user_id: + type: integer + creator_id: + type: integer + body: + type: string + is_deleted: + type: boolean + updater_id: + type: integer Tag: type: object required: diff --git a/openapi.yaml b/openapi.yaml index bbd206a..154a659 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -2167,6 +2167,36 @@ components: type: string category_id: $ref: '#/components/schemas/TagCategories' + StaffNote: + type: object + required: + - id + - created_at + - updated_at + - user_id + - creator_id + - body + - is_deleted + - updater_id + properties: + id: + type: integer + created_at: + type: string + format: date-time + updated_at: + type: string + format: date-time + user_id: + type: integer + creator_id: + type: integer + body: + type: string + is_deleted: + type: boolean + updater_id: + type: integer Tag: type: object required: @@ -9278,7 +9308,7 @@ paths: anyOf: - type: array items: - $ref: '#/paths/~1staff_notes.json/post/responses/201/content/application~1json/schema' + $ref: '#/components/schemas/StaffNote' - type: object description: No Results required: @@ -9310,35 +9340,7 @@ paths: content: application/json: schema: - type: object - required: - - id - - created_at - - updated_at - - user_id - - creator_id - - body - - is_deleted - - updater_id - properties: - id: - type: integer - created_at: - type: string - format: date-time - updated_at: - type: string - format: date-time - user_id: - type: integer - creator_id: - type: integer - body: - type: string - is_deleted: - type: boolean - updater_id: - type: integer + $ref: '#/components/schemas/StaffNote' '403': $ref: '#/components/responses/AccessDenied' '404': @@ -9366,7 +9368,7 @@ paths: schema: type: array items: - $ref: '#/paths/~1staff_notes.json/post/responses/201/content/application~1json/schema' + $ref: '#/components/schemas/StaffNote' '403': $ref: '#/components/responses/AccessDenied' '404': @@ -9400,7 +9402,7 @@ paths: content: application/json: schema: - $ref: '#/paths/~1staff_notes.json/post/responses/201/content/application~1json/schema' + $ref: '#/components/schemas/StaffNote' '403': $ref: '#/components/responses/AccessDenied' '404': @@ -9430,7 +9432,7 @@ paths: content: application/json: schema: - $ref: '#/paths/~1staff_notes.json/post/responses/201/content/application~1json/schema' + $ref: '#/components/schemas/StaffNote' '403': $ref: '#/components/responses/AccessDenied' '404': @@ -9458,7 +9460,7 @@ paths: content: application/json: schema: - $ref: '#/paths/~1staff_notes.json/post/responses/201/content/application~1json/schema' + $ref: '#/components/schemas/StaffNote' '403': $ref: '#/components/responses/AccessDenied' '404': From 2932bb3f44af2927e29b24edda2d62f070e5b9ab Mon Sep 17 00:00:00 2001 From: SoXX The Fennec Date: Mon, 14 Jul 2025 19:57:39 +0000 Subject: [PATCH 2/4] feat: extracted schemas --- api/api.yaml | 6 ++++++ api/components/requestBodies/warning.yaml | 12 +----------- api/components/responses/accessDenied.yaml | 12 +----------- api/components/responses/notFound.yaml | 12 +----------- api/components/schemas/accessDenied.yaml | 11 +++++++++++ api/components/schemas/notFound.yaml | 11 +++++++++++ api/components/schemas/warningRecord.yaml | 11 +++++++++++ 7 files changed, 42 insertions(+), 33 deletions(-) create mode 100644 api/components/schemas/accessDenied.yaml create mode 100644 api/components/schemas/notFound.yaml create mode 100644 api/components/schemas/warningRecord.yaml diff --git a/api/api.yaml b/api/api.yaml index 9db5a96..63c0daf 100644 --- a/api/api.yaml +++ b/api/api.yaml @@ -40,6 +40,12 @@ components: ip_addr: $ref: "./components/parameters/ipAddr.yaml" schemas: + AccessDeniedResponse: + $ref: "./components/schemas/accessDenied.yaml" + NotFoundResponse: + $ref: "./components/schemas/notFound.yaml" + WarningRecordType: + $ref: "./components/schemas/warningRecord.yaml" ModActionActions: $ref: "./components/schemas/modActionActions.yaml" PostEventActions: diff --git a/api/components/requestBodies/warning.yaml b/api/components/requestBodies/warning.yaml index 4dc8d4b..e9976a2 100644 --- a/api/components/requestBodies/warning.yaml +++ b/api/components/requestBodies/warning.yaml @@ -1,14 +1,4 @@ content: application/json: schema: - type: object - required: - - record_type - properties: - record_type: - type: string - enum: - - unmark - - ban - - record - - warning \ No newline at end of file + $ref: "../schemas/warningRecord.yaml" diff --git a/api/components/responses/accessDenied.yaml b/api/components/responses/accessDenied.yaml index 14aa8a6..49df797 100644 --- a/api/components/responses/accessDenied.yaml +++ b/api/components/responses/accessDenied.yaml @@ -2,14 +2,4 @@ description: Access Denied content: application/json: schema: - type: object - required: - - success - - reason - properties: - success: - type: boolean - reason: - type: string - enum: - - "Access Denied" \ No newline at end of file + $ref: "../schemas/accessDenied.yaml" diff --git a/api/components/responses/notFound.yaml b/api/components/responses/notFound.yaml index 5af3442..db0ae5a 100644 --- a/api/components/responses/notFound.yaml +++ b/api/components/responses/notFound.yaml @@ -2,14 +2,4 @@ description: Not Found content: application/json: schema: - type: object - required: - - success - - reason - properties: - success: - type: boolean - reason: - type: string - enum: - - "not found" \ No newline at end of file + $ref: "../schemas/notFound.yaml" diff --git a/api/components/schemas/accessDenied.yaml b/api/components/schemas/accessDenied.yaml new file mode 100644 index 0000000..7b499b2 --- /dev/null +++ b/api/components/schemas/accessDenied.yaml @@ -0,0 +1,11 @@ +type: object +required: + - success + - reason +properties: + success: + type: boolean + reason: + type: string + enum: + - "Access Denied" \ No newline at end of file diff --git a/api/components/schemas/notFound.yaml b/api/components/schemas/notFound.yaml new file mode 100644 index 0000000..2086e1c --- /dev/null +++ b/api/components/schemas/notFound.yaml @@ -0,0 +1,11 @@ +type: object +required: + - success + - reason +properties: + success: + type: boolean + reason: + type: string + enum: + - "not found" \ No newline at end of file diff --git a/api/components/schemas/warningRecord.yaml b/api/components/schemas/warningRecord.yaml new file mode 100644 index 0000000..e7b3e46 --- /dev/null +++ b/api/components/schemas/warningRecord.yaml @@ -0,0 +1,11 @@ +type: object +required: + - record_type +properties: + record_type: + type: string + enum: + - unmark + - ban + - record + - warning \ No newline at end of file From c21d726befa04071cc56306feca12eaed2de081b Mon Sep 17 00:00:00 2001 From: SoXX The Fennec Date: Mon, 14 Jul 2025 19:58:36 +0000 Subject: [PATCH 3/4] fix: just use string Yes technically integer is also a type you can set, but code generators really don't like that. --- api/components/parameters/idOrName.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/api/components/parameters/idOrName.yaml b/api/components/parameters/idOrName.yaml index e903af2..0b48e96 100644 --- a/api/components/parameters/idOrName.yaml +++ b/api/components/parameters/idOrName.yaml @@ -2,7 +2,5 @@ name: idOrName in: path required: true schema: - oneOf: - - type: integer - - type: string + type: string description: An ID that can be either an integer or a name. From 4379898c7107eeffe8756ae7351074116e45570d Mon Sep 17 00:00:00 2001 From: SoXX The Fennec Date: Mon, 14 Jul 2025 19:58:46 +0000 Subject: [PATCH 4/4] feat: regenerated spec --- openapi.dereferenced.yaml | 76 +++++++++++++++++++++++---------------- openapi.yaml | 76 ++++++++++++++++++++------------------- 2 files changed, 86 insertions(+), 66 deletions(-) diff --git a/openapi.dereferenced.yaml b/openapi.dereferenced.yaml index 81b6db1..fd5f347 100644 --- a/openapi.dereferenced.yaml +++ b/openapi.dereferenced.yaml @@ -35,9 +35,7 @@ components: in: path required: true schema: - oneOf: - - type: integer - - type: string + type: string description: An ID that can be either an integer or a name. limit: name: limit @@ -62,6 +60,42 @@ components: schema: type: string schemas: + AccessDeniedResponse: + type: object + required: + - success + - reason + properties: + success: + type: boolean + reason: + type: string + enum: + - Access Denied + NotFoundResponse: + type: object + required: + - success + - reason + properties: + success: + type: boolean + reason: + type: string + enum: + - not found + WarningRecordType: + type: object + required: + - record_type + properties: + record_type: + type: string + enum: + - unmark + - ban + - record + - warning ModActionActions: type: string enum: @@ -4530,9 +4564,7 @@ paths: in: path required: true schema: - oneOf: - - type: integer - - type: string + type: string description: An ID that can be either an integer or a name. responses: '200': @@ -4665,9 +4697,7 @@ paths: in: path required: true schema: - oneOf: - - type: integer - - type: string + type: string description: An ID that can be either an integer or a name. requestBody: content: @@ -4763,9 +4793,7 @@ paths: in: path required: true schema: - oneOf: - - type: integer - - type: string + type: string description: An ID that can be either an integer or a name. responses: '204': @@ -4817,9 +4845,7 @@ paths: in: path required: true schema: - oneOf: - - type: integer - - type: string + type: string description: An ID that can be either an integer or a name. - name: version_id in: query @@ -5422,9 +5448,7 @@ paths: in: path required: true schema: - oneOf: - - type: integer - - type: string + type: string description: An ID that can be either an integer or a name. responses: '200': @@ -5493,9 +5517,7 @@ paths: in: path required: true schema: - oneOf: - - type: integer - - type: string + type: string description: An ID that can be either an integer or a name. requestBody: content: @@ -5621,9 +5643,7 @@ paths: in: path required: true schema: - oneOf: - - type: integer - - type: string + type: string description: An ID that can be either an integer or a name. responses: '204': @@ -5674,9 +5694,7 @@ paths: in: path required: true schema: - oneOf: - - type: integer - - type: string + type: string description: An ID that can be either an integer or a name. responses: '204': @@ -5727,9 +5745,7 @@ paths: in: path required: true schema: - oneOf: - - type: integer - - type: string + type: string description: An ID that can be either an integer or a name. responses: '204': diff --git a/openapi.yaml b/openapi.yaml index 154a659..38f948e 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -35,9 +35,7 @@ components: in: path required: true schema: - oneOf: - - type: integer - - type: string + type: string description: An ID that can be either an integer or a name. limit: name: limit @@ -62,6 +60,42 @@ components: schema: type: string schemas: + AccessDeniedResponse: + type: object + required: + - success + - reason + properties: + success: + type: boolean + reason: + type: string + enum: + - Access Denied + NotFoundResponse: + type: object + required: + - success + - reason + properties: + success: + type: boolean + reason: + type: string + enum: + - not found + WarningRecordType: + type: object + required: + - record_type + properties: + record_type: + type: string + enum: + - unmark + - ban + - record + - warning ModActionActions: type: string enum: @@ -2786,33 +2820,13 @@ components: content: application/json: schema: - type: object - required: - - success - - reason - properties: - success: - type: boolean - reason: - type: string - enum: - - not found + $ref: '#/components/schemas/NotFoundResponse' AccessDenied: description: Access Denied content: application/json: schema: - type: object - required: - - success - - reason - properties: - success: - type: boolean - reason: - type: string - enum: - - Access Denied + $ref: '#/components/schemas/AccessDeniedResponse' ExpectedError: description: Invalid Input Data content: @@ -2860,17 +2874,7 @@ components: content: application/json: schema: - type: object - required: - - record_type - properties: - record_type: - type: string - enum: - - unmark - - ban - - record - - warning + $ref: '#/components/schemas/WarningRecordType' paths: /artists.json: get: