hello, im a freelance web developer who mostly uses strapi for create quick and simple CRUD API’s and a Backoffice to hand over to my client’s content managers.
If there isn’t already a way to do this, i think it might be interesting to maybe look into developing such a feature. I don’t know how large the demand for something like that would be for the rest of the strapi community, but to me it’s an incredibly attractive one, especially for larger projects with more devs involved.
i wasn’t sure if i should post this here in the strapi forums or if in a github issue, so sorry if this is the wrong place for my inquiry
If you simply want to generate types for your API definitions for consumption in external projects, you can utilise the OpenAPI spec to do so. There’s many OpenAPI code generators available but I personally use the “typescript-fetch” template to generate both a HTTP REST client and the model definitions in TypeScript.
You can see in the screenshot below I’m consuming an endpoint for a single type called “Document”. You can see the auto-generate client and the model (Document):