Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: python-asyncio with all variants generated by openapi-generator #136

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 8 additions & 23 deletions openapi/python-asyncio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ popd > /dev/null

source "${SETTING_FILE}"

if [ ${PACKAGE_NAME} == "client" ]; then
# use openapi-generator to generate library
source "${SCRIPT_ROOT}/openapi-generator/client-generator.sh"

# use openapi-generator to generate library
source "${SCRIPT_ROOT}/openapi-generator/client-generator.sh"
CLIENT_LANGUAGE=python-asyncio
CLEANUP_DIRS=(client/apis client/models docs test)
kubeclient::generator::generate_client "${OUTPUT_DIR}"

CLIENT_LANGUAGE=python-asyncio
CLEANUP_DIRS=(client/apis client/models docs test)
kubeclient::generator::generate_client "${OUTPUT_DIR}"
# Generic patches to the generated Python code, most notably renaming the library.
echo "--- Patching generated code..."

# Generic patches to the generated Python code, most notably renaming the library.
echo "--- Patching generated code..."
if [ ${PACKAGE_NAME} == "client" ]; then

# Post-processing of the generated Python wrapper.
find "${OUTPUT_DIR}/test" -type f -name \*.py -exec sed -i 's/\bclient/kubernetes_asyncio.client/g' {} +
Expand All @@ -67,26 +67,11 @@ if [ ${PACKAGE_NAME} == "client" ]; then

else

# use swagger-codegen to generate library
source "${SCRIPT_ROOT}/swagger-codegen/client-generator.sh"

SWAGGER_CODEGEN_COMMIT=v2.3.1
# Build the client library in a Docker container.
CLIENT_LANGUAGE=python-asyncio
CLEANUP_DIRS=(client/apis client/models docs test)
kubeclient::generator::generate_client "${OUTPUT_DIR}"

# Generic patches to the generated Python code, most notably renaming the library.
echo "--- Patching generated code..."

# Post-processing of the generated Python wrapper.
find "${OUTPUT_DIR}/test" -type f -name \*.py -exec sed -i "s/\\bclient/${PACKAGE_NAME}.client/g" {} +
find "${OUTPUT_DIR}" -path "${OUTPUT_DIR}/base" -prune -o -type f -a -name \*.md -exec sed -i "s/\\bclient/${PACKAGE_NAME}.client/g" {} +
find "${OUTPUT_DIR}" -path "${OUTPUT_DIR}/base" -prune -o -type f -a -name \*.md -exec sed -i "s/${PACKAGE_NAME}.client-python/client-python/g" {} +

# Remove circular imports in `v1beta1_json_schema_props.py`.
sed -i "/^from ${PACKAGE_NAME}\.models.*/d" "${PACKAGE_NAME}/${PACKAGE_NAME}/models/v1beta1_json_schema_props.py"

fi

echo "---Done."