How to generate Retrofit client library from wp rest api using swagger How to generate Retrofit client library from wp rest api using swagger wordpress wordpress

How to generate Retrofit client library from wp rest api using swagger


Citing from here, yes it is part of the existing codegen module of swagger:

The latest Java API client supports different HTTP client including Retrofit. To use Retrofit, please create a config.json file as follows:

{  "library": "retrofit"}

and pass config.json via -c in the command line

You can run java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar config-help -l java for more information on customizing the Java API client.


As per discussion with wp-api team they are not providing any HTTP client library for android and also they are not planning to provide the same .

Please follow below link for the issue created in wp-api

https://github.com/WP-API/WP-API/issues/2473


If you have a swagger 2.0 you better try Swagger Gradle Codegen, Generates Kotlin code and Retrofit interfaces, with RxJava2 for async calls, Moshi for serialization and ThreeTenABP for Data management