mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 00:55:55 +00:00
Represent zero fields in /schema response as [] instead of null
This commit is contained in:
parent
421848c86a
commit
f758a04e18
1 changed files with 3 additions and 0 deletions
|
|
@ -857,7 +857,9 @@ func (h *Holder) Schema(includeHiddenAndViews bool) []*IndexInfo {
|
|||
CreatedAt: index.CreatedAt(),
|
||||
Options: index.Options(),
|
||||
ShardWidth: ShardWidth,
|
||||
Fields: []*FieldInfo{},
|
||||
}
|
||||
|
||||
for _, field := range index.Fields() {
|
||||
if !includeHiddenAndViews && strings.HasPrefix(field.name, "_") {
|
||||
continue
|
||||
|
|
@ -868,6 +870,7 @@ func (h *Holder) Schema(includeHiddenAndViews bool) []*IndexInfo {
|
|||
Options: field.Options(),
|
||||
}
|
||||
if includeHiddenAndViews {
|
||||
fi.Views = []*ViewInfo{}
|
||||
for _, view := range field.views() {
|
||||
fi.Views = append(fi.Views, &ViewInfo{Name: view.name})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue