Skip to content

Commit 40dcbad

Browse files
committed
ref
1 parent 6e71f80 commit 40dcbad

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

.github/workflows/generate-sec-api-python-sdk.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,36 @@ jobs:
6666
# You can list available versions with: openapi-generator-cli version-manager list
6767
openapi-generator-cli version-manager set 7.5.0 # Example: Set to a specific stable version
6868
69+
- name: Prepare OpenAPI Spec for Generator
70+
run: |
71+
echo "Original spec file: finfeedapi/sec-api/spec/sec-api-historical.yaml"
72+
NEW_SPEC_FILE_PATH="finfeedapi/sec-api/spec/sec-api-historical.json"
73+
OLD_SPEC_FILE_NAME="sec-api-historical.yaml"
74+
NEW_SPEC_FILE_NAME="sec-api-historical.json"
75+
76+
# Rename the spec file to .json to ensure correct parsing
77+
if [ -f "finfeedapi/sec-api/spec/${OLD_SPEC_FILE_NAME}" ]; then
78+
echo "Renaming finfeedapi/sec-api/spec/${OLD_SPEC_FILE_NAME} to ${NEW_SPEC_FILE_PATH}"
79+
mv "finfeedapi/sec-api/spec/${OLD_SPEC_FILE_NAME}" "${NEW_SPEC_FILE_PATH}"
80+
else
81+
echo "Warning: Expected spec file finfeedapi/sec-api/spec/${OLD_SPEC_FILE_NAME} not found. Assuming it might have been already renamed or path is incorrect."
82+
# If the .json file already exists, we assume it's the correct one
83+
if [ ! -f "${NEW_SPEC_FILE_PATH}" ]; then
84+
echo "Error: Neither ${OLD_SPEC_FILE_NAME} nor ${NEW_SPEC_FILE_NAME} found in spec directory. Cannot proceed."
85+
exit 1
86+
fi
87+
fi
88+
89+
echo "Updating inputSpec in generator config files to point to ${NEW_SPEC_FILE_NAME}..."
90+
CONFIG_DIR="finfeedapi/sec-api/sdk-config"
91+
find "${CONFIG_DIR}" -type f -name '*.yaml' -print0 | while IFS= read -r -d $'\\0' configFile; do
92+
echo "Processing ${configFile}..."
93+
# Using a temporary file for sed to ensure compatibility, especially with -i
94+
sed "s|\\(inputSpec:.*\\)${OLD_SPEC_FILE_NAME}|\\1${NEW_SPEC_FILE_NAME}|g" "${configFile}" > "${configFile}.tmp" && mv "${configFile}.tmp" "${configFile}"
95+
echo "Updated inputSpec in ${configFile} if necessary."
96+
done
97+
echo "Finished preparing OpenAPI spec and config files."
98+
6999
- name: Generate SDKs
70100
run: |
71101
set -e # Exit immediately if a command exits with a non-zero status.

finfeedapi/sec-api/spec/sec-api-historical.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"openapi": "3.0.1",
2+
"openapi": "3.0.1",
33
"info": {
44
"title": "REST API",
55
"contact": {

0 commit comments

Comments
 (0)