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

Handling of custom types for List inputs of query params #488

Open
mvrahden opened this issue Jun 24, 2024 · 0 comments
Open

Handling of custom types for List inputs of query params #488

mvrahden opened this issue Jun 24, 2024 · 0 comments

Comments

@mvrahden
Copy link

So currently huma supports list inputs for input parameters of query type.

However, the support seems to be limited to []string-type only.
It would be handy to have the support of string-serializable custom types in order to not perform the type parsing and mapping manually.

One example:

// LicensesListFilterInput represents the list filter to match licenses.
type LicensesListFilterInput struct {
	LicenseIDs []uuid.UUID `query:"ids" required:"false" example:"a60a4a7e-33bb-4337-a72c-d33aa195936e,5b50ae19-f590-4921-871d-2ab6005a7335,35ed2d12-50d7-4939-bd54-5146e6416797"`
	// ...
}

Is there an easy way to achieve this?

Supporting the UnmarshalText(data []byte) error interface would be sufficient to support a wide range of types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant