You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When defining a model property as an enum, single quotes are not escaped.
Example input:
definitions:
Order:
title: Pet Order
description: An order for a pets from the pet store
type: object
properties:
status:
type: string
description: Order Status
enum:
- pla'ced
- approved
- delivered
Example output:
export interface Order {
status?: Order.StatusEnum;
}
export namespace Order {
export type StatusEnum = 'pla'ced' | 'approved' | 'delivered';
export const StatusEnum = {
Placed: 'pla'ced' as StatusEnum,
Approved: 'approved' as StatusEnum,
Delivered: 'delivered' as StatusEnum
}
}
Description
When defining a model property as an enum, single quotes are not escaped.
Example input:
Example output:
Swagger-codegen version
2.3.0
Suggest a fix/enhancement
Fixing the escaping in https://github.com/swagger-api/swagger-codegen/blob/v2.3.0/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractTypeScriptClientCodegen.java#L342
should solve the issue.
The
escapeText()
method inhttps://github.com/swagger-api/swagger-codegen/blob/v2.3.0/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java#L376
does not escape single quotes.
The text was updated successfully, but these errors were encountered: