|
17 | 17 | package org.openapitools.codegen.languages; |
18 | 18 |
|
19 | 19 | import io.swagger.v3.oas.models.media.Schema; |
20 | | -import io.swagger.v3.oas.models.parameters.Parameter; |
21 | | -import io.swagger.v3.oas.models.parameters.RequestBody; |
22 | 20 | import lombok.Getter; |
23 | 21 | import lombok.Setter; |
24 | 22 | import org.openapitools.codegen.*; |
@@ -269,34 +267,6 @@ private boolean isLanguageGenericType(String type) { |
269 | 267 | return false; |
270 | 268 | } |
271 | 269 |
|
272 | | - @Override |
273 | | - public List<CodegenParameter> fromRequestBodyToFormParameters(RequestBody body, Set<String> imports) { |
274 | | - List<CodegenParameter> superParams = super.fromRequestBodyToFormParameters(body, imports); |
275 | | - List<CodegenParameter> extendedParams = new ArrayList<CodegenParameter>(); |
276 | | - for (CodegenParameter cp : superParams) { |
277 | | - extendedParams.add(new ExtendedCodegenParameter(cp)); |
278 | | - } |
279 | | - return extendedParams; |
280 | | - } |
281 | | - |
282 | | - @Override |
283 | | - public ExtendedCodegenParameter fromParameter(Parameter parameter, Set<String> imports) { |
284 | | - CodegenParameter cp = super.fromParameter(parameter, imports); |
285 | | - return new ExtendedCodegenParameter(cp); |
286 | | - } |
287 | | - |
288 | | - @Override |
289 | | - public CodegenParameter fromFormProperty(String name, Schema propertySchema, Set<String> imports) { |
290 | | - CodegenParameter cp = super.fromFormProperty(name, propertySchema, imports); |
291 | | - return new ExtendedCodegenParameter(cp); |
292 | | - } |
293 | | - |
294 | | - @Override |
295 | | - public CodegenParameter fromRequestBody(RequestBody body, Set<String> imports, String bodyParameterName) { |
296 | | - CodegenParameter cp = super.fromRequestBody(body, imports, bodyParameterName); |
297 | | - return new ExtendedCodegenParameter(cp); |
298 | | - } |
299 | | - |
300 | 270 | @Override |
301 | 271 | public void postProcessParameter(CodegenParameter parameter) { |
302 | 272 | super.postProcessParameter(parameter); |
@@ -360,10 +330,8 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap operations, L |
360 | 330 | // Overwrite path to TypeScript template string, after applying everything we just did. |
361 | 331 | op.path = pathBuffer.toString(); |
362 | 332 |
|
363 | | - for (CodegenParameter cpParam : op.allParams) { |
364 | | - ExtendedCodegenParameter param = (ExtendedCodegenParameter) cpParam; |
365 | | - |
366 | | - param.hasSanitizedName = !param.baseName.equals(param.paramName); |
| 333 | + for (CodegenParameter param : op.allParams) { |
| 334 | + param.vendorExtensions.putIfAbsent("x-param-has-sanitized-name", !param.baseName.equals(param.paramName)); |
367 | 335 | } |
368 | 336 | } |
369 | 337 |
|
@@ -520,126 +488,6 @@ public String removeModelPrefixSuffix(String name) { |
520 | 488 | return result; |
521 | 489 | } |
522 | 490 |
|
523 | | - public class ExtendedCodegenParameter extends CodegenParameter { |
524 | | - public boolean hasSanitizedName = false; |
525 | | - |
526 | | - public ExtendedCodegenParameter(CodegenParameter cp) { |
527 | | - super(); |
528 | | - |
529 | | - this.isFormParam = cp.isFormParam; |
530 | | - this.isQueryParam = cp.isQueryParam; |
531 | | - this.isPathParam = cp.isPathParam; |
532 | | - this.isHeaderParam = cp.isHeaderParam; |
533 | | - this.isCookieParam = cp.isCookieParam; |
534 | | - this.isBodyParam = cp.isBodyParam; |
535 | | - this.isContainer = cp.isContainer; |
536 | | - this.isCollectionFormatMulti = cp.isCollectionFormatMulti; |
537 | | - this.isPrimitiveType = cp.isPrimitiveType; |
538 | | - this.isModel = cp.isModel; |
539 | | - this.isExplode = cp.isExplode; |
540 | | - this.baseName = cp.baseName; |
541 | | - this.paramName = cp.paramName; |
542 | | - this.dataType = cp.dataType; |
543 | | - this.datatypeWithEnum = cp.datatypeWithEnum; |
544 | | - this.dataFormat = cp.dataFormat; |
545 | | - this.contentType = cp.contentType; |
546 | | - this.collectionFormat = cp.collectionFormat; |
547 | | - this.description = cp.description; |
548 | | - this.unescapedDescription = cp.unescapedDescription; |
549 | | - this.baseType = cp.baseType; |
550 | | - this.defaultValue = cp.defaultValue; |
551 | | - this.enumName = cp.enumName; |
552 | | - this.style = cp.style; |
553 | | - this.nameInLowerCase = cp.nameInLowerCase; |
554 | | - this.example = cp.example; |
555 | | - this.jsonSchema = cp.jsonSchema; |
556 | | - this.isString = cp.isString; |
557 | | - this.isNumeric = cp.isNumeric; |
558 | | - this.isInteger = cp.isInteger; |
559 | | - this.isLong = cp.isLong; |
560 | | - this.isNumber = cp.isNumber; |
561 | | - this.isFloat = cp.isFloat; |
562 | | - this.isDouble = cp.isDouble; |
563 | | - this.isDecimal = cp.isDecimal; |
564 | | - this.isByteArray = cp.isByteArray; |
565 | | - this.isBinary = cp.isBinary; |
566 | | - this.isBoolean = cp.isBoolean; |
567 | | - this.isDate = cp.isDate; |
568 | | - this.isDateTime = cp.isDateTime; |
569 | | - this.isUuid = cp.isUuid; |
570 | | - this.isUri = cp.isUri; |
571 | | - this.isEmail = cp.isEmail; |
572 | | - this.isFreeFormObject = cp.isFreeFormObject; |
573 | | - this.isAnyType = cp.isAnyType; |
574 | | - this.isArray = cp.isArray; |
575 | | - this.isMap = cp.isMap; |
576 | | - this.isFile = cp.isFile; |
577 | | - this.isEnum = cp.isEnum; |
578 | | - this.isEnumRef = cp.isEnumRef; |
579 | | - this._enum = cp._enum; |
580 | | - this.allowableValues = cp.allowableValues; |
581 | | - this.items = cp.items; |
582 | | - this.additionalProperties = cp.additionalProperties; |
583 | | - this.vars = cp.vars; |
584 | | - this.requiredVars = cp.requiredVars; |
585 | | - this.mostInnerItems = cp.mostInnerItems; |
586 | | - this.vendorExtensions = cp.vendorExtensions; |
587 | | - this.hasValidation = cp.hasValidation; |
588 | | - this.isNullable = cp.isNullable; |
589 | | - this.required = cp.required; |
590 | | - this.maximum = cp.maximum; |
591 | | - this.exclusiveMaximum = cp.exclusiveMaximum; |
592 | | - this.minimum = cp.minimum; |
593 | | - this.exclusiveMinimum = cp.exclusiveMinimum; |
594 | | - this.maxLength = cp.maxLength; |
595 | | - this.minLength = cp.minLength; |
596 | | - this.pattern = cp.pattern; |
597 | | - this.maxItems = cp.maxItems; |
598 | | - this.minItems = cp.minItems; |
599 | | - this.uniqueItems = cp.uniqueItems; |
600 | | - this.multipleOf = cp.multipleOf; |
601 | | - this.setHasVars(cp.getHasVars()); |
602 | | - this.setHasRequired(cp.getHasRequired()); |
603 | | - this.setMaxProperties(cp.getMaxProperties()); |
604 | | - this.setMinProperties(cp.getMinProperties()); |
605 | | - } |
606 | | - |
607 | | - @Override |
608 | | - public ExtendedCodegenParameter copy() { |
609 | | - CodegenParameter superCopy = super.copy(); |
610 | | - ExtendedCodegenParameter output = new ExtendedCodegenParameter(superCopy); |
611 | | - output.hasSanitizedName = this.hasSanitizedName; |
612 | | - return output; |
613 | | - } |
614 | | - |
615 | | - @Override |
616 | | - public boolean equals(Object o) { |
617 | | - if (o == null) |
618 | | - return false; |
619 | | - |
620 | | - if (this.getClass() != o.getClass()) |
621 | | - return false; |
622 | | - |
623 | | - boolean result = super.equals(o); |
624 | | - ExtendedCodegenParameter that = (ExtendedCodegenParameter) o; |
625 | | - return result && hasSanitizedName == that.hasSanitizedName; |
626 | | - } |
627 | | - |
628 | | - @Override |
629 | | - public int hashCode() { |
630 | | - int superHash = super.hashCode(); |
631 | | - return Objects.hash(superHash, hasSanitizedName); |
632 | | - } |
633 | | - |
634 | | - @Override |
635 | | - public String toString() { |
636 | | - String superString = super.toString(); |
637 | | - final StringBuilder sb = new StringBuilder(superString); |
638 | | - sb.append(", hasSanitizedName=").append(hasSanitizedName); |
639 | | - return sb.toString(); |
640 | | - } |
641 | | - } |
642 | | - |
643 | 491 | /** |
644 | 492 | * Validates that the given string value only contains '-', '.' and alpha numeric characters. |
645 | 493 | * Throws an IllegalArgumentException, if the string contains any other characters. |
|
0 commit comments