Orocommerce - generate API client libraries

Viewed 108

I am quite new in the orocommerce ecosystem, and I would like to generate API client librairies automatically for orocommerce API (frontend and backend). The objective is to build my own UI.

I found some dependencies on NelmioApiDocBundle than could potentially generate swagger file, but I hit multiple problems:

  • this is a quite old version, that only support swagger 1.2
  • the generated file (using symfony run php bin/console api:swagger:dump /tmp/api/) seems not working with swagger codegen "as is"
  • all the part of the API seems not written using NelmioApiDocBundle annotation

I am wondering if there is an other mechanism to generate API client librairies for orocommerce. I would like a SDK for typescript.

Thanks in advance for your answer.

1 Answers

Right now, the only supported swagger version is 1.2, as you stated.

By default, the api:swagger:dump command works with an outdated API, to generate data for the current API, run it with --view=rest_json_api option:

api:swagger:dump --view=rest_json_api

As an alternative to the API client generation, as Oro API strictly follows JSON.API standard, you can use many existing client libraries, compatible with the JSON.API specification. The list of Typescript implementations can be found at the official website: https://jsonapi.org/implementations/#client-libraries-typescript

Related