spinframework / spinframework/spin-rust-sdk
Using the `Json` extractor with the 2.1 Rust template
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 35
- Forks
- 23
- Avg merge
- 37m
- Merged PRs (30d)
- 1
Description
In Spin 2.0.1, the Rust template referenced the http crate, and we supported the Json<T> extractor as a body type parameter e,g, http::Request<Json<Person>>.
In Spin 2.1, the Rust template does not reference the http crate and users are directed instead to the spin_sdk::http::Request type. This type is not generic - the body is always presented as bytes - and we do not have seem to have samples of how to use the extractors with it. I guess you can do something like Jsion::<Person>::try_from_body(req.into_body()) but it's not as friendly as the extractor syntax!
If the extractors work with the SDK request type, it would be good to provide samples that show how; if they don't, we should provide that functionality.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Spin 2.1 Rust template and the spin_sdk::http::Request entry point, then inspect how the Json extractor and try_from_body are exposed. Determine whether extractors work with the SDK request type; done means either documented samples show the supported usage or the SDK provides the requested functionality with coverage for the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100