Dependent routes/data structures?
- Dominant language
- Python
- Stars
- 413
- Forks
- 81
- PR merge metrics
- No merged PRs in 30d
Description
Is there a way to indicate dependencies between routes? For example very often, visiting `/login` is required before `/logout`.
There could also be dependencies between data, let's say you have:
```
alias UUID = String(pattern="[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}")
struct RegisterReq
"Describes a user registration request, this is often required to do anything else."
username String
"Given username for that user."
struct RegisterResp
"Describes a registration response, indicates a user has registered and is now identifiable"
uuid UUID
"A universal identifier"
struct LogoutReq
"Triggers the user to logout, requires a UUID to have been received"
@Depends(RegisterResp)
uuid UUID
route register_person(RegisterReq, RegisterResp, Void)
route logout_person(LogoutReq, Void, Void)
```
I think dependency semantics are very useful when testing routes, so if there's no semanics in place right now, I'd like to propose a `@Depends` annotation for dependant datatypes, from which we can infer the natural order of requests, used as seen above.
Contributor guide
Assessment
This issue has not been assessed yet.