问题描述
- darkaonline / l5-swagger:8.0.2
- PHP版本:7.3.13
- zircote / swagger-php:3.1.0
- 操作系统:Windows
我创建了一个 const [car,setCar] = useState(new Car());
useEffect(() => {
setCar(Object.assign(Object.create(Car.prototype),car))
},[])
对象。
现在,在我的Contract ref
中,我要列出一系列合同。
我该怎么做?
尝试在ContractController
中添加Couldn't find constant array
时出现错误type=array
OA\Items
/**
* @OA\Info(title="Contract API",version="1")
*/
class ContractController extends Controller
{
/**
* @OA\Post(
* path="/api/v1/contract/list",* tags={"contact"},* summary="List Contract",* operationId="list",* @OA\Parameter(
* name="keyword",* in="path",* description="keyword to search contracts",* required=false,* @OA\Schema(
* type="string"
* )
* ),* @OA\Parameter(
* name="lang_code",* description="lang_code define language client used",* @OA\Schema(
* type="string",* )
* ),* @OA\Response(
* response=200,* description="successful",* @OA\JsonContent(
* @OA\Items(
* type=array,#This is where I got the error
* ref="#/components/schemas/Contract"
* )
* )
* ),* @OA\Response(
* response=400,* description="Wrong"
* )
* )
*/
public function list(Request $request)
{
$contracts = Contract::factory()->count(10)->make();
return response()->json([
'message' => 'good','contracts' => $contracts
],200);
}
}
解决方法
使用type="array",
(带有"
s)而不是type=array,