Skip to content

Commit

Permalink
Fixed enum for V2
Browse files Browse the repository at this point in the history
Bumped version
  • Loading branch information
ferdikoomen committed Feb 25, 2022
1 parent 9fb4329 commit fec6534
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/openApi/v2/parser/getEnum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion test/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ export enum EnumWithStrings {
/**
* null
*/
_SINGLE_QUOTE_ = ''Single Quote'',
_SINGLE_QUOTE_ = '\\\\'Single Quote\\\\'',
/**
* null
*/
Expand Down

0 comments on commit fec6534

Please sign in to comment.