io.swagger.models.properties.FileProperty Java Examples
The following examples show how to use
io.swagger.models.properties.FileProperty.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConverterMgr.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
private static void initPropertyMap() { PROPERTY_MAP.put(BooleanProperty.class, TypeFactory.defaultInstance().constructType(Boolean.class)); PROPERTY_MAP.put(FloatProperty.class, TypeFactory.defaultInstance().constructType(Float.class)); PROPERTY_MAP.put(DoubleProperty.class, TypeFactory.defaultInstance().constructType(Double.class)); PROPERTY_MAP.put(DecimalProperty.class, TypeFactory.defaultInstance().constructType(BigDecimal.class)); PROPERTY_MAP.put(ByteProperty.class, TypeFactory.defaultInstance().constructType(Byte.class)); PROPERTY_MAP.put(ShortProperty.class, TypeFactory.defaultInstance().constructType(Short.class)); PROPERTY_MAP.put(IntegerProperty.class, TypeFactory.defaultInstance().constructType(Integer.class)); PROPERTY_MAP.put(BaseIntegerProperty.class, TypeFactory.defaultInstance().constructType(Integer.class)); PROPERTY_MAP.put(LongProperty.class, TypeFactory.defaultInstance().constructType(Long.class)); // stringProperty include enum scenes, not always be string type // if convert by StringPropertyConverter, can support enum scenes PROPERTY_MAP.put(StringProperty.class, TypeFactory.defaultInstance().constructType(String.class)); PROPERTY_MAP.put(DateProperty.class, TypeFactory.defaultInstance().constructType(LocalDate.class)); PROPERTY_MAP.put(DateTimeProperty.class, TypeFactory.defaultInstance().constructType(Date.class)); PROPERTY_MAP.put(ByteArrayProperty.class, TypeFactory.defaultInstance().constructType(byte[].class)); PROPERTY_MAP.put(FileProperty.class, TypeFactory.defaultInstance().constructType(Part.class)); }
Example #2
Source File: SwaggerUtils.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
public static boolean isFileParameter(Parameter parameter) { if (!(parameter instanceof FormParameter)) { return false; } FormParameter formParameter = (FormParameter) parameter; if (FileProperty.isType(formParameter.getType(), formParameter.getFormat())) { return true; } Property property = formParameter.getItems(); if (!ArrayProperty.isType(formParameter.getType()) || property == null) { return false; } return FileProperty.isType(property.getType(), property.getFormat()); }
Example #3
Source File: OperationsTransformer.java From spring-openapi with MIT License | 5 votes |
private boolean isFile(Property property) { if (property instanceof ObjectProperty) { ObjectProperty objectProperty = (ObjectProperty) property; if (objectProperty.getProperties() != null && !objectProperty.getProperties().isEmpty()) { return objectProperty.getProperties().entrySet().iterator().next().getValue() instanceof FileProperty; } } return false; }
Example #4
Source File: TypeScriptNodeClientCodegen.java From TypeScript-Microservices with MIT License | 5 votes |
@Override public String getTypeDeclaration(Property p) { if (p instanceof FileProperty) { return "Buffer"; } return super.getTypeDeclaration(p); }
Example #5
Source File: RestOperationMeta.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
private boolean checkDownloadFileFlag() { // todo: logic of find Response response = operationMeta.getSwaggerOperation().getResponses().get("200"); if (response != null) { Model model = response.getResponseSchema(); return model instanceof ModelImpl && FileProperty.isType(((ModelImpl) model).getType(), ((ModelImpl) model).getFormat()); } return false; }
Example #6
Source File: FormProcessorCreator.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
private boolean isPart(Parameter parameter) { // no need to check Part[][] and so on FormParameter formParameter = (FormParameter) parameter; if ("array".equals(formParameter.getType())) { Property items = formParameter.getItems(); return new FileProperty().getType().equals(items.getType()); } return new FileProperty().getType().equals(formParameter.getType()); }
Example #7
Source File: DefaultCodegen.java From TypeScript-Microservices with MIT License | 4 votes |
/** * returns the swagger type for the property * @param p Swagger property object * @return string presentation of the type **/ @SuppressWarnings("static-method") public String getSwaggerType(Property p) { String datatype = null; if (p instanceof StringProperty && "number".equals(p.getFormat())) { datatype = "BigDecimal"; } else if ((p instanceof ByteArrayProperty) || (p instanceof StringProperty && "byte".equals(p.getFormat()))) { datatype = "ByteArray"; } else if (p instanceof BinaryProperty) { datatype = "binary"; } else if (p instanceof FileProperty) { datatype = "file"; } else if (p instanceof BooleanProperty) { datatype = "boolean"; } else if (p instanceof DateProperty) { datatype = "date"; } else if (p instanceof DateTimeProperty) { datatype = "DateTime"; } else if (p instanceof DoubleProperty) { datatype = "double"; } else if (p instanceof FloatProperty) { datatype = "float"; } else if (p instanceof IntegerProperty) { datatype = "integer"; } else if (p instanceof LongProperty) { datatype = "long"; } else if (p instanceof MapProperty) { datatype = "map"; } else if (p instanceof DecimalProperty) { datatype = "number"; } else if ( p instanceof UUIDProperty) { datatype = "UUID"; } else if (p instanceof RefProperty) { try { RefProperty r = (RefProperty) p; datatype = r.get$ref(); if (datatype.indexOf("#/definitions/") == 0) { datatype = datatype.substring("#/definitions/".length()); } } catch (Exception e) { LOGGER.warn("Error obtaining the datatype from RefProperty:" + p + ". Datatype default to Object"); datatype = "Object"; LOGGER.error(e.getMessage(), e); } } else if (p instanceof StringProperty) { datatype = "string"; } else { if (p != null) { datatype = p.getType(); } } return datatype; }
Example #8
Source File: PartProcessor.java From servicecomb-java-chassis with Apache License 2.0 | 4 votes |
@Override public void fillParameter(Swagger swagger, Operation operation, FormParameter parameter, Type type, Annotation annotation) { parameter.setType(new FileProperty().getType()); }
Example #9
Source File: PartArrayProcessor.java From servicecomb-java-chassis with Apache License 2.0 | 4 votes |
@Override public void fillParameter(Swagger swagger, Operation operation, FormParameter parameter, Type type, Annotation annotation) { Property property = new ArrayProperty(new FileProperty()); parameter.setProperty(property); }
Example #10
Source File: PartPropertyCreator.java From servicecomb-java-chassis with Apache License 2.0 | 4 votes |
@Override public Property createProperty() { return new FileProperty(); }
Example #11
Source File: TestPartPropertyCreator.java From servicecomb-java-chassis with Apache License 2.0 | 4 votes |
@Test public void createProperty() { Assert.assertThat(creator.createProperty(), Matchers.instanceOf(FileProperty.class)); }