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

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

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

Model.setTitle介绍

暂无

代码示例

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

private static boolean definePropertySetModel(Model model, String name, String description) {
  return SwaggerResolutionContext.getSwagger().map(swagger -> {
    // check already defined
    if (!hasSchema(swagger, name)) {
      // build and define
      model.setTitle(name);
      if (description != null) {
        model.setDescription(description);
      }
      // add schema to include
      SwaggerResolutionContext.getModels().ifPresent(schemas -> {
        if (!schemas.containsKey(name)) {
          schemas.put(name, model);
        }
      });
    }
    return true;
  }).orElse(false);
}

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

/**
 * Get the {@link PropertyBox} type Schema from given type, if a {@link PropertySet} is available using a
 * {@link PropertySetRef} annotation.
 * @param type The type to resolve
 * @param context Converter context
 * @return Optional {@link PropertyBox} type Schema
 */
private static Optional<Model> getPropertyBoxSchema(Type type, ModelConverterContext context) {
  return getPropertySet(type).map(ref -> PropertySetRefIntrospector.get().getPropertySet(ref))
      .map(propertySet -> {
        final Function<Type, io.swagger.models.properties.Property> resolver = t -> context
            .resolveProperty(t, new Annotation[0]);
        // check API model
        return getPropertySetModel(type).map(apiModel -> {
          final String name = apiModel.value().trim();
          // define model
          Model schema = buildPropertyBoxSchema(propertySet, resolver, false);
          schema.setTitle(name);
          if (AnnotationUtils.getStringValue(apiModel.description()) != null) {
            schema.setDescription(apiModel.description());
          }
          context.defineModel(name, schema);
          // return as ref
          RefModel model = new RefModel(name);
          return (Model) model;
        }).orElseGet(() -> {
          return buildPropertyBoxSchema(propertySet, resolver, false);
        });
      });
}

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

model.setTitle(value);

相关文章