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

Java language support redux #192

Open
wants to merge 85 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@kelnos
Copy link
Member

kelnos commented Mar 3, 2019

Based on & supersedes #176

Not ready for merge, but here's what we've got so far. I was planning to break this up into just Java language support and then client/framework support, but I've found that, because of my lack of familiarity with things, the only way I've been able to make sure everything works and also figure out what things need to be refactored and added has been to actually implement full protocol object and client support. So...

  • Make several Scala-specific things optional (implicits, package objects, etc.)
  • Add support for auxiliary class definitions.
  • Define initial JavaLanguage abstraction
  • Define JavaInterp
  • Jackson protocol interpreters:
    • EnumProtocolTermInterp
    • ModelProtocolTermInterp
    • ArrayProtocolTermInterp
    • ProtocolSupportTermInterp
    • PolyProtocolTermInterp
  • Framework interpreters:
    • ClientTermInterp for AsyncHttpClient (nearly done; only missing query/form/body param support)
    • ServerTermInterp for Dropwizard
    • FrameworkInterp for AHC/DW
    • CodegenApplication for DW
  • Provide an additional command to run the Java generator against example specifications

After I'm finished I can take a stab out of separating this into 3 PRs if you think it's worth it: 1) structural changes/refactoring, 2) base Java language support, and 3) DW server/AHC client/framework support.

(Note that I plan to force-push to this branch quite a bit, so don't base anything on it just yet.)

@kelnos kelnos requested a review from blast-hardcheese Mar 3, 2019

@kelnos kelnos force-pushed the kelnos:java-language-support branch 3 times, most recently from c9507d8 to 3e1b5aa Mar 4, 2019

Show resolved Hide resolved build.sbt Outdated
Show resolved Hide resolved modules/codegen/src/main/scala/com/twilio/guardrail/Common.scala Outdated
Show resolved Hide resolved modules/codegen/src/main/scala/com/twilio/guardrail/ProtocolGenerator.scala
Show resolved Hide resolved ...om/twilio/guardrail/generators/Java/AsyncHttpClientClientGenerator.scala Outdated
Show resolved Hide resolved ...om/twilio/guardrail/generators/Java/AsyncHttpClientClientGenerator.scala Outdated
Show resolved Hide resolved ...ala/com/twilio/guardrail/generators/Java/DropwizardServerGenerator.scala Outdated
Show resolved Hide resolved ...c/main/scala/com/twilio/guardrail/generators/Java/JacksonGenerator.scala Outdated
Show resolved Hide resolved ...c/main/scala/com/twilio/guardrail/generators/Java/JacksonGenerator.scala Outdated
Show resolved Hide resolved ...c/main/scala/com/twilio/guardrail/generators/Java/JacksonGenerator.scala Outdated
}): _*
)))

// TODO: leave out with${name}() if readOnlyKey?

This comment has been minimized.

@blast-hardcheese

blast-hardcheese Mar 5, 2019

Collaborator

"read only" means different things from the server side and client side. I haven't come up with a good way to represent this yet. We should want either use case to work correctly, and getting the response from a server and giving it to a client should work without resetting the read-only values to null.

@kelnos kelnos force-pushed the kelnos:java-language-support branch 3 times, most recently from 6b2b552 to ee851c9 Mar 5, 2019

@kelnos kelnos force-pushed the kelnos:java-language-support branch 7 times, most recently from feaa662 to a4f6a0d Mar 5, 2019

@blast-hardcheese blast-hardcheese referenced this pull request Mar 7, 2019

Closed

Java language support #176

3 of 8 tasks complete

@kelnos kelnos force-pushed the kelnos:java-language-support branch from a4f6a0d to 61f7b81 Mar 8, 2019

kelnos added some commits Mar 9, 2019

Use a CallBuilder pattern for AsyncHttpClient operations
The main method call takes only required parameters and returns a
${operationName}CallBuilder instance, which allows the user to
optionally add optional parameters, additional headers, etc., and then
call .call() to execute the request.
Better consumes/produces handling for Dropwizard
Picks the 'best' content-type to use, and also handles the difference
between urlencoded and form-data correctly.  Should probably handle all
possible combinations of consumes+produces and emit multiple resource
methods, but this will do for now.
Don't add a DW @path annotation to methods if the path is empty
It's not broken with empty paths, but Jersey warns about it on startup.

@kelnos kelnos force-pushed the kelnos:java-language-support branch from c25c9f0 to 4d1b12a Mar 16, 2019

@kelnos kelnos force-pushed the kelnos:java-language-support branch from 8be84fe to 9999804 Mar 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.