@@ -5,13 +5,17 @@ import { execute } from "../../utils/shellUtils";
55import { copyLicense } from "../../utils/licenseUtils" ;
66import { fixPathsInReplacedReadme } from "../../utils/fileUtils" ;
77
8- const dropObjectPattern = ( s : any ) => {
8+
9+ const simplifyPattern = ( value : string ) => {
10+ if ( value ) value = value . replace ( / \? \< .+ ?\> / , '' )
11+ }
12+ const simplifyObjectPattern = ( s : any ) => {
913 if ( ! s . properties ) return ;
1014 for ( const property of Object . values ( s . properties ) ) {
1115 const p : any = property ;
12- delete p . pattern ;
16+ p . pattern = simplifyPattern ( p . pattern ) ;
1317 if ( p . items ) {
14- dropObjectPattern ( p . items )
18+ simplifyObjectPattern ( p . items )
1519 }
1620 }
1721}
@@ -29,7 +33,7 @@ export const generatePythonClient = async (
2933 // example value: '.components.schemas.iam_project_policy_create.properties.resource'
3034 for ( const schema of Object . values ( specification . components . schemas ) ) {
3135 const s : any = schema ;
32- dropObjectPattern ( s ) ;
36+ simplifyObjectPattern ( s ) ;
3337 }
3438 // example value: .paths["/iam/project/{projectId}/policy"].get.parameters
3539 for ( const endpoint of Object . values ( specification . paths ) ) {
@@ -40,7 +44,7 @@ export const generatePythonClient = async (
4044 for ( const parameter of o . parameters ) {
4145 const p : any = parameter ;
4246 if ( ! p . schema ) continue ;
43- delete p . schema . pattern ;
47+ p . schema . pattern = simplifyPattern ( p . pattern ) ;
4448 }
4549 }
4650 }
0 commit comments