luckyframework / luckyframework/lucky
Add some sort of `with_keys` option to `send_json`
Nobody has claimed this yet.
- Dominant language
- Crystal
- Stars
- 2.7k
- Forks
- 172
- PR merge metrics
- No merged PRs in 30d
Description
I don't know exactly what this looks like yet, but I have a ton of really large custom JSON output in my actions that are too complex to say response.should send_json(200, messages: [{.......}]). Really I don't care that the value looks exactly a specific way, I just want to ensure that there is a value from that key. So really I want something kind of like..
response.should send_json(200, with_keys: [:messages, ....])
or maybe comparing a type somehow?
response.should send_json(200, with: {messages: Array(MessageSerializer)})
definitely a half-baked idea 😂
Contributor guide
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 src/lucky/request_expectations.cr around line 12 and review the existing send_json expectation behavior. Define the supported key- or type-matching API before implementation, then add coverage showing the chosen form accepts large JSON responses without requiring exact values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- crystal
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100