-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Developer API v2 - Dynamically Generate Client #128
Labels
enhancement
New feature or request
Comments
Script#!/usr/bin/env bash
set -e
OPENAPI_URL="https://lm-v2-api-mock-data-xxxxxxxxxxx.herokuapp.com/v2/openapi/"
#OPENAPI_URL="https://lm-v2-api-v1-proxy-xxxxxxxxxxx.herokuapp.com/v2/openapi/"
GENERATOR_VERSION="7.10.0"
CONFIGURATION_JSON="$(cat <<EOF
[
{
"packageName": "lunchable",
"language": "python",
"installCommand": "poetry install",
"testCommand": "poetry run pytest"
}
]
EOF
)"
DEPENDENCIES=(
"jq"
"docker"
"poetry"
)
for DEPENDENCY in ${DEPENDENCIES[@]}; do
if ! command -v ${DEPENDENCY} &> /dev/null; then
echo "${DEPENDENCY} is required but it's not installed. Aborting."
exit 1
fi
done
function bold() {
echo -e "\033[1m${1}\033[0m"
}
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
echo "${CONFIGURATION_JSON}" | jq -c '.[]' | while read -r CONFIG; do
# PARSED CONFIGURATION
PACKAGE_NAME="$(echo "${CONFIG}" | jq -r '.packageName')"
LANGUAGE="$(echo "${CONFIG}" | jq -r '.language')"
TEST_COMMAND="$(echo "${CONFIG}" | jq -r '.testCommand')"
# GENERATE CLIENT
bold "Generating client for ${LANGUAGE}..."
bold "Package name: ${PACKAGE_NAME}"
CLIENT_DIR="${THIS_DIR}/clients/${LANGUAGE}"
rm -rf "${CLIENT_DIR}"
mkdir -p "${CLIENT_DIR}"
docker run --rm \
-v "${CLIENT_DIR}:/local/${LANGUAGE}" \
openapitools/openapi-generator-cli:v${GENERATOR_VERSION} \
generate \
-i "${OPENAPI_URL}" \
-g ${LANGUAGE} \
-o /local/${LANGUAGE} \
--package-name ${PACKAGE_NAME} \
--skip-validate-spec
bold "Client generated successfully!"
pushd "${CLIENT_DIR}"
# INSTALL CLIENT
bold "Installing client for ${LANGUAGE}..."
eval "${INSTALL_COMMAND}"
# TEST CLIENT
bold "Testing client for ${LANGUAGE}..."
eval "${TEST_COMMAND}"
popd
done
|
Exception in thread "main" org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
| Error count: 1, Warning count: 0
Errors:
-attribute components.schemas.transactionObject.items is missing test/test_account_type_enum.py:18: in <module>
from lunchable.models.account_type_enum import AccountTypeEnum
lunchable/__init__.py:21: in <module>
from lunchable.api.categories_api import CategoriesApi
lunchable/api/__init__.py:4: in <module>
from lunchable.api.categories_api import CategoriesApi
lunchable/api/categories_api.py:24: in <module>
from lunchable.models.create_category_request_object import CreateCategoryRequestObject
E ModuleNotFoundError: No module named 'lunchable.models.create_category_request_object' |
juftin
added
enhancement
New feature or request
and removed
triage
This will looked at
labels
Dec 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
LunchMoney Developer API v2 is incoming with an OpenAPI Spec
The text was updated successfully, but these errors were encountered: