Skip to content

Update pydantic to v2 #496

Open
Open

Description

@tokuhirom

pydantic v2 is not backward compatible.
We need to upgrade it.

Activity

  1. tokuhirom commented on Jul 25, 2023

    @tokuhirom
    ContributorAuthor

    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";
  2. tokuhirom commented on Jul 25, 2023

    @tokuhirom
    ContributorAuthor

    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?

  3. tokuhirom commented on Jul 25, 2023

    @tokuhirom
    ContributorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions