Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sharonjl opened this issue Jan 28, 2025 · 0 comments
Open

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

sharonjl opened this issue Jan 28, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@sharonjl
Copy link

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.

@danielgtaylor danielgtaylor added the bug Something isn't working label Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants