Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
vearutop committed Feb 24, 2024
1 parent d8fe4c9 commit 55eb02f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ linters-settings:
linters:
enable-all: true
disable:
- maintidx
- musttag
- containedctx
- goerr113
Expand Down
9 changes: 5 additions & 4 deletions reflect.go
Original file line number Diff line number Diff line change
Expand Up @@ -924,17 +924,18 @@ func (r *Reflector) walkProperties(v reflect.Value, parent *Schema, rc *ReflectC

if tag == "" && field.Anonymous &&
(field.Type.Kind() == reflect.Struct || deepIndirect.Kind() == reflect.Struct) {

forceReference := (field.Type.Implements(typeOfEmbedReferencer) && field.Tag.Get("refer") == "") ||
field.Tag.Get("refer") == "true"

if forceReference {
rc.Path = append(rc.Path, "")
if s, err := r.reflect(values[i].Interface(), rc, false, parent); err != nil {

s, err := r.reflect(values[i].Interface(), rc, false, parent)
if err != nil {
return err

Check warning on line 935 in reflect.go

View check run for this annotation

Codecov / codecov/patch

reflect.go#L935

Added line #L935 was not covered by tests
} else {
parent.AllOf = append(parent.AllOf, s.ToSchemaOrBool())
}

Check notice on line 936 in reflect.go

View workflow job for this annotation

GitHub Actions / test (1.22.x)

1 statement(s) on lines 934:936 are not covered by tests.

parent.AllOf = append(parent.AllOf, s.ToSchemaOrBool())
} else if err := r.walkProperties(values[i], parent, rc); err != nil {
return err
}
Expand Down
4 changes: 1 addition & 3 deletions reflect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1846,9 +1846,7 @@ func TestReflector_Reflect_embedded(t *testing.T) {

r := jsonschema.Reflector{}

s, err := r.Reflect(B{}, jsonschema.InterceptProp(func(params jsonschema.InterceptPropParams) error {
return nil
}))
s, err := r.Reflect(B{})
require.NoError(t, err)
assertjson.EqMarshal(t, `{
"definitions":{
Expand Down

0 comments on commit 55eb02f

Please sign in to comment.