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

Dependent routes/data structures? #112

Open
elefthei opened this issue Aug 18, 2018 · 0 comments
Open

Dependent routes/data structures? #112

elefthei opened this issue Aug 18, 2018 · 0 comments

Comments

@elefthei
Copy link

elefthei commented Aug 18, 2018

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.

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

1 participant