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

caution when using custom scalars ... must be JSON encodable #4

Open
hlship opened this issue Mar 21, 2017 · 0 comments
Open

caution when using custom scalars ... must be JSON encodable #4

hlship opened this issue Mar 21, 2017 · 0 comments

Comments

@hlship
Copy link
Member

hlship commented Mar 21, 2017

Tracking down a problem with the latest upgrade. Because of a resolve failure, the arguments to a field are included in an error map; one value is a java.time.LocalDateTime. Cheshire throws an exception when streaming this as JSON, and the final result is a response with a body that is the empty string.

The right solution is to use cheshire.generator/add-encoder:

(add-encoder LocalDateTime
             (fn [v ^JsonGenerator json-generator]
               (.writeString json-generator (format-local-date-time v)))) 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant