forked from loafle/openapi-generator-original
set example when defined
This commit is contained in:
parent
3282c1f325
commit
cb196eb351
@ -593,6 +593,9 @@ public class DefaultCodegen {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("static-method")
|
@SuppressWarnings("static-method")
|
||||||
public String toExampleValue(Property p) {
|
public String toExampleValue(Property p) {
|
||||||
|
if(p.getExample() != null) {
|
||||||
|
return p.getExample().toString();
|
||||||
|
}
|
||||||
if (p instanceof StringProperty) {
|
if (p instanceof StringProperty) {
|
||||||
return "null";
|
return "null";
|
||||||
} else if (p instanceof BooleanProperty) {
|
} else if (p instanceof BooleanProperty) {
|
||||||
|
@ -63,8 +63,15 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processOpts()
|
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
|
||||||
{
|
super.postProcessModelProperty(model, property);
|
||||||
|
if("null".equals(property.example)) {
|
||||||
|
property.example = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processOpts() {
|
||||||
super.processOpts();
|
super.processOpts();
|
||||||
|
|
||||||
if ( additionalProperties.containsKey(CodegenConstants.IMPL_FOLDER) ) {
|
if ( additionalProperties.containsKey(CodegenConstants.IMPL_FOLDER) ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user