mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-21 08:17:08 +00:00
[Python] remove default value from being fallback to example (#2213)
* remove example fallback * reset test case
This commit is contained in:
@@ -614,14 +614,6 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
else
|
||||
return "True";
|
||||
}
|
||||
// include fallback to example, default defined as server only
|
||||
// example is not defined as server only
|
||||
if (p.getExample() != null) {
|
||||
if (Boolean.valueOf(p.getExample().toString()) == false)
|
||||
return "False";
|
||||
else
|
||||
return "True";
|
||||
}
|
||||
} else if (ModelUtils.isDateSchema(p)) {
|
||||
// TODO
|
||||
} else if (ModelUtils.isDateTimeSchema(p)) {
|
||||
@@ -630,10 +622,6 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
if (p.getDefault() != null) {
|
||||
return p.getDefault().toString();
|
||||
}
|
||||
// default numbers are not yet returned by v2 spec openAPI results
|
||||
// https://github.com/swagger-api/swagger-parser/issues/971
|
||||
// include fallback to example, default defined as server only
|
||||
// example is not defined as server only
|
||||
if (p.getExample() != null) {
|
||||
return p.getExample().toString();
|
||||
}
|
||||
@@ -641,13 +629,6 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
if (p.getDefault() != null) {
|
||||
return p.getDefault().toString();
|
||||
}
|
||||
// default integers are not yet returned by v2 spec openAPI results
|
||||
// https://github.com/swagger-api/swagger-parser/issues/971
|
||||
// include fallback to example, default defined as server only
|
||||
// example is not defined as server only
|
||||
if (p.getExample() != null) {
|
||||
return p.getExample().toString();
|
||||
}
|
||||
} else if (ModelUtils.isStringSchema(p)) {
|
||||
if (p.getDefault() != null) {
|
||||
if (Pattern.compile("\r\n|\r|\n").matcher((String) p.getDefault()).find())
|
||||
@@ -655,23 +636,10 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
else
|
||||
return "'" + p.getDefault() + "'";
|
||||
}
|
||||
// include fallback to example, default defined as server only
|
||||
// example is not defined as server only
|
||||
if (p.getExample() != null) {
|
||||
if (Pattern.compile("\r\n|\r|\n").matcher((String) p.getExample()).find())
|
||||
return "'''" + p.getExample() + "'''";
|
||||
else
|
||||
return "'" + p.getExample() + "'";
|
||||
}
|
||||
} else if (ModelUtils.isArraySchema(p)) {
|
||||
if (p.getDefault() != null) {
|
||||
return p.getDefault().toString();
|
||||
}
|
||||
// include fallback to example, default defined as server only
|
||||
// example is not defined as server only
|
||||
if (p.getExample() != null) {
|
||||
return p.getExample().toString();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -1344,6 +1344,7 @@ definitions:
|
||||
uuid:
|
||||
type: string
|
||||
format: uuid
|
||||
example: 72f98069-206d-4f12-9f12-3d1e525a8e84
|
||||
password:
|
||||
type: string
|
||||
format: password
|
||||
|
||||
@@ -1373,6 +1373,7 @@ components:
|
||||
uuid:
|
||||
type: string
|
||||
format: uuid
|
||||
example: 72f98069-206d-4f12-9f12-3d1e525a8e84
|
||||
password:
|
||||
type: string
|
||||
format: password
|
||||
|
||||
Reference in New Issue
Block a user