Azure / autorest.java

Extension for AutoRest (https://github.com/Azure/autorest) that generates Java code
MIT License
33 stars 82 forks source link

maven-checkstyle-plugin complains in generated AsyncClient method name and types #1206

Open ambientlight opened 3 years ago

ambientlight commented 3 years ago

I am performing a codegen for specification/maps/data-plane/Render/readme.md with:

autorest --java --use:../autorest.java --sync-methods=all --track2 --version=3.3.2 --generate-sync-async-clients:true --java.azure-libraries-for-java-folder=$SDK_PATH/sdk/maps --pipeline.modelerfour.additional-checks=false --pipeline.modelerfour.lenient-model-deduplication=true --verbose --sdk-integration --java.license-header=MICROSOFT_MIT_SMALL $README_PATH

autorest.java: checked out locally at b4bb70d15f609844fbfa198334f80398b170908a

Resulting produced codegen builds fine, the only problem is maven-checkstyle-plugin compailing on generated AsyncClient code, just disabling maven-checkstyle-plugin is enough.

A following set of style errors produced for the RenderAsyncClient.java:

[INFO] --- maven-checkstyle-plugin:3.1.2:check (default) @ azure-maps-render ---
[INFO] Starting audit...
[ERROR] /home/ambientlight/repos/azure-sdk-for-java/sdk/maps/azure-maps-render/src/main/java/com/azure/maps/render/RenderAsyncClient.java:260:5: Return type is 'Mono<StreamResponse>', the method name must not end with 'WithResponse'. [ServiceClient]
[ERROR] /home/ambientlight/repos/azure-sdk-for-java/sdk/maps/azure-maps-render/src/main/java/com/azure/maps/render/RenderAsyncClient.java:485:5: 'Asynchronous' service client with 'ReturnType.SINGLE' should use type 'Mono' as the return type. [ServiceClient]
[ERROR] /home/ambientlight/repos/azure-sdk-for-java/sdk/maps/azure-maps-render/src/main/java/com/azure/maps/render/RenderAsyncClient.java:543:5: Return type is 'Mono<StreamResponse>', the method name must not end with 'WithResponse'. [ServiceClient]
[ERROR] /home/ambientlight/repos/azure-sdk-for-java/sdk/maps/azure-maps-render/src/main/java/com/azure/maps/render/RenderAsyncClient.java:597:5: 'Asynchronous' service client with 'ReturnType.SINGLE' should use type 'Mono' as the return type. [ServiceClient]
[ERROR] /home/ambientlight/repos/azure-sdk-for-java/sdk/maps/azure-maps-render/src/main/java/com/azure/maps/render/RenderAsyncClient.java:627:5: Return type is 'Mono<StreamResponse>', the method name must not end with 'WithResponse'. [ServiceClient]
[ERROR] /home/ambientlight/repos/azure-sdk-for-java/sdk/maps/azure-maps-render/src/main/java/com/azure/maps/render/RenderAsyncClient.java:649:5: 'Asynchronous' service client with 'ReturnType.SINGLE' should use type 'Mono' as the return type. [ServiceClient]
[ERROR] /home/ambientlight/repos/azure-sdk-for-java/sdk/maps/azure-maps-render/src/main/java/com/azure/maps/render/RenderAsyncClient.java:714:5: Return type is 'Mono<StreamResponse>', the method name must not end with 'WithResponse'. [ServiceClient]
[ERROR] /home/ambientlight/repos/azure-sdk-for-java/sdk/maps/azure-maps-render/src/main/java/com/azure/maps/render/RenderAsyncClient.java:740:5: 'Asynchronous' service client with 'ReturnType.SINGLE' should use type 'Mono' as the return type. [ServiceClient]
[ERROR] /home/ambientlight/repos/azure-sdk-for-java/sdk/maps/azure-maps-render/src/main/java/com/azure/maps/render/RenderAsyncClient.java:938:5: Return type is 'Mono<StreamResponse>', the method name must not end with 'WithResponse'. [ServiceClient]
[ERROR] /home/ambientlight/repos/azure-sdk-for-java/sdk/maps/azure-maps-render/src/main/java/com/azure/maps/render/RenderAsyncClient.java:999:5: 'Asynchronous' service client with 'ReturnType.SINGLE' should use type 'Mono' as the return type. [ServiceClient]
Audit done.
alzimmermsft commented 3 years ago

Thanks for filing this @ambientlight. To me, this looks to be more of an issue with the custom Checkstyle rule we've written to flag this, mind filing an issue in the azure-sdk-for-java repo.