danielgtaylor / danielgtaylor/huma

How do I stop the resolver from diving into nested fields?

Open
#716 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
4.4k
Forks
285
Avg merge
40m
Merged PRs (30d)
1

Description

How do I stop the resolver from diving into nested fields?

Given
```
type Opt[T any] struct {
Val T
Present bool
Null bool
}

type MyString string

func (ms MyString) Resolve(ctx huma.Context, prefix *huma.PathBuffer) []error {
if ms == "" {
return []error{}
}
return nil
}
```

huma seems to call the Resolver implemented on both Opt and T, I'd like to be able to not execute the resolver when the value is not present.

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names no repository files or tests. Start by tracing resolver dispatch for the Opt and MyString examples, then verify how nested fields are handled when Opt is not present; done means the nested resolver is not executed for that absent value.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.