Skip to content

Commit

Permalink
Merge pull request #962 from vyobukhov/feature/support-empty-model-pr…
Browse files Browse the repository at this point in the history
…operties

Add support for empty model properties that are valid in OpenAPI
  • Loading branch information
ferdikoomen authored Feb 10, 2022
2 parents 14f626f + 14b4906 commit 6f5d0e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/openApi/v3/parser/escapeName.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { escapeName } from './escapeName';

describe('escapeName', () => {
it('should escape', () => {
expect(escapeName('')).toEqual('');
expect(escapeName('')).toEqual("''");
expect(escapeName('fooBar')).toEqual('fooBar');
expect(escapeName('Foo Bar')).toEqual(`'Foo Bar'`);
expect(escapeName('foo bar')).toEqual(`'foo bar'`);
Expand Down
2 changes: 1 addition & 1 deletion src/openApi/v3/parser/escapeName.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const escapeName = (value: string): string => {
if (value) {
if (value || value === '') {
const validName = /^[a-zA-Z_$][\w$]+$/g.test(value);
if (!validName) {
return `'${value}'`;
Expand Down

0 comments on commit 6f5d0e4

Please sign in to comment.