Java Code Examples for io.swagger.models.ModelImpl#getAdditionalProperties()
The following examples show how to use
io.swagger.models.ModelImpl#getAdditionalProperties() .
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: ModelImplConverter.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
@Override public JavaType doConvert(Swagger swagger, Object model) { ModelImpl modelImpl = (ModelImpl) model; JavaType javaType = ConverterMgr.findJavaType(modelImpl.getType(), modelImpl.getFormat()); if (javaType != null) { return javaType; } if (modelImpl.getReference() != null) { return convertRef(swagger, modelImpl.getReference()); } if (modelImpl.getAdditionalProperties() != null) { return MapPropertyConverter.findJavaType(swagger, modelImpl.getAdditionalProperties()); } return OBJECT_JAVA_TYPE; }
Example 2
Source File: Swift4Codegen.java From TypeScript-Microservices with MIT License | 5 votes |
@Override protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, ModelImpl swaggerModel) { final Property additionalProperties = swaggerModel.getAdditionalProperties(); if (additionalProperties != null) { codegenModel.additionalPropertiesType = getSwaggerType(additionalProperties); } }
Example 3
Source File: JavascriptClientCodegen.java From TypeScript-Microservices with MIT License | 5 votes |
@Override public CodegenModel fromModel(String name, Model model, Map<String, Model> allDefinitions) { CodegenModel codegenModel = super.fromModel(name, model, allDefinitions); if (allDefinitions != null && codegenModel != null && codegenModel.parent != null && codegenModel.hasEnums) { final Model parentModel = allDefinitions.get(codegenModel.parentSchema); final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel, allDefinitions); codegenModel = JavascriptClientCodegen.reconcileInlineEnums(codegenModel, parentCodegenModel); } if (model instanceof ArrayModel) { ArrayModel am = (ArrayModel) model; if (am.getItems() != null) { codegenModel.vendorExtensions.put("x-isArray", true); codegenModel.vendorExtensions.put("x-itemType", getSwaggerType(am.getItems())); } } else if (model instanceof ModelImpl) { ModelImpl mm = (ModelImpl)model; if (mm.getAdditionalProperties() != null) { codegenModel.vendorExtensions.put("x-isMap", true); codegenModel.vendorExtensions.put("x-itemType", getSwaggerType(mm.getAdditionalProperties())); } else { String type = mm.getType(); if (isPrimitiveType(type)){ codegenModel.vendorExtensions.put("x-isPrimitive", true); } } } return codegenModel; }
Example 4
Source File: Swift3Codegen.java From TypeScript-Microservices with MIT License | 5 votes |
@Override protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, ModelImpl swaggerModel) { final Property additionalProperties = swaggerModel.getAdditionalProperties(); if(additionalProperties != null) { codegenModel.additionalPropertiesType = getSwaggerType(additionalProperties); } }
Example 5
Source File: PlantUMLCodegen.java From swagger2puml with Apache License 2.0 | 5 votes |
/** * * @param model * @return */ private List<ClassMembers> getClassMembers(ModelImpl model, Map<String, Model> modelsMap) { LOGGER.entering(LOGGER.getName(), "getClassMembers-ModelImpl"); List<ClassMembers> classMembers = new ArrayList<ClassMembers>(); Map<String, Property> modelMembers = model.getProperties(); if (modelMembers != null && !modelMembers.isEmpty()) { classMembers.addAll(convertModelPropertiesToClassMembers(modelMembers, model, modelsMap)); } else { Property modelAdditionalProps = model.getAdditionalProperties(); if (modelAdditionalProps instanceof RefProperty) { classMembers.add(getRefClassMembers((RefProperty) modelAdditionalProps)); } if (modelAdditionalProps == null) { List<String> enumValues = model.getEnum(); if (enumValues != null && !enumValues.isEmpty()) { classMembers.addAll(getEnum(enumValues)); } } } LOGGER.exiting(LOGGER.getName(), "getClassMembers-ModelImpl"); return classMembers; }
Example 6
Source File: TypeBuilder.java From api-compiler with Apache License 2.0 | 5 votes |
/** * Returns true if the modelImpl is a wrapper of primitive type like string, Float etc; false * otherwise */ private boolean isPrimitiveTypeWrapper(ModelImpl modelImpl) { return (modelImpl.getProperties() == null && modelImpl.getAdditionalProperties() == null) && !Strings.isNullOrEmpty(modelImpl.getType()) && !"object".equalsIgnoreCase(modelImpl.getType()) && WellKnownTypeUtils.isPrimitiveType(modelImpl.getType()); }
Example 7
Source File: DefaultCodegen.java From TypeScript-Microservices with MIT License | 4 votes |
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, ModelImpl swaggerModel) { MapProperty mapProperty = new MapProperty(swaggerModel.getAdditionalProperties()); addParentContainer(codegenModel, codegenModel.name, mapProperty); }
Example 8
Source File: TypeBuilder.java From api-compiler with Apache License 2.0 | 4 votes |
/** Returns true if the modelImpl has additional properties. */ private boolean hasAdditionalProperties(ModelImpl modelImpl) { return modelImpl.getAdditionalProperties() != null; }