mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 17:15:56 +00:00
Merge pull request #1524 from alanbernstein/fix-null-schema
Represent zero indexes in /schema response as [] instead of null
This commit is contained in:
commit
7df5375572
2 changed files with 4 additions and 4 deletions
|
|
@ -906,13 +906,13 @@ func (h *Holder) limitedSchema() ([]*IndexInfo, error) {
|
|||
}
|
||||
|
||||
func (h *Holder) schema(ctx context.Context, includeViews bool) ([]*IndexInfo, error) {
|
||||
var a []*IndexInfo
|
||||
|
||||
schema, err := h.schemator.Schema(ctx)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "getting schema via schemator")
|
||||
}
|
||||
|
||||
a := make([]*IndexInfo, 0, len(schema))
|
||||
|
||||
for _, index := range schema {
|
||||
cim, err := decodeCreateIndexMessage(h.serializer, index.Data)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ func TestHandler_Endpoints(t *testing.T) {
|
|||
t.Fatalf("unexpected status code: %d", w.Code)
|
||||
}
|
||||
body := w.Body.String()
|
||||
if body != "{\"indexes\":null}\n" {
|
||||
if body != "{\"indexes\":[]}\n" {
|
||||
t.Fatalf("unexpected empty schema: '%v'", body)
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ func TestHandler_Endpoints(t *testing.T) {
|
|||
t.Fatalf("unexpected status code: %d", w.Code)
|
||||
}
|
||||
body := w.Body.String()
|
||||
if body != "{\"indexes\":null}\n" {
|
||||
if body != "{\"indexes\":[]}\n" {
|
||||
t.Fatalf("unexpected empty schema: '%v'", body)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue