Skip to content

Commit 7bf5ea8

Browse files
authored
feat: add generate script update readme (#5)
Signed-off-by: Zhangjian He <hezhangjian97@gmail.com>
1 parent ad64af9 commit 7bf5ea8

File tree

3 files changed

+56
-8
lines changed

3 files changed

+56
-8
lines changed

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
# project-name
1+
# apollo-openapi
22

3-
Do whatever you want with this template, typically used to create a new project.
4-
5-
## Variables
6-
7-
> globally replace the following variable(e.g., `git-repo-name`) with your project details using your editor's find-and-replace tool.
8-
9-
- git-repo-name: the Git repository name
3+
![OpenAPI](https://img.shields.io/badge/spec-OpenAPI%203.1-blue)
4+
[![npm](https://img.shields.io/npm/v/apollo-openapi?label=npm&color=cb3837&logo=npm)](https://www.npmjs.com/package/apollo-openapi)
5+
[![PyPI version](https://img.shields.io/pypi/v/apollo-openapi.svg)](https://pypi.org/project/apollo-openapi)

clean.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
set -e
3+
4+
JAVA_DIR="java"
5+
PYTHON_DIR="python"
6+
RUST_DIR="rust"
7+
TS_DIR="typescript"
8+
9+
echo "🧹 Cleaning old generated SDKs..."
10+
rm -rf "$JAVA_DIR"
11+
rm -rf "$PYTHON_DIR"
12+
rm -rf "$RUST_DIR"
13+
rm -rf "$TS_DIR"

generate.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
set -e
3+
4+
SPEC_FILE="apollo-openapi.yaml"
5+
JAVA_DIR="java"
6+
PYTHON_DIR="python"
7+
RUST_DIR="rust"
8+
TS_DIR="typescript"
9+
10+
echo "🧹 Cleaning old generated SDKs..."
11+
rm -rf "$JAVA_DIR"
12+
rm -rf "$PYTHON_DIR"
13+
rm -rf "$RUST_DIR"
14+
rm -rf "$TS_DIR"
15+
16+
echo "🚀 Generating Python SDK..."
17+
openapi-generator generate \
18+
-i "$SPEC_FILE" \
19+
-g python \
20+
-o "$PYTHON_DIR" \
21+
--package-name apollo_openapi \
22+
--additional-properties=projectName=apollo-openapi,packageVersion=0.0.1
23+
24+
echo "🚀 Generating TypeScript SDK..."
25+
openapi-generator generate \
26+
-i "$SPEC_FILE" \
27+
-g typescript-fetch \
28+
-o "$TS_DIR" \
29+
--additional-properties=npmName=apollo-openapi,npmVersion=0.0.1,typescriptThreePlus=true
30+
31+
echo "🚀 Generating Rust SDK..."
32+
openapi-generator generate \
33+
-i "$SPEC_FILE" \
34+
-g rust \
35+
-o "$RUST_DIR" \
36+
--global-property models,supportingFiles \
37+
--additional-properties=packageName=apollo-openapi,packageVersion=0.0.1
38+
39+
echo "✅ SDK generation complete."

0 commit comments

Comments
 (0)