Skip to content

(Javalin) Avaje JsonB support #99

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

Merged
merged 19 commits into from
Oct 20, 2022
Merged

Conversation

SentryMan
Copy link
Collaborator

  • Adds JsonB javalin generation
  • moves a bunch of jsonb stuff into core module
  • Test upgraded to Javalin 5

@SentryMan SentryMan changed the title Javalin Avaje JsonB support (Javalin) Avaje JsonB support Oct 18, 2022
@rbygrave
Copy link
Contributor

Nice. As a general comment, when PRs/diffs get big we increase the desire to have "style changes" in separate PRs from "functional changes" - it makes it easier to see the actual "functional changes" that are occurring. I also see that our IDEs are doing different formatting so the diffs also include format only changes (which also makes it harder to see the actual functional change in the review).

Anyway, great work. Let me know when you are finished with the PR but yes generally we desire "style changes" in a separate PR from "functional changes" just to make it easier to review the diff.

@SentryMan
Copy link
Collaborator Author

SentryMan commented Oct 18, 2022

Nice. As a general comment, when PRs/diffs get big we increase the desire to have "style changes" in separate PRs from "functional changes" - it makes it easier to see the actual "functional changes" that are occurring. I also see that our IDEs are doing different formatting so the diffs also include format only changes (which also makes it harder to see the actual functional change in the review).

Anyway, great work. Let me know when you are finished with the PR but yes generally we desire "style changes" in a separate PR from "functional changes" just to make it easier to review the diff.

Perhaps we could use the Google Java format and Roll with that? Something like the https://github.com/spotify/fmt-maven-plugin?

@SentryMan
Copy link
Collaborator Author

Yeah, looks like the issue with this is that JsonB is incorrectly parsing the fields with annotations, I made some changes to Jsonb and it works on my local.

@rbygrave
Copy link
Contributor

This PR is getting way too big - its currently +3,043 −229

@rbygrave
Copy link
Contributor

Google Java format

This project as got a .editorconfig ... but the issue is that it hasn't got an entry for line width. In the meantime we need to check the diff before commit to not include style changes.

@SentryMan
Copy link
Collaborator Author

Most of it is coming from the new test module that caught the bug. Shall I remove?

Copy link
Contributor

@rbygrave rbygrave left a comment

Choose a reason for hiding this comment

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

I'm seeing a long of "style change only" changes ... why don't these go in a separate PR so that we can see the functional changes easier

@SentryMan SentryMan requested a review from rbygrave October 20, 2022 01:41
if (i > 0) {
writer.append(", ");
}
params.get(i).buildParamName(writer);
}
writer.append(")");

writer.append(");").eol();
Copy link
Contributor

Choose a reason for hiding this comment

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

note to check this

@@ -46,10 +63,15 @@ private void writeForMethod(MethodReader method) {
private void writeClassStart() {
writer.append(AT_GENERATED).eol();
writer.append("@Component").eol();
writer.append("public class ").append(shortName).append("$Route implements WebRoutes {").eol().eol();
writer
Copy link
Contributor

Choose a reason for hiding this comment

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

format

@@ -58,7 +68,8 @@ public void writeReadParameter(Append writer, ParamType paramType, String paramN
}

@Override
public void writeReadParameter(Append writer, ParamType paramType, String paramName, String paramDefault) {
public void writeReadParameter(
Copy link
Contributor

Choose a reason for hiding this comment

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

format

}

@Override
public void writeControllerAdapter(ProcessingContext ctx, ControllerReader reader) throws IOException {
new ControllerWriter(reader, ctx).write();
public void writeControllerAdapter(ProcessingContext ctx, ControllerReader reader)
Copy link
Contributor

Choose a reason for hiding this comment

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

format


ControllerWriter(ControllerReader reader, ProcessingContext ctx, boolean jsonB) throws IOException {
ControllerWriter(ControllerReader reader, ProcessingContext ctx, boolean jsonB)
Copy link
Contributor

Choose a reason for hiding this comment

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

format

for (UType type : jsonTypes.values()) {
writer.append(" private final JsonType<%s> %sJsonType;", primitiveWrap(type.full()), type.shortName()).eol();
for (final UType type : jsonTypes.values()) {
writer
Copy link
Contributor

Choose a reason for hiding this comment

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

format

writer.append(" this.%sJsonType = jsonB.type(", type.shortName());
writeJsonbType(type);
for (final UType type : jsonTypes.values()) {
JsonBUtil.writeJsonbType(type, writer);
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's the little things in life that mean the most

@@ -30,7 +30,8 @@ protected PlatformAdapter providePlatformAdapter() {
}

@Override
public void writeControllerAdapter(ProcessingContext ctx, ControllerReader reader) throws IOException {
public void writeControllerAdapter(ProcessingContext ctx, ControllerReader reader)
throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

format

@@ -0,0 +1,201 @@
Apache License
Copy link
Contributor

Choose a reason for hiding this comment

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

oh yeah, I don't think we want this here. We have a LICENSE file at the top of the project and that is expected to cover all content in the project. IMO it's a negative to add extra LICENSE files in sub-directories.

@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Contributor

Choose a reason for hiding this comment

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

format

@rbygrave rbygrave added this to the 1.19 milestone Oct 20, 2022
@rbygrave rbygrave merged commit 9626702 into avaje:master Oct 20, 2022
@SentryMan SentryMan deleted the javalinJsonB branch October 20, 2022 14:24
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.

2 participants