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

Support booleans and numbers for query values #141

Closed
LucasPickering opened this issue Apr 7, 2024 · 0 comments · Fixed by #170
Closed

Support booleans and numbers for query values #141

LucasPickering opened this issue Apr 7, 2024 · 0 comments · Fixed by #170
Labels
good first issue Good for newcomers help wanted Extra attention is needed qol Improvements that make usage smoother, without introducing new functionality

Comments

@LucasPickering
Copy link
Owner

It'd be nice if non-string values in a query were automatically stringified:

list_fish:
  method: GET
  url: "{{host}}/fishes"
  query:
    big: true

Right now, this gives an error because true is a boolean and it expects a string. It'd be nice if booleans, ints and floats all deserialized into their stringified version.

I think the best way to do this would be to implement Deserialize manually for Template. I would put the implementation in cereal.rs to keep all the serde stuff in one place. This has the added effect of automatically supporting bools/ints/floats for any other templated value (body, profile value, etc.) which is probably good but needs a bit more critical thought to be sure.

@LucasPickering LucasPickering added good first issue Good for newcomers qol Improvements that make usage smoother, without introducing new functionality help wanted Extra attention is needed labels Apr 7, 2024
maksimowiczm added a commit to maksimowiczm/slumber that referenced this issue Apr 22, 2024
booleans, numeric and nulls are now supported for query values

Closes LucasPickering#141
maksimowiczm added a commit to maksimowiczm/slumber that referenced this issue Apr 22, 2024
booleans, numeric and nulls are now supported for query values

Closes LucasPickering#141
maksimowiczm added a commit to maksimowiczm/slumber that referenced this issue Apr 22, 2024
booleans, numeric and nulls are now supported for query values

Closes LucasPickering#141
LucasPickering pushed a commit that referenced this issue Apr 24, 2024
## Description

Booleans, numeric and nulls are now supported for query values.

#### Changes:
- Implemented ```Deserialize``` manually for ```Template``` using
~~```serde_yaml::value::Value```~~ ```TemplateVisitor```
- Adjusted documentation, although ```"true"``` is still supported I
replaced it with ```true```
- Updated ```CHANGELOG.md``` (twice 😅)

## QA
- Added Template deserialization tests inside ```cereal.rs```

Closes #141
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed qol Improvements that make usage smoother, without introducing new functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant