DEV Community

Kevin Jump
Kevin Jump

Posted on

EarlyAdopter's Guide Umbraco v14 - Updates - typescript codegen tool.

Most of the Early adopter posts were written against, preview releases of Umbraco and several small things have changed since then.

Where possible I have gone back into the original posts and made a note of the change. This post details a change since those early releases.

Codegen changes.

All credit to @leekelleher for this, there has been an update to the codegen tool - read the PR in the core umbraco project

In the early releases we were using openapi-typescript-codegen library to generate the typescript libraries for our c# api.

this library is being deprecated in May 2024, so the core team have switched over to Hey API's fork of this tool.

there are some little changes in the commands (and some switches are being deprecated) - but in general it's a direct swap, our generate command now looks like this:

"scripts": {
  "generate": "openapi-ts 
      --input http://localhost:123/umbraco/swagger 
      --output src/api 
      --debug true
      --enums typescript 
      --lint true 
      --schemas false"
}
Enter fullscreen mode Exit fullscreen mode

n.b you might have to turn this back into a single line in the package.json file

code changes.

really there are nearly no code changes switching to this library.

the new library is deprecating the postfixServices command which in our examples we used to make our resulting classes end with 'Resource' (e.g timeResource).

you can still use this today, but it will be removed shortly from the new tool.

With this option removed all of the resources will now be 'services' (e.g timeService). so a rename of that will be required in any code you are upgrading to the new codegen tool.

Top comments (0)