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

Json middleware #97

Merged
merged 6 commits into from
Oct 14, 2019
Merged

Json middleware #97

merged 6 commits into from
Oct 14, 2019

Conversation

mjayprateek
Copy link
Contributor

No description provided.

Copy link

@irfn irfn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add an example usage of how this middleware can be included.

[message topic-entity-name key-fn]
(try
(parse-string message key-fn)
(catch Exception e
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why generic exception?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kartik7153 Because, Cheshire library does not say which exceptions can be thrown.

If `true`, would coerce keys to keywords, and if `false` it would leave keys as strings.
Default value is true."
([handler-fn topic-entity-name]
(parse-json handler-fn topic-entity-name true))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is true?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kartik7153 true is the value of key-fn which is the third argument to parse-json.

@mjayprateek
Copy link
Contributor Author

Can you add an example usage of how this middleware can be included.

@irfn I've added that in parse-json's doc-string

@theanirudhvyas
Copy link
Contributor

IMO this should be part of a separate library. @irfn, @mjayprateek mentioned that he had a conversation with you around keeping this in Ziggurat itself.
Could you explain the rationale around this?

@irfn
Copy link

irfn commented Oct 10, 2019

@theanirudhvyas

  1. If you always need 2 libs for the most basic use case you should instead have just 1 lib.
  2. json and Avro serdes are in much wider use in kafka community than protobuf.

IMHO By this rationale i would keep json in core.
add Avro (Thrift) support in future as a lib and at that time move protobuf to this.

@mjayprateek mjayprateek merged commit 86c8da1 into gojek:master Oct 14, 2019
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

Successfully merging this pull request may close these issues.

None yet

4 participants