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

protocol v2: Type not in json #41

Open
progrium opened this issue Jan 30, 2015 · 2 comments
Open

protocol v2: Type not in json #41

progrium opened this issue Jan 30, 2015 · 2 comments

Comments

@progrium
Copy link

I think we agreed via email it would be good to have PowerstripProtocolVersion in headers since if we change the structure or content type, we'd lose a reliable way to check the version. We'd have to version how we version! Kidding. For a similar but different reason, I think Type should not be in JSON either.

When you're used to Python/Ruby you don't think about this as much, but it really sucks to have data structures define what they inside themselves. Imagine Content-Type being part of the body. What!? How would you handle that?

Using Go makes this obvious since we have to parse the payload twice to determine which type of struct to use when unmarshaling: https://github.com/ClusterHQ/powerstrip/blob/golang/protocol_test.go#L15

@lukemarsden
Copy link
Contributor

I totally get this. But let's discuss whether we want to keep the JSON format or not in #44 before we decide to start moving things into HTTP headers.

@robhaswell
Copy link
Contributor

@lukemarsden I disagree, I think we can continue to consider this without making a decision on #44.

I'm in favour of this proposal. We should be able to determine the schema of the body just from the header, and this includes both the version AND whether or not is is a pre/post hook.

👍

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

3 participants