From fc3741365c27f1d703e8a736af95b95ff811cc45 Mon Sep 17 00:00:00 2001 From: Vyr Cossont Date: Wed, 6 Mar 2024 09:05:45 -0800 Subject: [bugfix] Fix Swagger spec and add test script (#2698) * Add Swagger spec test script * Fix Swagger spec errors not related to statuses with polls * Add API tests that post a status with a poll * Fix creating a status with a poll from form params * Fix Swagger spec errors related to statuses with polls (this is the last error) * Fix Swagger spec warnings not related to unused definitions * Suppress a duplicate list update params definition that was somehow causing wrong param names * Add Swagger test to CI - updates Drone config - vendorizes go-swagger - fixes a file extension issue that caused the test script to generate JSON instead of YAML with the vendorized version * Put `Sample: ` on its own line everywhere * Remove unused id param from emojiCategoriesGet * Add 5 more pairs of profile fields to account update API Swagger * Remove Swagger prefix from dummy fields It makes the generated code look weird * Manually annotate params for statusCreate operation * Fix all remaining Swagger spec warnings - Change some models into operation parameters - Ignore models that already correspond to manually documented operation parameters but can't be trivially changed (those with file fields) * Documented that creating a status with scheduled_at isn't implemented yet * sign drone.yml * Fix filter API Swagger errors * fixup! Fix filter API Swagger errors --------- Co-authored-by: tobi --- internal/api/client/filters/v1/filterpost.go | 39 +++++++++++++++++----------- internal/api/client/filters/v1/filterput.go | 39 +++++++++++++++++----------- 2 files changed, 48 insertions(+), 30 deletions(-) (limited to 'internal/api/client/filters') diff --git a/internal/api/client/filters/v1/filterpost.go b/internal/api/client/filters/v1/filterpost.go index b0a626199..e150e8609 100644 --- a/internal/api/client/filters/v1/filterpost.go +++ b/internal/api/client/filters/v1/filterpost.go @@ -48,49 +48,58 @@ import ( // name: phrase // in: formData // required: true -// description: The text to be filtered. +// description: |- +// The text to be filtered. +// +// Sample: fnord // maxLength: 40 // type: string -// example: "fnord" // - // name: context // in: formData // required: true -// description: The contexts in which the filter should be applied. +// description: |- +// The contexts in which the filter should be applied. +// +// Sample: home, public // enum: // - home // - notifications // - public // - thread // - account -// example: -// - home -// - public -// items: -// $ref: '#/definitions/filterContext' -// minLength: 1 // type: array +// items: +// type: +// string +// minItems: 1 // uniqueItems: true // - // name: expires_in // in: formData -// description: Number of seconds from now that the filter should expire. If omitted, filter never expires. +// description: |- +// Number of seconds from now that the filter should expire. If omitted, filter never expires. +// +// Sample: 86400 // type: number -// example: 86400 // - // name: irreversible // in: formData -// description: Should matching entities be removed from the user's timelines/views, instead of hidden? Not supported yet. +// description: |- +// Should matching entities be removed from the user's timelines/views, instead of hidden? Not supported yet. +// +// Sample: false // type: boolean // default: false -// example: false // - // name: whole_word // in: formData -// description: Should the filter consider word boundaries? +// description: |- +// Should the filter consider word boundaries? +// +// Sample: true // type: boolean // default: false -// example: true // // security: // - OAuth2 Bearer: diff --git a/internal/api/client/filters/v1/filterput.go b/internal/api/client/filters/v1/filterput.go index c686e4515..1822efb6d 100644 --- a/internal/api/client/filters/v1/filterput.go +++ b/internal/api/client/filters/v1/filterput.go @@ -54,49 +54,58 @@ import ( // name: phrase // in: formData // required: true -// description: The text to be filtered. +// description: |- +// The text to be filtered. +// +// Sample: fnord // maxLength: 40 // type: string -// example: "fnord" // - // name: context // in: formData // required: true -// description: The contexts in which the filter should be applied. +// description: |- +// The contexts in which the filter should be applied. +// +// Sample: home, public // enum: // - home // - notifications // - public // - thread // - account -// example: -// - home -// - public -// items: -// $ref: '#/definitions/filterContext' -// minLength: 1 // type: array +// items: +// type: +// string +// minItems: 1 // uniqueItems: true // - // name: expires_in // in: formData -// description: Number of seconds from now that the filter should expire. If omitted, filter never expires. +// description: |- +// Number of seconds from now that the filter should expire. If omitted, filter never expires. +// +// Sample: 86400 // type: number -// example: 86400 // - // name: irreversible // in: formData -// description: Should matching entities be removed from the user's timelines/views, instead of hidden? Not supported yet. +// description: |- +// Should matching entities be removed from the user's timelines/views, instead of hidden? Not supported yet. +// +// Sample: false // type: boolean // default: false -// example: false // - // name: whole_word // in: formData -// description: Should the filter consider word boundaries? +// description: |- +// Should the filter consider word boundaries? +// +// Sample: true // type: boolean // default: false -// example: true // // security: // - OAuth2 Bearer: -- cgit v1.2.3