@apimodelproperty()注解用于方法、字段,表示对model属性的说明或者数据操作更改,以下是它的源码:
// intellij api decompiler stub source generated from a class file // implementation of methods is not availab大理护理职业学院le package io.swagger.annotations; @java.lang.annotation.target({java.lang.annotation.elementtype.method, java.lang.annotation.elementtype.field})@java.lang.annotation.retention(java.lang.annotation.retentionpolicy.runtime)public @interface apimodelproperty { java.lang.string value() default ""; java.lang.string name() default ""; java.lang.string allowablevalues() default ""; java.lang.string access() default ""; java.lang.string notes() default ""; java.lan茅屋为秋风所破歌原文g.string datatype() default ""; boolean required() default fal; int position() default 0; boolean hidden() 8090的歌default fal; java.lang.string example() default ""; /** * @deprecated */ @java.lang.deprecated boolean readonly() default fal; io.swagger.annotations.apimodelproperty.accessmode accessmode() default io.swagger.annotations.apimodelproperty.accessmode.auto; java.lang.string reference() default ""; boolean allowemptyvalue() default fal; io.swagger.annotations.extension[] extensions() default {@io.swagger.annotations.extension(properties = {@io.swagger.annotations.extensionproperty(name = "", value = "")})}; static enum accessmode { auto, read_only, read_write; private accessmode() { /* compiled code */ } }}
value
:字段说明name
:重写属性名字datatype
:重写属性类型required
:是否必须,默认falexample
:举例hidden
:隐藏@apimodel(value="ur", descr学习的励志句子iption="urs")public class urvo implements rializable{ private static final long rialversionuid = 1l; @apimodelproperty(value="用户名", name="urname", example="xzw") private string urname; @apimodelproperty(value="状态", name="status", required=true) private integer status; private string pwd; private string nname; private integer flag; @apimodelproperty(value="grade数组", hidden=true) private string[] grades; private list<string> gradelist;}
可以把
@apimodelproperty(value= "id")
替换成
@apimodelproperty(example = "id")
即可~
以上为个人经验,希望能给大家一个参考,也希望大家多多支持www.887551.com。
本文发布于:2023-04-04 13:35:23,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/02f9e6264c03abd030fa32cf70cbce38.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:SpringBoot中的@ApiModelProperty注解作用.doc
本文 PDF 下载地址:SpringBoot中的@ApiModelProperty注解作用.pdf
留言与评论(共有 0 条评论) |