1
1
import { join } from "path" ;
2
- import { readFile , writeFile } from "fs/promises" ;
3
2
4
3
import { execute } from "../../utils/shellUtils" ;
5
4
import { copyLicense } from "../../utils/licenseUtils" ;
@@ -22,29 +21,6 @@ export const generatePythonClient = async (
22
21
) : Promise < void > => {
23
22
const config = join ( __dirname , "config.yaml" ) ;
24
23
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 ) ) ;
48
24
await execute (
49
25
`yarn openapi-generator-cli generate --git-user-id "hyperonecom" --git-repo-id "h1-client-python" -i ${ openapiFile } -c ${ config } -g ${ generator } -o ${ outputDir } `
50
26
) ;
0 commit comments