-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[NEW API CLIENT] Java Rest-assured #7492
Conversation
@@ -246,6 +248,11 @@ public void processOpts() { | |||
supportingFiles.remove(new SupportingFile("manifest.mustache", projectFolder, "AndroidManifest.xml")); | |||
} else if ("google-api-client".equals(getLibrary())) { | |||
additionalProperties.put("jackson", "true"); | |||
|
|||
} else if (REST_ASSURED.equals(getLibrary())) { | |||
additionalProperties.put("java8", "true"); |
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.
Would it be hard to make it compatible with java6 ? That way it could be used on android.
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.
Initially this client is supposed to be comatible with java8 and supporting java6 would mean rewriting most of the functions, which are used by client.
*/ | ||
@Test | ||
public void shouldSee405AfterAddPet() { | ||
Pet body = null; |
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.
The petstore samples should include actual tests against the petstore server to verify the generated code in CI
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.
Thanks a lot. I did it in c698765
a270bbc
to
c698765
Compare
|
||
package {{invokerPackage}}; | ||
|
||
import com.google.gson.Gson; |
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.
This template should be put in common with okhttp-gson
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.
Done
ApiClient has been added @deprecated has been added for operation {{{returnType}}} has been fixed build.gradle.mustache, build.sbt.mustache, api_doc_mustache has been added Samples has been added for rest-assured Useless supporting files has been removed for rest-assured Sample has been added for rest-assured
5955f62
to
6809d4d
Compare
@viclovsky I did some tests locally and the result is good. Thanks for your contribution. |
Added to CircleCI Java8 tests via 6bc84ee |
This is great! Can you point me to a sample that I can refer to try this? |
Hi @asaravindkumar! I have done a project https://github.com/viclovsky/swagger-rest-assured-example where I used swagger code generation. To my mind you can use it for experiments.. Moreover swagger-codegen project has tests examples for the client: https://github.com/swagger-api/swagger-codegen/tree/master/samples/client/petstore/java/rest-assured. Just for information: I am planning to add ability to customize mapper but it will be available after rest-assured 3.0.8 release. |
Hi @viclovsky, i cloned the project (https://github.com/viclovsky/swagger-rest-assured-example), during mvn clean install it showing error . example-api-client/target/generated-sources/swagger/src/main/java/ru/vicdev/example/swagger/client/api/PetApi.java:[258,36] no suitable method found for as(java.lang.reflect.Type) |
Hi @kuldeepkumar1989, my project had old version rest-assured (3.0.6). It has been updated now. |
This is great guys. Thanks @viclovsky |
PR checklist
./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\
.3.0.0
branch for changes related to OpenAPI spec 3.0. Default:master
.Description of the PR
There is a new API client. It can be used, for instance, for regression testing.
It based on rest-assured library: https://github.com/rest-assured/rest-assured
It is good for positive tests as well as negative.
I was inspired by RARC project: https://github.com/qameta/rarc
Added necessary tests.
Note: Java6 support will be in next PR