@@ -5,13 +5,17 @@ import { execute } from "../../utils/shellUtils";
5
5
import { copyLicense } from "../../utils/licenseUtils" ;
6
6
import { fixPathsInReplacedReadme } from "../../utils/fileUtils" ;
7
7
8
- const dropObjectPattern = ( s : any ) => {
8
+
9
+ const simplifyPattern = ( value : string ) => {
10
+ if ( value ) value = value . replace ( / \? \< .+ ?\> / , '' )
11
+ }
12
+ const simplifyObjectPattern = ( s : any ) => {
9
13
if ( ! s . properties ) return ;
10
14
for ( const property of Object . values ( s . properties ) ) {
11
15
const p : any = property ;
12
- delete p . pattern ;
16
+ p . pattern = simplifyPattern ( p . pattern ) ;
13
17
if ( p . items ) {
14
- dropObjectPattern ( p . items )
18
+ simplifyObjectPattern ( p . items )
15
19
}
16
20
}
17
21
}
@@ -29,7 +33,7 @@ export const generatePythonClient = async (
29
33
// example value: '.components.schemas.iam_project_policy_create.properties.resource'
30
34
for ( const schema of Object . values ( specification . components . schemas ) ) {
31
35
const s : any = schema ;
32
- dropObjectPattern ( s ) ;
36
+ simplifyObjectPattern ( s ) ;
33
37
}
34
38
// example value: .paths["/iam/project/{projectId}/policy"].get.parameters
35
39
for ( const endpoint of Object . values ( specification . paths ) ) {
@@ -40,7 +44,7 @@ export const generatePythonClient = async (
40
44
for ( const parameter of o . parameters ) {
41
45
const p : any = parameter ;
42
46
if ( ! p . schema ) continue ;
43
- delete p . schema . pattern ;
47
+ p . schema . pattern = simplifyPattern ( p . pattern ) ;
44
48
}
45
49
}
46
50
}
0 commit comments