Fixed enum for V2

Bumped version
This commit is contained in:
Ferdi Koomen 2022-02-25 22:25:38 +01:00
parent 9fb432968a
commit fec6534b91
4 changed files with 8 additions and 4 deletions

View File

@ -1,10 +1,14 @@
# Changelog
All notable changes to this project will be documented in this file.
## [0.20.1] - 2022-02-25
### Fixed
- Support enums with single quotes in names for V2
## [0.20.0] - 2022-02-25
### Fixed
- Updated dependencies
- Support enums with single quotes in names
- Support enums with single quotes in names for V3
- Generating better names when `operationId` is not given (breaking change)
- Fixed issue where `x-enum` flags where breaking due to non-string values

View File

@ -1,6 +1,6 @@
{
"name": "openapi-typescript-codegen",
"version": "0.20.0",
"version": "0.20.1",
"description": "Library that generates Typescript clients based on the OpenAPI specification.",
"author": "Ferdi Koomen",
"homepage": "https://github.com/ferdikoomen/openapi-typescript-codegen",

View File

@ -23,7 +23,7 @@ export const getEnum = (values?: (string | number)[]): Enum[] => {
.replace(/^(\d+)/g, '_$1')
.replace(/([a-z])([A-Z]+)/g, '$1_$2')
.toUpperCase(),
value: `'${value}'`,
value: `'${value.replace(/'/g, "\\'")}'`,
type: 'string',
description: null,
};

View File

@ -1000,7 +1000,7 @@ export enum EnumWithStrings {
/**
* null
*/
_SINGLE_QUOTE_ = ''Single Quote'',
_SINGLE_QUOTE_ = '\\\\'Single Quote\\\\'',
/**
* null
*/