p.setProperty(new LongProperty()); } else { p.setType(param.type());
public T type(String type) { this.setType(type); return castThis(); }
private Parameter readParam(Swagger swagger, Type type,Class<?> cls, ApiParam param) { PrimitiveType fromType = PrimitiveType.fromType(type); final Parameter para = null == fromType ? new BodyParameter() : new QueryParameter(); Parameter parameter = ParameterProcessor.applyAnnotations(swagger, para, type == null ? String.class : type, null == param ? new ArrayList<Annotation>() : Collections.<Annotation> singletonList(param)); if (parameter instanceof AbstractSerializableParameter) { final AbstractSerializableParameter<?> p = (AbstractSerializableParameter<?>) parameter; if (p.getType() == null) p.setType(null == fromType ? "string" : fromType.getCommonName()); p.setRequired(p.getRequired() == true ? true : cls.isPrimitive()); }else{ //hack: Get the from data model paramter from BodyParameter BodyParameter bp = (BodyParameter)parameter; bp.setIn("formData"); } return parameter; }
protected Parameter readImplicitParam(ApiImplicitParam param) { final AbstractSerializableParameter p; if (param.paramType().equalsIgnoreCase("path")) { p = new PathParameter(); } else if (param.paramType().equalsIgnoreCase("query")) { p = new QueryParameter(); } else if (param.paramType().equalsIgnoreCase("form") || param.paramType().equalsIgnoreCase("formData")) { p = new FormParameter(); } else if (param.paramType().equalsIgnoreCase("body")) { p = null; } else if (param.paramType().equalsIgnoreCase("header")) { p = new HeaderParameter(); } else { LOGGER.warn("Unknown implicit parameter type: [" + param.paramType() + "]"); return null; } p.setName(param.name()); p.setType(param.dataType()); p.setDefaultValue(param.defaultValue()); p.setAccess(param.access()); final Type type = typeFromString(param.dataType()); return ParameterProcessor.applyAnnotations(swagger, p, type == null ? String.class : type, Arrays.<Annotation>asList(param)); }
p.setType(param.getDataType());
p.setProperty(new LongProperty()); } else { p.setType(param.type());
public void setProperty(Property property) { setType(property.getType()); this.format = property.getFormat(); if (property instanceof StringProperty) { final StringProperty string = (StringProperty) property; setEnum(string.getEnum()); } else if (property instanceof IntegerProperty) { setEnumValue(((IntegerProperty) property).getEnum()); } else if (property instanceof LongProperty) { setEnumValue(((LongProperty) property).getEnum()); } else if (property instanceof FloatProperty) { setEnumValue(((FloatProperty) property).getEnum()); } else if (property instanceof DoubleProperty) { setEnumValue(((DoubleProperty) property).getEnum()); } else if (property instanceof ArrayProperty) { final ArrayProperty array = (ArrayProperty) property; setItems(array.getItems()); } }
private static void copyFields(AbstractSerializableParameter<?> from, AbstractSerializableParameter<?> to) { copyFields((AbstractParameter) from, (AbstractParameter) to); to.setCollectionFormat(from.getCollectionFormat()); to.setDefault(from.getDefault()); to.setEnum(from.getEnum()); if (from.getExample() != null) { to.setExample(from.getExample().toString()); } to.setExclusiveMaximum(to.isExclusiveMaximum()); to.setExclusiveMinimum(to.isExclusiveMinimum()); to.setFormat(from.getFormat()); to.setItems(from.getItems()); to.setMaximum(from.getMaximum()); to.setMaxItems(from.getMaxItems()); to.setMaxLength(from.getMaxLength()); to.setMinLength(to.getMinLength()); to.setMinimum(from.getMinimum()); to.setMaxItems(from.getMaxItems()); to.setMinLength(from.getMinLength()); to.setMultipleOf(from.getMultipleOf()); to.setType(from.getType()); to.setUniqueItems(from.isUniqueItems()); }
param.setDescription(this._zenModelHelper.getDocumentation(it)); param.setName(it.getName()); param.setType(this._jsonSchemaHelper.getJSONSchemaTypeName(it.getSourceReference().getType())); String _jSONSchemaTypeFormat = this._jsonSchemaHelper.getJSONSchemaTypeFormat(it.getSourceReference().getType()); boolean _tripleNotEquals_1 = (_jSONSchemaTypeFormat != null);