io.swagger.models.Model.getVendorExtensions()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中io.swagger.models.Model.getVendorExtensions()方法的一些代码示例,展示了Model.getVendorExtensions()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.getVendorExtensions()方法的具体详情如下:
包路径:io.swagger.models.Model
类名称:Model
方法名:getVendorExtensions

Model.getVendorExtensions介绍

暂无

代码示例

代码示例来源:origin: apache/servicecomb-java-chassis

protected Map<String, Object> findVendorExtensions(Object def) {
  return ((Model) def).getVendorExtensions();
 }
}

代码示例来源:origin: apache/servicecomb-java-chassis

protected JavaType convertModel(String name, Model model) {
 updateJavaClassInVendor(model.getVendorExtensions(), name);
 return convert(model);
}

代码示例来源:origin: apache/servicecomb-java-chassis

@Override
public Model resolve(JavaType type, ModelConverterContext context, Iterator<ModelConverter> next) {
 // property is not a model
 if (propertyCreatorMap.containsKey(type.getRawClass())) {
  return null;
 }
 Model model = super.resolve(type, context, next);
 if (model == null) {
  return null;
 }
 checkType(type);
 // 只有声明model的地方才需要标注类型
 if (ModelImpl.class.isInstance(model) && !StringUtils.isEmpty(((ModelImpl) model).getName())) {
  setType(type, model.getVendorExtensions());
 }
 return model;
}

代码示例来源:origin: org.apache.servicecomb/swagger-generator-core

protected Map<String, Object> findVendorExtensions(Object def) {
  return ((Model) def).getVendorExtensions();
 }
}

代码示例来源:origin: com.holon-platform.jaxrs/holon-jaxrs-swagger-v2

/**
 * Check whether the given model is of {@link PropertyBox} type using the {@link SwaggerExtensions#MODEL_TYPE}
 * extension name.
 * @param model Model to check
 * @return <code>true</code> if given model is of {@link PropertyBox} type
 */
private static boolean isPropertyBoxModelType(Model model) {
  if (model != null && model.getVendorExtensions() != null
      && model.getVendorExtensions().containsKey(SwaggerExtensions.MODEL_TYPE.getExtensionName())
      && PropertyBox.class.getName()
          .equals(model.getVendorExtensions().get(SwaggerExtensions.MODEL_TYPE.getExtensionName()))) {
    return true;
  }
  return false;
}

代码示例来源:origin: okta/okta-sdk-java

protected void buildDiscriminationMap(Swagger swagger) {
  swagger.getDefinitions().forEach((name, model) -> {
    ObjectNode discriminatorMapExtention = (ObjectNode) model.getVendorExtensions().get("x-openapi-v3-discriminator");
    if (discriminatorMapExtention != null) {
      String propertyName = discriminatorMapExtention.get("propertyName").asText();
      ObjectNode mapping = (ObjectNode) discriminatorMapExtention.get("mapping");
      ObjectMapper mapper = new ObjectMapper();
      Map<String, String> result = mapper.convertValue(mapping, Map.class);
      result = result.entrySet().stream()
          .collect(Collectors.toMap(e -> e.getValue().substring(e.getValue().lastIndexOf('/')+1), e -> e.getKey()));
      result.forEach((key, value) -> {
        reverseDiscriminatorMap.put(key, name);
      });
      discriminatorMap.put(name, new Discriminator(name, propertyName, result));
    }
  });
}

代码示例来源:origin: io.swagger/swagger-inflector

@Override
public Map<String, Model> filterDefinitions(SwaggerSpecFilter filter, Map<String, Model> definitions,
    Map<String, List<String>> params, Map<String, String> cookies, Map<String, List<String>> headers) {
  final Map<String, Model> filteredDefinitions = super.filterDefinitions(filter, definitions, params, cookies,
      headers);
  if( filteredDefinitions != null ) {
    for (Model model : filteredDefinitions.values()) {
      filterVendorExtensions(model.getVendorExtensions());
    }
  }
  return filteredDefinitions;
}

代码示例来源:origin: swagger-api/swagger-inflector

@Override
public Map<String, Model> filterDefinitions(SwaggerSpecFilter filter, Map<String, Model> definitions,
    Map<String, List<String>> params, Map<String, String> cookies, Map<String, List<String>> headers) {
  final Map<String, Model> filteredDefinitions = super.filterDefinitions(filter, definitions, params, cookies,
      headers);
  if( filteredDefinitions != null ) {
    for (Model model : filteredDefinitions.values()) {
      filterVendorExtensions(model.getVendorExtensions());
    }
  }
  return filteredDefinitions;
}

代码示例来源:origin: okta/okta-sdk-java

