Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lokerpc/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ func TypeSchema(t reflect.Type, tdefs map[reflect.Type]*NamedSchema) *jtd.Schema

for i := 0; i < t.NumField(); i++ {
f := t.Field(i)

if !f.IsExported() {
continue
}

name, omit := parseTag(f.Tag.Get("json"))
if name == "" {
name = f.Name
Expand Down
3 changes: 2 additions & 1 deletion lokerpc/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ func (textMarshaler) MarshalText() ([]byte, error) {

func TestTypeSchema(t *testing.T) {
type NamedStruct struct {
Foo string `json:"foo"`
Foo string `json:"foo"`
nope string
}

// Name to conflict with flag.Flag
Expand Down