[2.0 Spec] Implement Schema Object.example field

see issue https://github.com/wordnik/swagger-core/issues/699,
 pull-request https://github.com/wordnik/swagger-core/pull/700
This commit is contained in:
Martin Ehrnhoefer 2014-09-29 16:26:06 +02:00
parent c75a951668
commit 89a009c411
2 changed files with 3 additions and 1 deletions

View File

@ -12,6 +12,8 @@ public class CodegenProperty {
public Integer minLength;
/** pattern validation for strings, see http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.2.3 */
public String pattern;
/** A free-form property to include an example of an instance for this schema. */
public String example;
public Double minimum, maximum, exclusiveMinimum, exclusiveMaximum;
public Boolean hasMore = null, required = null, secondaryParam = null;

View File

@ -412,7 +412,7 @@ public class DefaultCodegen {
property.description = p.getDescription();
property.getter = "get" + name.substring(0, 1).toUpperCase() + name.substring(1);
property.setter = "set" + name.substring(0, 1).toUpperCase() + name.substring(1);
property.example = p.getExample();
property.defaultValue = toDefaultValue(p);
String type = getSwaggerType(p);