File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed
modules/openapi-generator/src
main/java/org/openapitools/codegen/languages
test/resources/3_0/powershell
samples/client/petstore/powershell-experimental/src/PSPetstore/Model Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 19
19
import io .swagger .v3 .oas .models .media .ArraySchema ;
20
20
import io .swagger .v3 .oas .models .media .Schema ;
21
21
import org .apache .commons .io .FilenameUtils ;
22
+ import org .apache .commons .lang3 .StringEscapeUtils ;
22
23
import org .apache .commons .lang3 .StringUtils ;
23
24
import org .openapitools .codegen .*;
24
25
import org .openapitools .codegen .meta .GeneratorMetadata ;
@@ -622,6 +623,28 @@ public void processOpts() {
622
623
supportingFiles .add (new SupportingFile ("appveyor.mustache" , "" , "appveyor.yml" ));
623
624
}
624
625
626
+ @ SuppressWarnings ("static-method" )
627
+ @ Override
628
+ public String escapeText (String input ) {
629
+
630
+ if (input == null ) {
631
+ return input ;
632
+ }
633
+
634
+ // remove \t, \n, \r
635
+ // replace \ with \\
636
+ // replace " with \"
637
+ // outter unescape to retain the original multi-byte characters
638
+ // finally escalate characters avoiding code injection
639
+ return escapeUnsafeCharacters (
640
+ StringEscapeUtils .unescapeJava (
641
+ StringEscapeUtils .escapeJava (input )
642
+ .replace ("\\ /" , "/" ))
643
+ .replaceAll ("[\\ t\\ n\\ r]" , " " )
644
+ .replace ("\\ " , "\\ \\ " )
645
+ .replace ("\" " , "\" \" " ));
646
+ }
647
+
625
648
@ Override
626
649
public String escapeUnsafeCharacters (String input ) {
627
650
return input .replace ("#>" , "#_>" ).replace ("<#" , "<_#" );
Original file line number Diff line number Diff line change @@ -689,6 +689,7 @@ components:
689
689
type : string
690
690
password :
691
691
type : string
692
+ pattern : ' ["A-Z]+-[0-9][0-9]'
692
693
phone :
693
694
type : string
694
695
userStatus :
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ function Initialize-PSUser {
62
62
[String ]
63
63
${Email} ,
64
64
[Parameter (Position = 5 , ValueFromPipelineByPropertyName = $true )]
65
+ [ValidatePattern (" ["" A-Z]+-[0-9][0-9]" )]
65
66
[String ]
66
67
${Password} ,
67
68
[Parameter (Position = 6 , ValueFromPipelineByPropertyName = $true )]
You can’t perform that action at this time.
0 commit comments