private FormParameter extractRequestPart(Type type, RequestPart requestPart) { String paramName = StringUtils.defaultIfEmpty(requestPart.value(), requestPart.name()); FormParameter formParameter = new FormParameter().name(paramName) .required(requestPart.required()); JavaType ct = constructType(type); Property schema; if (MultipartFile.class.isAssignableFrom(ct.getRawClass())) { schema = new FileProperty(); } else if (ct.isContainerType() && MultipartFile.class.isAssignableFrom(ct.getContentType().getRawClass())) { schema = new ArrayProperty().items(new FileProperty()); } else { schema = ModelConverters.getInstance().readAsProperty(type); } if (schema != null) { formParameter.setProperty(schema); } return formParameter; }
/** * Used to construct a collection of resource identifiers. * @param relationship is added as a property of 'data' */ public Data(Relationship relationship) { super(); property("data", new ArrayProperty().items(relationship)); } }
/** * Used to construct a collection of resource identifiers. * @param relationship Added to the property 'data' */ public Data(Relationship relationship) { super(); property("data", new ArrayProperty().items(relationship)); } }
public Data(String definitionName) { super(); property("data", new ArrayProperty().items(new RefProperty(definitionName))); }
/** * Used to construct a collection of resources (referenced by the resource type) * @param definitionName The swagger model to reference in 'data' * @param included Whether or not to add the 'included' property to the schema. */ public Data(String definitionName, boolean included) { super(); property("data", new ArrayProperty().items(new RefProperty(definitionName))); if (included) { property("included", new ArrayProperty() .description("Included resources") .uniqueItems() .items(new IncludedResource()) ); } }
/** * Constructs a singular resource (referenced by type) * @param definitionName The swagger model to reference in 'data'. * @param included Whether or not to add the 'included' property to the schema. */ public Datum(String definitionName, boolean included) { super(); property("data", new RefProperty(definitionName)); if (included) { property("included", new ArrayProperty() .description("Included resources") .uniqueItems() .items(new IncludedResource()) ); } }
private void addDefaultDefinitions() { // schema of the default response // received from fetchAll and search operations swagger.addDefinition("FetchAll", new ModelImpl() .property("results", new ArrayProperty() .items(new ObjectProperty() .property("uuid", new StringProperty()) .property("display", new StringProperty()) .property("links", new ArrayProperty() .items(new ObjectProperty() .property("rel", new StringProperty().example("self")) .property("uri", new StringProperty(StringProperty.Format.URI))))))); }
} else { ArrayProperty property = new ArrayProperty(); property.items(context.resolveProperty(PropertyBox.class, annotations)); property.setUniqueItems(pbType.isUniqueItems()); return property;
@Override public Model getGETModel(Representation rep) { ModelImpl model = new ModelImpl(); if (rep instanceof DefaultRepresentation) { model .property("links", new ArrayProperty() .items(new ObjectProperty() .property("rel", new StringProperty().example("self|full")) .property("uri", new StringProperty(StringProperty.Format.URI)))); } else if (rep instanceof FullRepresentation) { model .property("auditInfo", new StringProperty()) .property("links", new ArrayProperty() .items(new ObjectProperty() .property("rel", new StringProperty()).example("self") .property("uri", new StringProperty(StringProperty.Format.URI)))); } else if (rep instanceof RefRepresentation) { model .property("links", new ArrayProperty() .items(new ObjectProperty() .property("rel", new StringProperty().example("self")) .property("uri", new StringProperty(StringProperty.Format.URI)))); } return model; }