Add a configuration parameter for the generated ContentType enum to avoid name clashing
Adds a configuration parameter for the generated ContentType enum to avoid name clashing when the openapi schema already has a type called ContentType, this results in the generated enum called ContentType and an interface of the same name, which is a compile error in typescript
[!NOTE] Introduce configurable
contentTypeEnumNameand update templates to use it, preventing enum/name clashes.
- Config:
- Add
config.contentTypeEnumName(default:"ContentType") insrc/configuration.ts.- Templates:
- Replace hardcoded
ContentTypewithconfig.contentTypeEnumNameintemplates/base/http-clients/axios-http-client.ejsandfetch-http-client.ejs(enum declaration, request param type, formatters, header handling).- Update
templates/default/procedure-call.ejsandtemplates/modular/procedure-call.ejsto reference the configurable enum when setting requesttype.- Types:
- Extend
GenerateApiConfiguration["config"]withcontentTypeEnumNameintypes/index.ts(with JSDoc/default).- Changeset:
- Add patch changeset describing the new configuration option.
Written by Cursor Bugbot for commit 667c8a35d669fdbf5e4bcea8ef5a83175a8a04a3. This will update automatically on new commits. Configure here.
🦋 Changeset detected
Latest commit: 667c8a35d669fdbf5e4bcea8ef5a83175a8a04a3
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| swagger-typescript-api | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
bugbot run