Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit 058ad60

Browse files
committed
Updates pattern handling in python-experimental
1 parent d2bc856 commit 058ad60

File tree

5 files changed

+7
-15
lines changed

5 files changed

+7
-15
lines changed

modules/openapi-json-schema-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,11 @@ protected Object processTestExampleData(Object value) {
14851485
@Override
14861486
public CodegenModel fromModel(String name, Schema sc) {
14871487
CodegenModel cm = super.fromModel(name, sc);
1488-
1488+
if (sc.getPattern() != null) {
1489+
postProcessPattern(sc.getPattern(), cm.vendorExtensions);
1490+
String pattern = (String) cm.vendorExtensions.get("x-regex");
1491+
cm.setPattern(pattern);
1492+
}
14891493
if (cm.isNullable) {
14901494
cm.setIsNull(true);
14911495
cm.isNullable = false;

samples/openapi3/client/petstore/python/docs/apis/tags/FakeApi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,8 +949,8 @@ with petstore_api.ApiClient(configuration) as api_client:
949949
number=32.1,
950950
_float=3.14,
951951
double=67.8,
952-
string="A",
953-
pattern_without_delimiter="Aj",
952+
string="a",
953+
pattern_without_delimiter="AUR,rZ#UM/?R,Fp^l6$ARjbhJk C>",
954954
byte='YQ==',
955955
binary=open('/path/to/file', 'rb'),
956956
date="1970-01-01",

samples/openapi3/client/petstore/python/petstore_api/model/apple.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ class origin(
6363
class MetaOapg:
6464
regex=[{
6565
'pattern': r'^[A-Z\s]*$', # noqa: E501
66-
'flags': (
67-
re.IGNORECASE
68-
)
6966
}]
7067
__annotations__ = {
7168
"cultivar": cultivar,

samples/openapi3/client/petstore/python/petstore_api/model/format_test.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ class string(
148148
class MetaOapg:
149149
regex=[{
150150
'pattern': r'[a-z]', # noqa: E501
151-
'flags': (
152-
re.IGNORECASE
153-
)
154151
}]
155152
binary = schemas.BinarySchema
156153
dateTime = schemas.DateTimeSchema
@@ -177,9 +174,6 @@ class pattern_with_digits_and_delimiter(
177174
class MetaOapg:
178175
regex=[{
179176
'pattern': r'^image_\d{1,3}$', # noqa: E501
180-
'flags': (
181-
re.IGNORECASE
182-
)
183177
}]
184178
noneProp = schemas.NoneSchema
185179
__annotations__ = {

samples/openapi3/client/petstore/python/petstore_api/paths/fake/post.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ class string(
107107
class MetaOapg:
108108
regex=[{
109109
'pattern': r'[a-z]', # noqa: E501
110-
'flags': (
111-
re.IGNORECASE
112-
)
113110
}]
114111

115112

0 commit comments

Comments
 (0)