💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## Schema请求类型 参数`@SWG\Schema()`是输入和输出数据类型的定义,这些类型可以是对象,也可以是字符串和数组 ``` /** * @SWG\Post( * path="/index/index/user", * tags={"用户相关"}, * summary="个人资料", * consumes={"application/json"}, * produces={"application/json"}, * @SWG\Parameter( * in="body", * required=true, * name="body", * description="description", * @SWG\Schema(example={"username"="username","password"="password"}) * ) */ ``` | 参数 |含义 | | --- | --- | | ref | 允许此路径项的外部定义 | | example | 设置一个自定义的对象 | | discriminator | 添加多个自定义 `ref` 的支持 | > 我们来看看参数`@SWG\Schema()`使用 > 使用`example`参数来自定义 ``` /** * @SWG\Schema(example={"username"="username","password"="password"}) */ ``` > 使用`discriminator`参数来进行多个模型的支持 ``` /** * * @SWG\Response(response="200",description="ok",@SWG\Schema(ref="#/definitions/Definition",discriminator="Definition")), * @SWG\Response(response="404",description="ok",@SWG\Schema(ref="#/definitions/index",discriminator="index")) */ ``` > 使用`@SWG\Property()`参数来设置: > | 参数 | 含义 | | --- | --- | | property | 名称 | | type | 类型 可设置值为 string、 number、 integer、boolean、array、object" | | example | 设置默认值 | | readOnly | 属性声明 | ``` /** @SWG\Schema( * @SWG\Property( * property="username", * type="string", * example="username" * ), * @SWG\Property( * property="password", * type="string", * example="password" * ), * @SWG\Property( * property="sex", * type="integer", * example=0 * ) * ) * / ``` > 参数`readOnly`如果设置为true,这意味着它只作为响应的一部分发送,不能作为请求的一部分发送,默认false >