diff --git a/openapi/java.sh b/openapi/java.sh
index 2c695ef..4c7c479 100755
--- a/openapi/java.sh
+++ b/openapi/java.sh
@@ -49,7 +49,8 @@ popd > /dev/null
source "${SCRIPT_ROOT}/openapi-generator/client-generator.sh"
source "${SETTING_FILE}"
-OPENAPI_GENERATOR_COMMIT="${OPENAPI_GENERATOR_COMMIT:-v4.0.0}" \
+OPENAPI_GENERATOR_USER_ORG="${OPENAPI_GENERATOR_USER_ORG:-fabiokung}" \
+OPENAPI_GENERATOR_COMMIT="${OPENAPI_GENERATOR_COMMIT:-mapping-ref-string}" \
CLIENT_LANGUAGE=java; \
CLEANUP_DIRS=(docs src/test/java/io/kubernetes/client/apis src/main/java/io/kubernetes/client/apis src/main/java/io/kubernetes/client/models src/main/java/io/kubernetes/client/auth gradle); \
kubeclient::generator::generate_client "${OUTPUT_DIR}"
diff --git a/openapi/java.xml b/openapi/java.xml
index 8cf26f7..d767367 100644
--- a/openapi/java.xml
+++ b/openapi/java.xml
@@ -46,9 +46,9 @@
false
okhttp-gson
true
- intstr.IntOrString=IntOrString,resource.Quantity=Quantity
- IntOrString=io.kubernetes.client.custom.IntOrString,Quantity=io.kubernetes.client.custom.Quantity
+ int-or-string=IntOrString,quantity=Quantity
+ IntOrString=io.kubernetes.client.custom.IntOrString,Quantity=io.kubernetes.client.custom.Quantity
diff --git a/openapi/preprocess_spec.py b/openapi/preprocess_spec.py
index 14e8594..82b23b6 100644
--- a/openapi/preprocess_spec.py
+++ b/openapi/preprocess_spec.py
@@ -14,11 +14,11 @@
from __future__ import print_function
+import argparse
import json
import operator
import os.path
import sys
-import argparse
from collections import OrderedDict
import urllib3
@@ -136,6 +136,8 @@ def process_swagger(spec, client_language):
inline_primitive_models(spec, preserved_primitives_for_language(client_language))
+ add_custom_formatting(spec, format_for_language(client_language))
+
remove_models(spec, removed_models_for_language(client_language))
return spec
@@ -150,6 +152,12 @@ def preserved_primitives_for_language(client_language):
else:
return []
+def format_for_language(client_language):
+ if client_language == "java":
+ return {"resource.Quantity": "quantity"}
+ else:
+ return {}
+
def removed_models_for_language(client_language):
if client_language == "haskell-http-client":
return ["intstr.IntOrString", "resource.Quantity"]
@@ -298,6 +306,12 @@ def inline_primitive_models(spec, excluded_primitives):
for k in to_remove_models:
del spec['definitions'][k]
+def add_custom_formatting(spec, custom_formats):
+ for k, v in spec['definitions'].items():
+ if k not in custom_formats:
+ continue
+ v["format"] = custom_formats[k]
+
def write_json(filename, object):
with open(filename, 'w') as out:
json.dump(object, out, sort_keys=False, indent=2, separators=(',', ': '), ensure_ascii=True)