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

runtime.StyleParamWithLocation for map[string]int fails with "map not of type map[string]interface{}" #37

Closed
andnow873 opened this issue Feb 26, 2024 · 1 comment

Comments

@andnow873
Copy link

andnow873 commented Feb 26, 2024

# spec
    PriorityFilter:
      name: priority
      in: query
      schema:
        type: object
        additionalProperties:
          type: integer
// models 

// PriorityFilter defines model for PriorityFilter.
type PriorityFilter map[string]int

// GetMessagesParams defines parameters for GetMessages.
type GetMessagesParams struct {
	Priority *PriorityFilter `form:"priority,omitempty" json:"priority,omitempty"`
}
// using client

pf := PriorityFilter(map[string]int{"gt": 100})
_, err := client.GetMessages(ctx, &GetMessagesParams{
	Priority: &pf,
})
if err != nil {
	t.Fatalf("get messages: %s", err)
}

// fails with error: get messages: map not of type map[string]interface{}

It fails on call if queryFrag, err := runtime.StyleParamWithLocation("form", true, "priority", runtime.ParamLocationQuery, *params.Priority); err != nil { return nil, err }

@woutslakhorst
Copy link

Same problem, but with type: string: map not of type map[string]interface{}

mromaszewicz added a commit that referenced this issue Jun 4, 2024
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

2 participants