fix(docs): improve swagger output by setting swaggertype and enums (#705)

Co-authored-by: Piotr Sarna <piotr@piksar.eu>
This commit is contained in:
Piotr Sarna
2025-05-13 13:02:12 +02:00
committed by GitHub
parent 3e540cff5f
commit 1d38306e7d

View File

@@ -66,6 +66,10 @@ func (p *ProjectViewKind) UnmarshalJSON(bytes []byte) error {
return nil
}
// NOTE: When adding or changing enum values for ProjectViewKind,
// make sure to update the corresponding `enums` tag in the ProjectView struct
// to keep the OpenAPI documentation in sync.
const (
ProjectViewKindList ProjectViewKind = iota
ProjectViewKindGantt
@@ -75,6 +79,10 @@ const (
type BucketConfigurationModeKind int
// NOTE: When adding or changing enum values for BucketConfigurationModeKind,
// make sure to update the corresponding `enums` tag in the ProjectView struct
// to keep the OpenAPI documentation in sync.
const (
BucketConfigurationModeNone BucketConfigurationModeKind = iota
BucketConfigurationModeManual
@@ -128,7 +136,7 @@ type ProjectView struct {
// The project this view belongs to
ProjectID int64 `xorm:"not null index" json:"project_id" param:"project"`
// The kind of this view. Can be `list`, `gantt`, `table` or `kanban`.
ViewKind ProjectViewKind `xorm:"not null" json:"view_kind"`
ViewKind ProjectViewKind `xorm:"not null" json:"view_kind" swaggertype:"string" enums:"list,gantt,table,kanban"`
// The filter query to match tasks by. Check out https://vikunja.io/docs/filters for a full explanation.
Filter *TaskCollection `xorm:"json null default null" query:"filter" json:"filter"`
@@ -136,7 +144,7 @@ type ProjectView struct {
Position float64 `xorm:"double null" json:"position"`
// The bucket configuration mode. Can be `none`, `manual` or `filter`. `manual` allows to move tasks between buckets as you normally would. `filter` creates buckets based on a filter for each bucket.
BucketConfigurationMode BucketConfigurationModeKind `xorm:"default 0" json:"bucket_configuration_mode"`
BucketConfigurationMode BucketConfigurationModeKind `xorm:"default 0" json:"bucket_configuration_mode" swaggertype:"string" enums:"none,manual,filter,manual"`
// When the bucket configuration mode is not `manual`, this field holds the options of that configuration.
BucketConfiguration []*ProjectViewBucketConfiguration `xorm:"json" json:"bucket_configuration"`
// The ID of the bucket where new tasks without a bucket are added to. By default, this is the leftmost bucket in a view.