11import { join } from "path" ;
2- import { readFile , writeFile } from "fs/promises" ;
32
43import { execute } from "../../utils/shellUtils" ;
54import { copyLicense } from "../../utils/licenseUtils" ;
@@ -22,29 +21,6 @@ export const generatePythonClient = async (
2221) : Promise < void > => {
2322 const config = join ( __dirname , "config.yaml" ) ;
2423 const generator = "python" ;
25- const specification = JSON . parse ( await readFile ( openapiFile , {
26- encoding : 'utf-8'
27- } ) ) ;
28- // python does not pass validation our regexp
29- // example value: '.components.schemas.iam_project_policy_create.properties.resource'
30- for ( const schema of Object . values ( specification . components . schemas ) ) {
31- const s : any = schema ;
32- dropObjectPattern ( s ) ;
33- }
34- // example value: .paths["/iam/project/{projectId}/policy"].get.parameters
35- for ( const endpoint of Object . values ( specification . paths ) ) {
36- const e : any = endpoint ;
37- for ( const operation of Object . values ( e ) ) {
38- const o : any = operation ;
39- if ( ! o . parameters ) continue ;
40- for ( const parameter of o . parameters ) {
41- const p : any = parameter ;
42- if ( ! p . schema ) continue ;
43- delete p . schema . pattern ;
44- }
45- }
46- }
47- await writeFile ( openapiFile , JSON . stringify ( specification , null , 4 ) ) ;
4824 await execute (
4925 `yarn openapi-generator-cli generate --git-user-id "hyperonecom" --git-repo-id "h1-client-python" -i ${ openapiFile } -c ${ config } -g ${ generator } -o ${ outputDir } `
5026 ) ;
0 commit comments