zoukankan      html  css  js  c++  java
  • Swagger注解-@ApiModel 和 @ApiModelProperty

    @ApiModel

    使用场景

    在实体类上边使用,标记类时swagger的解析类

    概述

    提供有关swagger模型的其它信息,类将在操作中用作类型时自动内省

    属性

    属性名称数据类型默认值说明
    value String 类名 为模型提供备用名称
    description String “” 提供详细的类描述
    parent Class<?> parent Void.class 为模型提供父类以允许描述继承关系
    discriminatory String “” 支持模型继承和多态,使用鉴别器的字段的名称,可以断言需要使用哪个子类型
    subTypes Class<?>[] {} 从此模型继承的子类型数组
    reference String “” 指定对应类型定义的引用,覆盖指定的任何其他元数据

    @ApiModelProperty

    使用场景

    使用在被 @ApiModel 注解的模型类的属性上

    概述

    添加和操作模型属性的数据

    属性

    属性名称数据类型默认值说明
    value String “” 属性简要说明
    name String “” 运行覆盖属性的名称。重写属性名称
    allowableValues String “” 限制参数可接收的值,三种方法,固定取值,固定范围
    access String “” 过滤属性,参阅:io.swagger.core.filter.SwaggerSpecFilter
    notes String “” 目前尚未使用
    dataType String “” 参数的数据类型,可以是类名或原始数据类型,此值将覆盖从类属性读取的数据类型
    required boolean false 是否为必传参数,false:非必传参数; true:必传参数
    position int 0 允许在模型中显示排序属性
    hidden boolean false 隐藏模型属性,false:不隐藏; true:隐藏
    example String “” 属性的示例值
    readOnly boolean false 指定模型属性为只读,false:非只读; true:只读
    reference String “” 指定对应类型定义的引用,覆盖指定的任何其他元数据
    allowEmptyValue boolean false 允许传空值,false:不允许传空值; true:允许传空值
  • 相关阅读:
    hive 之only supports newline ' ' right now. Error encountered near token ''报错
    四、第三方图标库
    三、工具模块封装(二):封装mock模块
    三、工具模块封装(一):封装axios模块
    二、前端项目案例
    一、搭建前端开发环境(Vue+element)
    注册中心(Consul)
    系统服务监控(Spring Boot Admin)
    JWT
    Spring Security(四)
  • 原文地址:https://www.cnblogs.com/exmyth/p/14305975.html
Copyright © 2011-2022 走看看