List<String> enums = null; if (property instanceof StringProperty) { enums = ((StringProperty) property).getEnum();
return true; case "string": return ExamplesUtil.generateStringExample(property.getFormat(), property instanceof StringProperty ? ((StringProperty) property).getEnum() : null); case "ref": if (property instanceof RefProperty) {
@Override public List<String> getEnum() { if (property instanceof StringProperty) { return ((StringProperty) property).getEnum(); } return null; }
public static boolean isEnum(StringProperty stringProperty) { return isEnum(stringProperty.getEnum()); }
} else if (property instanceof StringProperty) { StringProperty stringProperty = (StringProperty) property; List<String> enums = stringProperty.getEnum(); if (CollectionUtils.isNotEmpty(enums)) { type = new EnumType(stringProperty.getTitle(), enums);
@Override public JavaType doConvert(SwaggerToClassGenerator swaggerToClassGenerator, Object property) { StringProperty stringProperty = (StringProperty) property; List<String> enums = stringProperty.getEnum(); return findJavaType(swaggerToClassGenerator, stringProperty.getType(), stringProperty.getFormat(), enums); } }
public static BodyParameter createBodyParameter(Swagger swagger, String paramName, Type paramType) { addDefinitions(swagger, paramType); Property property = ModelConverters.getInstance().readAsProperty(paramType); Model model = PropertyBuilder.toModel(property); if (model instanceof ModelImpl && property instanceof StringProperty) { ((ModelImpl) model).setEnum(((StringProperty) property).getEnum()); } BodyParameter bodyParameter = new BodyParameter(); bodyParameter.setName(paramName); bodyParameter.setSchema(model); return bodyParameter; }
@Override public List<String> getEnum() { if (property instanceof StringProperty) { return ((StringProperty) property).getEnum(); } return null; }
private boolean isPropertyOfEnumType(Property property) { return property != null && StringProperty.class.isAssignableFrom(property.getClass()) && CollectionUtils.isNotEmpty(((StringProperty) property).getEnum()); }
public static boolean isEnum(StringProperty stringProperty) { return isEnum(stringProperty.getEnum()); }
private void validateEnumPropertyFeatures(StringProperty actualStringProperty, StringProperty expectedStringProperty) { List<String> expectedEnums = expectedStringProperty.getEnum(); if (CollectionUtils.isNotEmpty(expectedEnums)) { softAssertions.assertThat(actualStringProperty.getEnum()).hasSameElementsAs(expectedEnums); } else { softAssertions.assertThat(actualStringProperty.getEnum()).isNullOrEmpty(); } }
private void processDiscriminator(String discriminator, Map<String, Property> properties, String file) { for (Map.Entry<String, Property> prop : properties.entrySet()) { if (prop.getKey().equals(discriminator)){ if (prop.getValue() instanceof StringProperty){ StringProperty stringProperty = (StringProperty) prop.getValue(); if(stringProperty.getEnum() != null){ for(String name: stringProperty.getEnum()){ processRefProperty(new RefProperty(RefType.DEFINITION.getInternalPrefix()+name), file); } } } } } }
if (StringUtils.hasText(((StringProperty) property).getPattern())) { payload.append("\"@matches(").append(((StringProperty) property).getPattern()).append(")@\""); } else if (!CollectionUtils.isEmpty(((StringProperty) property).getEnum())) { payload.append("\"@matches(").append(((StringProperty) property).getEnum().stream().collect(Collectors.joining("|"))).append(")@\""); } else { payload.append("\"@notEmpty()@\"");
@Override public JavaType doConvert(SwaggerToClassGenerator swaggerToClassGenerator, Object property) { StringProperty stringProperty = (StringProperty) property; List<String> enums = stringProperty.getEnum(); return findJavaType(swaggerToClassGenerator, stringProperty.getType(), stringProperty.getFormat(), enums); } }
List<String> enums = null; if (property instanceof StringProperty) { enums = ((StringProperty) property).getEnum();
break; case "enum": _switchResult = prop.getEnum(); break; case "minLength":
public static BodyParameter createBodyParameter(Swagger swagger, String paramName, Type paramType) { addDefinitions(swagger, paramType); Property property = ModelConverters.getInstance().readAsProperty(paramType); Model model = PropertyBuilder.toModel(property); if (model instanceof ModelImpl && property instanceof StringProperty) { ((ModelImpl) model).setEnum(((StringProperty) property).getEnum()); } BodyParameter bodyParameter = new BodyParameter(); bodyParameter.setName(paramName); bodyParameter.setSchema(model); return bodyParameter; }
} else if(property instanceof StringProperty){ final StringProperty stringProperty = (StringProperty) property; final List<String> enumValues = stringProperty.getEnum();
public EmailProperty(StringProperty prop) { this(); this._enum = prop.getEnum(); this.minLength = prop.getMinLength(); this.maxLength = prop.getMaxLength(); this.pattern = prop.getPattern(); this.name = prop.getName(); this.type = prop.getType(); this.example = prop.getExample(); this._default = prop.getDefault(); this.xml = prop.getXml(); this.required = prop.getRequired(); this.position = prop.getPosition(); this.description = prop.getDescription(); this.title = prop.getTitle(); this.readOnly = prop.getReadOnly(); }
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()); } }