diff --git a/README.md b/README.md index 20029bae..fe2346e1 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,5 @@ -# project-name +# apollo-openapi -Do whatever you want with this template, typically used to create a new project. - -## Variables - -> globally replace the following variable(e.g., `git-repo-name`) with your project details using your editor's find-and-replace tool. - -- git-repo-name: the Git repository name +![OpenAPI](https://img.shields.io/badge/spec-OpenAPI%203.1-blue) +[![npm](https://img.shields.io/npm/v/apollo-openapi?label=npm&color=cb3837&logo=npm)](https://www.npmjs.com/package/apollo-openapi) +[![PyPI version](https://img.shields.io/pypi/v/apollo-openapi.svg)](https://pypi.org/project/apollo-openapi) diff --git a/clean.sh b/clean.sh new file mode 100644 index 00000000..0fb5548e --- /dev/null +++ b/clean.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -e + +JAVA_DIR="java" +PYTHON_DIR="python" +RUST_DIR="rust" +TS_DIR="typescript" + +echo "๐Ÿงน Cleaning old generated SDKs..." +rm -rf "$JAVA_DIR" +rm -rf "$PYTHON_DIR" +rm -rf "$RUST_DIR" +rm -rf "$TS_DIR" diff --git a/generate.sh b/generate.sh new file mode 100644 index 00000000..f0722180 --- /dev/null +++ b/generate.sh @@ -0,0 +1,39 @@ +#!/bin/bash +set -e + +SPEC_FILE="apollo-openapi.yaml" +JAVA_DIR="java" +PYTHON_DIR="python" +RUST_DIR="rust" +TS_DIR="typescript" + +echo "๐Ÿงน Cleaning old generated SDKs..." +rm -rf "$JAVA_DIR" +rm -rf "$PYTHON_DIR" +rm -rf "$RUST_DIR" +rm -rf "$TS_DIR" + +echo "๐Ÿš€ Generating Python SDK..." +openapi-generator generate \ + -i "$SPEC_FILE" \ + -g python \ + -o "$PYTHON_DIR" \ + --package-name apollo_openapi \ + --additional-properties=projectName=apollo-openapi,packageVersion=0.0.1 + +echo "๐Ÿš€ Generating TypeScript SDK..." +openapi-generator generate \ + -i "$SPEC_FILE" \ + -g typescript-fetch \ + -o "$TS_DIR" \ + --additional-properties=npmName=apollo-openapi,npmVersion=0.0.1,typescriptThreePlus=true + +echo "๐Ÿš€ Generating Rust SDK..." +openapi-generator generate \ + -i "$SPEC_FILE" \ + -g rust \ + -o "$RUST_DIR" \ + --global-property models,supportingFiles \ + --additional-properties=packageName=apollo-openapi,packageVersion=0.0.1 + +echo "โœ… SDK generation complete."