protected void buildModelTagMap(Swagger swagger) {
  swagger.getDefinitions().forEach((key, definition) -> {
    Object tags = definition.getVendorExtensions().get("x-okta-tags");
    if (tags != null) {
      // if tags is NOT null, then assume it is an array
      if (tags instanceof List) {
        if (!((List) tags).isEmpty()) {
          String packageName = tagToPackageName(((List) tags).get(0).toString());
          addToModelTagMap(key, packageName);
          definition.getVendorExtensions().put("x-okta-package", packageName);
        }
      }
      else {
        throw new SwaggerException("Model: "+ key + " contains 'x-okta-tags' that is NOT a List.");
      }
    }
  });
}

代码示例来源:origin: org.apache.servicecomb/swagger-generator-core

protected JavaType convertModel(String name, Model model) {
 updateJavaClassInVendor(model.getVendorExtensions(), name);
 return convert(model);
}

代码示例来源:origin: okta/okta-sdk-java

if (model.getVendorExtensions().containsKey("x-baseType")) {
  String baseType = (String) model.getVendorExtensions().get("x-baseType");
  codegenModel.vendorExtensions.put("baseType", toModelName(baseType));
  codegenModel.imports.add(toModelName(baseType));
String parent = (String) model.getVendorExtensions().get("x-okta-parent");
if (StringUtils.isNotEmpty(parent)) {
  codegenModel.parent = toApiName(parent.substring(parent.lastIndexOf("/")));
    model.getVendorExtensions().put("discriminatorRoot", discriminatorRoot);

代码示例来源:origin: org.apache.servicecomb/swagger-generator-core

@Override
public Model resolve(JavaType type, ModelConverterContext context, Iterator<ModelConverter> next) {
 // property is not a model
 if (propertyCreatorMap.containsKey(type.getRawClass())) {
  return null;
 }
 Model model = super.resolve(type, context, next);
 if (model == null) {
  return null;
 }
 checkType(type);
 // 只有声明model的地方才需要标注类型
 if (ModelImpl.class.isInstance(model) && !StringUtils.isEmpty(((ModelImpl) model).getName())) {
  setType(type, model.getVendorExtensions());
 }
 return model;
}

代码示例来源:origin: okta/okta-sdk-java

String parent = (String) model.getVendorExtensions().get("x-okta-parent");
if (parent != null) {
  parent = parent.replaceAll(".*/", "");
  .map(resourceName -> swagger.getDefinitions().get(resourceName))
  .forEach(model -> {
    model.getVendorExtensions().put("top-level", true);
  });

代码示例来源:origin: okta/okta-sdk-java

if (baseModel.getVendorExtensions().containsKey("x-okta-tags")) {
  model.setVendorExtension("x-okta-tags", baseModel.getVendorExtensions().get("x-okta-tags"));

代码示例来源:origin: io.swagger/swagger-inflector

if(model.getVendorExtensions() != null && model.getVendorExtensions().get(Constants.X_SWAGGER_ROUTER_MODEL) != null) {
  final JavaType modelType = getTypeFromModelName(
      (String) model.getVendorExtensions().get(Constants.X_SWAGGER_ROUTER_MODEL));
  if (modelType != null) {
    return modelType;
  if(model.getVendorExtensions() == null || model.getVendorExtensions().get(Constants.X_SWAGGER_ROUTER_MODEL) == null) {

代码示例来源:origin: swagger-api/swagger-inflector

if(model.getVendorExtensions() != null && model.getVendorExtensions().get(Constants.X_SWAGGER_ROUTER_MODEL) != null) {
  final JavaType modelType = getTypeFromModelName(
      (String) model.getVendorExtensions().get(Constants.X_SWAGGER_ROUTER_MODEL));
  if (modelType != null) {
    return modelType;
  if(model.getVendorExtensions() == null || model.getVendorExtensions().get(Constants.X_SWAGGER_ROUTER_MODEL) == null) {

代码示例来源:origin: swagger-api/swagger-parser

if (v2Model.getVendorExtensions() != null) {
  Object nullableExtension = v2Model.getVendorExtensions().get("x-nullable");
  if (nullableExtension != null) {
    result.setNullable((Boolean) nullableExtension);

代码示例来源:origin: org.openapitools.swagger.parser/swagger-parser-v2-converter

if (v2Model.getVendorExtensions() != null) {
  Object nullableExtension = v2Model.getVendorExtensions().get("x-nullable");
  if (nullableExtension != null) {
    result.setNullable((Boolean) nullableExtension);

代码示例来源:origin: io.swagger.parser.v3/swagger-parser-v2-converter

if (v2Model.getVendorExtensions() != null) {
  Object nullableExtension = v2Model.getVendorExtensions().get("x-nullable");
  if (nullableExtension != null) {
    result.setNullable((Boolean) nullableExtension);

代码示例来源:origin: com.reprezen.genflow/genflow-api

return ((Operation) item).getVendorExtensions();
} else if (item instanceof Model) {
  return ((Model) item).getVendorExtensions();
} else if (item instanceof Property) {
  return ((Property) item).getVendorExtensions();

相关文章