-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Change default media type to JSON #12566
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea!
81122f3
to
18456a9
Compare
6dd7000
to
ed67977
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like I forgot to post my review... You added the Jackson impl so that's one less thing to add but there are still a few details that needs fixing.
I can do it if you have better things to do, just ping me!
@Produces(MediaType.WILDCARD) | ||
@Consumes(MediaType.WILDCARD) | ||
@Priority(Priorities.USER - 200) | ||
public class QuarkusJSONBSerializer extends JsonBindingProvider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be called QuarkusJsonbSerializer
for consistency with other classes.
@@ -0,0 +1,77 @@ | |||
package io.quarkus.resteasy.jsonb; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not API so it should be in the runtime package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And same for the Jackson one.
This adds a new RESTEasy provider that will produce JSON by default. This removes the need to add @produces(MediaType.APPLICATION_JSON) and @consumes(MediaType.APPLICATION_JSON) everywhere. The old behaviour can be retained by setting: quarkus.resteasy-json.default-json=false in application.properties.
ed67977
to
f0a4c7c
Compare
Done |
@stuartwdouglas apparently this PR does not support this: @GET
public Map<String,String> hello() {
Map<String,String> t = new HashMap<>();
t.put("Hey", "Ho");
return t;
} I get the following error while hitting the endpoint:
|
I created #12701 |
Ignore it, I forgot to add |
This adds a new RESTEasy provider that will produce
JSON by default. This removes the need to add
@produces(MediaType.APPLICATION_JSON) and
@consumes(MediaType.APPLICATION_JSON) everywhere.
The old behaviour can be retained by setting:
quarkus.resteasy-json.default-json=false
in application.properties.