Skip to content

Commit 85db0eb

Browse files
fix(python-aiohttp): add python_dateutil to generated requirements so dates are deserialized (#25449)
Generated with [Devin](https://devin.ai) Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 644f963 commit 85db0eb

5 files changed

Lines changed: 15 additions & 0 deletions

File tree

‎modules/openapi-generator/src/main/resources/python-aiohttp/requirements.mustache‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ connexion[aiohttp,swagger-ui] <= 2.3.0; python_version=="3.5" or python_version=
77
werkzeug == 0.16.1; python_version=="3.5" or python_version=="3.4"
88
swagger-ui-bundle == 0.0.9
99
aiohttp_jinja2 == 1.5.0
10+
python_dateutil >= 2.6.0
1011
{{#featureCORS}}
1112
aiohttp_cors >= 0.7.0
1213
{{/featureCORS}}

‎modules/openapi-generator/src/main/resources/python-aiohttp/setup.mustache‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ REQUIRES = [
1717
"connexion==2.14.1",
1818
"swagger-ui-bundle==0.0.9",
1919
"aiohttp_jinja2==1.5.0",
20+
"python_dateutil>=2.6.0",
2021
]
2122

2223
setup(

‎modules/openapi-generator/src/test/java/org/openapitools/codegen/python/AbstractPythonConnexionServerCodegenTest.java‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,4 +558,15 @@ public void testFreeFormAndAnyTypeParametersDoNotCallFromDict() throws IOExcepti
558558
FileUtils.deleteDirectory(flaskComposedOutput);
559559
}
560560
}
561+
562+
@Test(description = "python-aiohttp generated requirements.txt and setup.py declare python_dateutil so util.deserialize_date/datetime actually parse dates")
563+
public void testAiohttpRequirementsIncludePythonDateutil() throws IOException {
564+
Path aiohttpDir = generateOutputDir("python-aiohttp", Collections.emptyMap());
565+
Path aiohttpRequirements = aiohttpDir.resolve("requirements.txt");
566+
Path aiohttpSetupPy = aiohttpDir.resolve("setup.py");
567+
assertFileExists(aiohttpRequirements);
568+
assertFileExists(aiohttpSetupPy);
569+
assertFileContains(aiohttpRequirements, "python_dateutil >= 2.6.0");
570+
assertFileContains(aiohttpSetupPy, "python_dateutil>=2.6.0");
571+
}
561572
}

‎samples/server/petstore/python-aiohttp-srclayout/requirements.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ connexion[aiohttp,swagger-ui] <= 2.3.0; python_version=="3.5" or python_version=
77
werkzeug == 0.16.1; python_version=="3.5" or python_version=="3.4"
88
swagger-ui-bundle == 0.0.9
99
aiohttp_jinja2 == 1.5.0
10+
python_dateutil >= 2.6.0
1011
Flask < 2.3

‎samples/server/petstore/python-aiohttp-srclayout/setup.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"connexion==2.14.1",
1818
"swagger-ui-bundle==0.0.9",
1919
"aiohttp_jinja2==1.5.0",
20+
"python_dateutil>=2.6.0",
2021
]
2122

2223
setup(

0 commit comments

Comments
 (0)