SDK JS
candidate
Aurélien Georget
candidate
M
Marco Wuethrich Pr
We use the official Documentation Plugin and use
openapi-typescript-codegen
to generate the model. I have given up after a long time of trying to generate a good working client with OpenAPI. Some abstraction in the code and the models are enough for me so far.R
Richard Weaver
In particular, would be good if the client SDK would unwrap the { data: { id, attributes: {} } structure and provide strong Typescript types.
Derrick Mehaffy
planned
Thomas F. K. Jorna
I really like https://github.com/kmariappan/strapi-client-js especially with Strapi's ability to generate typescript types!
Martin Salzburg
Alternatively you could specify the Strapi API with Open API and profit from the Open API generator project (https://github.com/OpenAPITools/openapi-generator), which can generate API Clients/SDKs in various programming languages ...
Kevin Vugts
Martin Salzburg: Is this really possible?!!
Martin Salzburg
Yes - "the" API only has to be defined via the OPEN API specification (e.g. https://spec.openapis.org/oas/v3.1.0). Based on its open api spec the code generators can generate API clients in various programming languages.
This approach could be used for strapis general REST API as well as the custom endpoints of a concrete strapi instance. Each instance just needs to generate its open api spec dynamically.
Shay Zhang
Martin Salzburg: But there's going to be some corner case. In my case, my setup of collections and components maybe a bit too complex for the code generation. I tried swagger codegen and openapi codegen, both doesn't output the exact result I want. I think it would be fantastic if there's a SDK embedded the power of tRPC, etc.
Aurélien Georget
candidate