-
Notifications
You must be signed in to change notification settings - Fork 14
(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
Conversation
SentryMan
commented
Oct 18, 2022
- Adds JsonB javalin generation
- moves a bunch of jsonb stuff into core module
- Test upgraded to Javalin 5
http-generator-core/src/main/java/io/avaje/http/generator/core/ElementReader.java
Outdated
Show resolved
Hide resolved
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? |
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. |
This PR is getting way too big - its currently +3,043 −229 |
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. |
Most of it is coming from the new test module that caught the bug. Shall I remove? |
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.
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
http-generator-core/src/main/java/io/avaje/http/generator/core/ElementReader.java
Outdated
Show resolved
Hide resolved
http-generator-core/src/main/java/io/avaje/http/generator/core/ElementReader.java
Outdated
Show resolved
Hide resolved
http-generator-core/src/main/java/io/avaje/http/generator/core/ElementReader.java
Outdated
Show resolved
Hide resolved
http-generator-core/src/main/java/io/avaje/http/generator/core/ElementReader.java
Outdated
Show resolved
Hide resolved
http-generator-core/src/main/java/io/avaje/http/generator/core/ElementReader.java
Outdated
Show resolved
Hide resolved
http-generator-core/src/main/java/io/avaje/http/generator/core/ElementReader.java
Outdated
Show resolved
Hide resolved
http-generator-core/src/main/java/io/avaje/http/generator/core/ElementReader.java
Outdated
Show resolved
Hide resolved
http-generator-core/src/main/java/io/avaje/http/generator/core/ElementReader.java
Outdated
Show resolved
Hide resolved
http-generator-core/src/main/java/io/avaje/http/generator/core/ElementReader.java
Outdated
Show resolved
Hide resolved
http-generator-core/src/main/java/io/avaje/http/generator/core/ElementReader.java
Outdated
Show resolved
Hide resolved
if (i > 0) { | ||
writer.append(", "); | ||
} | ||
params.get(i).buildParamName(writer); | ||
} | ||
writer.append(")"); | ||
|
||
writer.append(");").eol(); |
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.
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 |
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.
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( |
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.
format
} | ||
|
||
@Override | ||
public void writeControllerAdapter(ProcessingContext ctx, ControllerReader reader) throws IOException { | ||
new ControllerWriter(reader, ctx).write(); | ||
public void writeControllerAdapter(ProcessingContext ctx, ControllerReader reader) |
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.
format
|
||
ControllerWriter(ControllerReader reader, ProcessingContext ctx, boolean jsonB) throws IOException { | ||
ControllerWriter(ControllerReader reader, ProcessingContext ctx, boolean 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.
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 |
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.
format
writer.append(" this.%sJsonType = jsonB.type(", type.shortName()); | ||
writeJsonbType(type); | ||
for (final UType type : jsonTypes.values()) { | ||
JsonBUtil.writeJsonbType(type, writer); |
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.
nice
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 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 { |
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.
format
@@ -0,0 +1,201 @@ | |||
Apache License |
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.
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"?> |
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.
format