summaryrefslogtreecommitdiff
path: root/internal/api/model/status.go
diff options
context:
space:
mode:
authorLibravatar Vyr Cossont <VyrCossont@users.noreply.github.com>2024-03-06 09:05:45 -0800
committerLibravatar GitHub <noreply@github.com>2024-03-06 18:05:45 +0100
commitfc3741365c27f1d703e8a736af95b95ff811cc45 (patch)
tree929f1d5e20d1469d63a3dfe81d38d89f9a073c5a /internal/api/model/status.go
parent[chore/bugfix] Little DB fixes (#2726) (diff)
downloadgotosocial-fc3741365c27f1d703e8a736af95b95ff811cc45.tar.xz
[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 <tobi.smethurst@protonmail.com>
Diffstat (limited to 'internal/api/model/status.go')
-rw-r--r--internal/api/model/status.go20
1 files changed, 3 insertions, 17 deletions
diff --git a/internal/api/model/status.go b/internal/api/model/status.go
index 8ca41c767..fed2cdf37 100644
--- a/internal/api/model/status.go
+++ b/internal/api/model/status.go
@@ -163,47 +163,33 @@ type StatusReblogged struct {
// StatusCreateRequest models status creation parameters.
//
-// swagger:model statusCreateRequest
+// swagger:ignore
type StatusCreateRequest struct {
// Text content of the status.
// If media_ids is provided, this becomes optional.
// Attaching a poll is optional while status is provided.
- // in: formData
Status string `form:"status" json:"status" xml:"status"`
// Array of Attachment ids to be attached as media.
// If provided, status becomes optional, and poll cannot be used.
- //
- // If the status is being submitted as a form, the key is 'media_ids[]',
- // but if it's json or xml, the key is 'media_ids'.
- //
- // in: formData
MediaIDs []string `form:"media_ids[]" json:"media_ids" xml:"media_ids"`
// Poll to include with this status.
- // in: formData
Poll *PollRequest `form:"poll" json:"poll" xml:"poll"`
// ID of the status being replied to, if status is a reply.
- // in: formData
InReplyToID string `form:"in_reply_to_id" json:"in_reply_to_id" xml:"in_reply_to_id"`
// Status and attached media should be marked as sensitive.
- // in: formData
Sensitive bool `form:"sensitive" json:"sensitive" xml:"sensitive"`
// Text to be shown as a warning or subject before the actual content.
// Statuses are generally collapsed behind this field.
- // in: formData
SpoilerText string `form:"spoiler_text" json:"spoiler_text" xml:"spoiler_text"`
// Visibility of the posted status.
- // in: formData
Visibility Visibility `form:"visibility" json:"visibility" xml:"visibility"`
// ISO 8601 Datetime at which to schedule a status.
// Providing this parameter will cause ScheduledStatus to be returned instead of Status.
// Must be at least 5 minutes in the future.
- // in: formData
ScheduledAt string `form:"scheduled_at" json:"scheduled_at" xml:"scheduled_at"`
// ISO 639 language code for this status.
- // in: formData
Language string `form:"language" json:"language" xml:"language"`
// Content type to use when parsing this status.
- // in: formData
ContentType StatusContentType `form:"content_type" json:"content_type" xml:"content_type"`
}
@@ -229,7 +215,7 @@ const (
// AdvancedStatusCreateForm wraps the mastodon-compatible status create form along with the GTS advanced
// visibility settings.
//
-// swagger:parameters statusCreate
+// swagger:ignore
type AdvancedStatusCreateForm struct {
StatusCreateRequest
AdvancedVisibilityFlagsForm
@@ -238,7 +224,7 @@ type AdvancedStatusCreateForm struct {
// AdvancedVisibilityFlagsForm allows a few more advanced flags to be set on new statuses, in addition
// to the standard mastodon-compatible ones.
//
-// swagger:model advancedVisibilityFlagsForm
+// swagger:ignore
type AdvancedVisibilityFlagsForm struct {
// This status will be federated beyond the local timeline(s).
Federated *bool `form:"federated" json:"federated" xml:"federated"`