Skip to content

[java-client][okhttp-gson] no oauth2 usage when hasOAuthMethods is false#1872

Merged
wing328 merged 2 commits intoOpenAPITools:masterfrom
jmini:follow-up1838
Jan 10, 2019
Merged

[java-client][okhttp-gson] no oauth2 usage when hasOAuthMethods is false#1872
wing328 merged 2 commits intoOpenAPITools:masterfrom
jmini:follow-up1838

Conversation

@jmini
Copy link
Member

@jmini jmini commented Jan 10, 2019

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 3.4.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

@wing328 (author of #1838).
Java tech committee @bbdouglas (2017/07) @JFCote (2017/08) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01)

Description of the PR

Follow up from of PR #1838:

The org.apache.oltu.oauth2:org.apache.oltu.oauth2.client is now only included if hasOAuthMethods is true. See:

This means that when a spec do not use OAuth, the generated code should not use any of the classes provided by the dependency. Otherwise maven build for the generated lib looks like this:

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] <java-okhttp-gson project>/src/main/java/...../okhttpgson/auth/RetryingOAuth.java:[10,37] package org.apache.oltu.oauth2.client does not exist
[ERROR] <java-okhttp-gson project>/src/main/java/...../okhttpgson/auth/RetryingOAuth.java:[11,45] package org.apache.oltu.oauth2.client.request does not exist
[ERROR] <java-okhttp-gson project>/src/main/java/...../okhttpgson/auth/RetryingOAuth.java:[12,45] package org.apache.oltu.oauth2.client.request does not exist
[ERROR] <java-okhttp-gson project>/src/main/java/...../okhttpgson/auth/RetryingOAuth.java:[13,64] package org.apache.oltu.oauth2.client.request.OAuthClientRequest does not exist
[ERROR] <java-okhttp-gson project>/src/main/java/...../okhttpgson/auth/RetryingOAuth.java:[14,46] package org.apache.oltu.oauth2.client.response does not exist
[ERROR] <java-okhttp-gson project>/src/main/java/...../okhttpgson/auth/RetryingOAuth.java:[15,47] package org.apache.oltu.oauth2.common.exception does not exist
[ERROR] <java-okhttp-gson project>/src/main/java/...../okhttpgson/auth/RetryingOAuth.java:[16,47] package org.apache.oltu.oauth2.common.exception does not exist
[ERROR] <java-okhttp-gson project>/src/main/java/...../okhttpgson/auth/RetryingOAuth.java:[17,51] package org.apache.oltu.oauth2.common.message.types does not exist
[ERROR] <java-okhttp-gson project>/src/main/java/...../okhttpgson/auth/RetryingOAuth.java:[25,13] cannot find symbol
  symbol:   class OAuthClient
  location: class xxxxx.okhttpgson.auth.RetryingOAuth
...

This PR add more {#hasOAuthMethods}..{/hasOAuthMethods} to the templates.

@auto-labeler
Copy link

auto-labeler bot commented Jan 10, 2019

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@wing328 wing328 added this to the 4.0.0 milestone Jan 10, 2019
@wing328
Copy link
Member

wing328 commented Jan 10, 2019

Thanks for the fix!

@wing328 wing328 merged commit 8305df6 into OpenAPITools:master Jan 10, 2019
A-Joshi pushed a commit to ihsmarkitoss/openapi-generator that referenced this pull request Feb 27, 2019
…lse (OpenAPITools#1872)

* Fix Javadoc error

* [java-client][okhttp-gson] no oauth2 usage when hasOAuthMethods is false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants