Skip to content

Commit 8c2240c

Browse files
committed
Simplify build for Python
1 parent d5d579c commit 8c2240c

File tree

3 files changed

+16
-24
lines changed

3 files changed

+16
-24
lines changed

Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM node:14
2+
RUN apt-get update && apt-get install -y default-jre
3+
# TODO: make golang works
4+
ENTRYPOINT ["/bin/bash", "-c"]
5+
WORKDIR /src
6+
CMD ["yarn start ts && yarn start python"]

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
IMAGE_NAME?=h1-generators
2+
IMAGE_TAG?=latest
3+
4+
.PHONY: build
5+
build:
6+
docker build -t ${IMAGE_NAME}:${IMAGE_TAG} .
7+
8+
.PHONY: start
9+
start:
10+
docker run -v $$PWD:/src --workdir /src ${IMAGE_NAME}:${IMAGE_TAG} ${EXEC}

src/generators/python/index.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { join } from "path";
2-
import { readFile, writeFile } from "fs/promises";
32

43
import { execute } from "../../utils/shellUtils";
54
import { 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

Comments
 (0)