line-bot-sdk-python
line-bot-sdk-python copied to clipboard
Update pydantic to v2
pydantic v2 is not backward compatible. We need to upgrade it.
We need to rewrite PythonNextgenCustomClientGenerator with the latest style.
diff --git generator/src/main/java/line/bot/generator/PythonNextgenCustomClientGenerator.java generator/src/main/java/line/bot/generator/PythonNextgenCustomClientGenerator.java
index 7d84030..e0e57f1 100644
--- generator/src/main/java/line/bot/generator/PythonNextgenCustomClientGenerator.java
+++ generator/src/main/java/line/bot/generator/PythonNextgenCustomClientGenerator.java
@@ -443,10 +443,10 @@ public class PythonNextgenCustomClientGenerator extends AbstractPythonCodegen im
if (cp.isArray) {
String constraints = "";
if (cp.maxItems != null) {
- constraints += String.format(Locale.ROOT, ", max_items=%d", cp.maxItems);
+ constraints += String.format(Locale.ROOT, ", max_length=%d", cp.maxItems);
}
if (cp.minItems != null) {
- constraints += String.format(Locale.ROOT, ", min_items=%d", cp.minItems);
+ constraints += String.format(Locale.ROOT, ", min_length=%d", cp.minItems);
}
if (cp.getUniqueItems()) {
constraints += ", unique_items=True";
@@ -723,10 +723,10 @@ public class PythonNextgenCustomClientGenerator extends AbstractPythonCodegen im
if (cp.isArray) {
String constraints = "";
if (cp.maxItems != null) {
- constraints += String.format(Locale.ROOT, ", max_items=%d", cp.maxItems);
+ constraints += String.format(Locale.ROOT, ", max_length=%d", cp.maxItems);
}
if (cp.minItems != null) {
- constraints += String.format(Locale.ROOT, ", min_items=%d", cp.minItems);
+ constraints += String.format(Locale.ROOT, ", min_length=%d", cp.minItems);
}
if (cp.getUniqueItems()) {
constraints += ", unique_items=True";
BTW, there's a remaining error.
================================== short test summary info ===================================
FAILED tests/v3/test_webhook.py::TestWebhookParser::test_parse - TypeError: unhashable type: 'ModelPrivateAttr'
FAILED tests/v3/test_webhook.py::TestWebhookParser::test_parse_webhook_req_without_destination - TypeError: unhashable type: 'ModelPrivateAttr'
FAILED tests/v3/test_webhook.py::TestWebhookHandler::test_handler - TypeError: unhashable type: 'ModelPrivateAttr'
Why it's happened?
https://docs.pydantic.dev/latest/migration/ There's a migration guide.