Skip to content

Commit c95a665

Browse files
committed
implement CR feedback
1 parent a76d74a commit c95a665

7 files changed

Lines changed: 21 additions & 9 deletions

File tree

modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ public String toString() {
429429
sb.append(", returnBaseType='").append(returnBaseType).append('\'');
430430
sb.append(", returnContainer='").append(returnContainer).append('\'');
431431
sb.append(", summary='").append(summary).append('\'');
432+
sb.append(", unescapedSummary='").append(unescapedSummary).append('\'');
432433
sb.append(", unescapedNotes='").append(unescapedNotes).append('\'');
433434
sb.append(", notes='").append(notes).append('\'');
434435
sb.append(", baseName='").append(baseName).append('\'');
@@ -502,6 +503,7 @@ public boolean equals(Object o) {
502503
Objects.equals(returnBaseType, that.returnBaseType) &&
503504
Objects.equals(returnContainer, that.returnContainer) &&
504505
Objects.equals(summary, that.summary) &&
506+
Objects.equals(unescapedSummary, that.unescapedSummary) &&
505507
Objects.equals(unescapedNotes, that.unescapedNotes) &&
506508
Objects.equals(notes, that.notes) &&
507509
Objects.equals(baseName, that.baseName) &&
@@ -547,7 +549,7 @@ public int hashCode() {
547549
returnTypeIsPrimitive, returnSimpleType, subresourceOperation, isMap,
548550
isArray, isMultipart, isVoid, isResponseBinary, isResponseFile, isResponseOptional, hasReference,
549551
isDeprecated, isCallbackRequest, uniqueItems, path, operationId, returnType, httpMethod,
550-
returnBaseType, returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse,
552+
returnBaseType, returnContainer, summary, unescapedSummary, unescapedNotes, notes, baseName, defaultResponse,
551553
discriminator, consumes, produces, prioritizedContentTypes, servers, bodyParam, allParams, bodyParams,
552554
pathParams, queryParams, headerParams, formParams, cookieParams, requiredParams, returnProperty, optionalParams,
553555
authMethods, tags, responses, callbacks, imports, examples, requestBodyExamples, externalDocs,

modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ public CodegenParameter copy() {
182182
output.multipleOf = this.multipleOf;
183183
output.jsonSchema = this.jsonSchema;
184184
output.defaultValue = this.defaultValue;
185+
output.unescapedDefaultValue = this.unescapedDefaultValue;
185186
output.enumDefaultValue = this.enumDefaultValue;
186187
output.example = this.example;
187188
output.examples = this.examples;
@@ -289,7 +290,7 @@ public int hashCode() {
289290
return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam,
290291
isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName,
291292
paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description,
292-
unescapedDescription, baseType, containerType, containerTypeMapped, defaultValue,
293+
unescapedDescription, baseType, containerType, containerTypeMapped, defaultValue, unescapedDefaultValue,
293294
enumDefaultValue, enumName, style, isDeepObject, isMatrix, isAllowEmptyValue, example, examples,
294295
isFormStyle, isSpaceDelimited, isPipeDelimited,
295296
jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal,
@@ -382,6 +383,7 @@ public boolean equals(Object o) {
382383
Objects.equals(containerType, that.containerType) &&
383384
Objects.equals(containerTypeMapped, that.containerTypeMapped) &&
384385
Objects.equals(defaultValue, that.defaultValue) &&
386+
Objects.equals(unescapedDefaultValue, that.unescapedDefaultValue) &&
385387
Objects.equals(enumDefaultValue, that.enumDefaultValue) &&
386388
Objects.equals(enumName, that.enumName) &&
387389
Objects.equals(style, that.style) &&
@@ -450,6 +452,7 @@ public String toString() {
450452
sb.append(", containerType='").append(containerType).append('\'');
451453
sb.append(", containerTypeMapped='").append(containerTypeMapped).append('\'');
452454
sb.append(", defaultValue='").append(defaultValue).append('\'');
455+
sb.append(", unescapedDefaultValue='").append(unescapedDefaultValue).append('\'');
453456
sb.append(", enumDefaultValue='").append(enumDefaultValue).append('\'');
454457
sb.append(", enumName='").append(enumName).append('\'');
455458
sb.append(", style='").append(style).append('\'');

modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,7 @@ public String toString() {
10001000
sb.append(", containerTypeMapped='").append(containerTypeMapped).append('\'');
10011001
sb.append(", title='").append(title).append('\'');
10021002
sb.append(", unescapedDescription='").append(unescapedDescription).append('\'');
1003+
sb.append(", unescapedDefaultValue='").append(unescapedDefaultValue).append('\'');
10031004
sb.append(", maxLength=").append(maxLength);
10041005
sb.append(", minLength=").append(minLength);
10051006
sb.append(", pattern='").append(pattern).append('\'');
@@ -1187,6 +1188,7 @@ public boolean equals(Object o) {
11871188
Objects.equals(containerTypeMapped, that.containerTypeMapped) &&
11881189
Objects.equals(title, that.title) &&
11891190
Objects.equals(unescapedDescription, that.unescapedDescription) &&
1191+
Objects.equals(unescapedDefaultValue, that.unescapedDefaultValue) &&
11901192
Objects.equals(maxLength, that.maxLength) &&
11911193
Objects.equals(minLength, that.minLength) &&
11921194
Objects.equals(pattern, that.pattern) &&
@@ -1220,7 +1222,7 @@ public int hashCode() {
12201222

12211223
return Objects.hash(openApiType, baseName, complexType, getter, setter, description,
12221224
dataType, datatypeWithEnum, dataFormat, name, min, max, defaultValue,
1223-
defaultValueWithParam, baseType, containerType, containerTypeMapped, title, unescapedDescription,
1225+
defaultValueWithParam, baseType, containerType, containerTypeMapped, title, unescapedDescription, unescapedDefaultValue,
12241226
maxLength, minLength, pattern, example, jsonSchema, minimum, maximum,
12251227
exclusiveMinimum, exclusiveMaximum, required, deprecated,
12261228
isPrimitiveType, isModel, isContainer, isString, isNumeric,

modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
110110

111111
@Override
112112
public int hashCode() {
113-
return Objects.hash(headers, code, message, examples, dataType, baseType, containerType, containerTypeMapped, hasHeaders,
113+
return Objects.hash(headers, code, message, unescapedMessage, examples, dataType, baseType, containerType, containerTypeMapped, hasHeaders,
114114
isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBoolean, isDate,
115115
isDateTime, isUuid, isEmail, isPassword, isModel, isFreeFormObject, isAnyType, isDefault, simpleType, primitiveType,
116116
isMap, isOptional, isArray, isBinary, isFile, schema, jsonSchema, vendorExtensions, items, additionalProperties,
@@ -183,6 +183,7 @@ public boolean equals(Object o) {
183183
Objects.equals(headers, that.headers) &&
184184
Objects.equals(code, that.code) &&
185185
Objects.equals(message, that.message) &&
186+
Objects.equals(unescapedMessage, that.unescapedMessage) &&
186187
Objects.equals(examples, that.examples) &&
187188
Objects.equals(dataType, that.dataType) &&
188189
Objects.equals(baseType, that.baseType) &&
@@ -583,6 +584,7 @@ public String toString() {
583584
sb.append(", is4xx='").append(is4xx).append('\'');
584585
sb.append(", is5xx='").append(is5xx).append('\'');
585586
sb.append(", message='").append(message).append('\'');
587+
sb.append(", unescapedMessage='").append(unescapedMessage).append('\'');
586588
sb.append(", examples=").append(examples);
587589
sb.append(", dataType='").append(dataType).append('\'');
588590
sb.append(", baseType='").append(baseType).append('\'');

modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,11 +477,14 @@ protected ImmutableMap.Builder<String, Lambda> addMustacheLambdas() {
477477
.put("trimWhitespace", new TrimWhitespaceLambda())
478478
.put("trimTrailingWithNewLine", new TrimTrailingWhiteSpaceLambda(true))
479479
.put("trimTrailing", new TrimTrailingWhiteSpaceLambda(false))
480-
// Escapes text for use inside a Markdown table cell.
481-
// \\ must be replaced first to avoid double-escaping subsequent replacements.
482-
// $ is escaped to prevent LaTeX math mode ($...$) in markdown renderers that support it.
480+
// Escapes text for use inside a Markdown table cell or inline text.
481+
// Order matters: \\ and & must be first to avoid double-escaping.
482+
// $ is escaped to prevent LaTeX math mode ($...$) in renderers that support it.
483483
.put("escapeMarkdown", (fragment, writer) -> writer.write(fragment.execute()
484484
.replace("\\", "\\\\")
485+
.replace("&", "&amp;")
486+
.replace("<", "&lt;")
487+
.replace(">", "&gt;")
485488
.replace("$", "\\$")
486489
.replace("|", "\\|")
487490
.replace("\r\n", " ")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
{{#defaultValue}} ?:{{#isInteger}}{{{defaultValue}}}{{/isInteger}}{{#isLong}}{{{defaultValue}}}L{{/isLong}}{{#isShort}}{{{defaultValue}}}.toShort(){{/isShort}}{{#isDouble}}{{{defaultValue}}}.toDouble(){{/isDouble}}{{#isFloat}}{{{defaultValue}}}f{{/isFloat}}{{#isEnum}}{{{dataType}}}.valueOf("{{{defaultValue}}}"){{/isEnum}}{{#isBoolean}}{{{defaultValue}}}{{/isBoolean}}{{#isString}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isString}}{{#isUuid}}"UUID.fromString({{{defaultValue}}})"{{/isUuid}}{{#isUuid}}"UUID.fromString({{{defaultValue}}})"{{/isUuid}}
1+
{{#defaultValue}} ?:{{#isInteger}}{{{defaultValue}}}{{/isInteger}}{{#isLong}}{{{defaultValue}}}L{{/isLong}}{{#isShort}}{{{defaultValue}}}.toShort(){{/isShort}}{{#isDouble}}{{{defaultValue}}}.toDouble(){{/isDouble}}{{#isFloat}}{{{defaultValue}}}f{{/isFloat}}{{#isEnum}}{{{dataType}}}.valueOf("{{{defaultValue}}}"){{/isEnum}}{{#isBoolean}}{{{defaultValue}}}{{/isBoolean}}{{#isString}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isString}}{{#isUuid}}"UUID.fromString({{{defaultValue}}})"{{/isUuid}}
22
{{/defaultValue}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
{{#defaultValue}} ?:{{#isInteger}}{{{defaultValue}}}{{/isInteger}}{{#isLong}}{{{defaultValue}}}L{{/isLong}}{{#isShort}}{{{defaultValue}}}.toShort(){{/isShort}}{{#isDouble}}{{{defaultValue}}}.toDouble(){{/isDouble}}{{#isFloat}}{{{defaultValue}}}f{{/isFloat}}{{#isEnum}}{{{dataType}}}.valueOf("{{{defaultValue}}}"){{/isEnum}}{{#isBoolean}}{{{defaultValue}}}{{/isBoolean}}{{#isString}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isString}}{{#isUuid}}"UUID.fromString({{{defaultValue}}})"{{/isUuid}}{{#isUuid}}"UUID.fromString({{{defaultValue}}})"{{/isUuid}}
1+
{{#defaultValue}} ?:{{#isInteger}}{{{defaultValue}}}{{/isInteger}}{{#isLong}}{{{defaultValue}}}L{{/isLong}}{{#isShort}}{{{defaultValue}}}.toShort(){{/isShort}}{{#isDouble}}{{{defaultValue}}}.toDouble(){{/isDouble}}{{#isFloat}}{{{defaultValue}}}f{{/isFloat}}{{#isEnum}}{{{dataType}}}.valueOf("{{{defaultValue}}}"){{/isEnum}}{{#isBoolean}}{{{defaultValue}}}{{/isBoolean}}{{#isString}}"{{#lambda.escapeInNormalString}}{{{unescapedDefaultValue}}}{{/lambda.escapeInNormalString}}"{{/isString}}{{#isUuid}}"UUID.fromString({{{defaultValue}}})"{{/isUuid}}
22
{{/defaultValue}}

0 commit comments

Comments
 (0)