myMVC_module_OpenApi
1.1.0
pdogit clone --branch 3.x https://github.com/gueff/myMVC.git myMVC_3.xgit clone
cd /modules/ ;
git clone --branch 1.x
https://github.com/gueff/myMVC_module_OpenApi.git
OpenApi ; ตรวจสอบกับ ไฟล์ openapi
use OpenApi Model Validate ;
$ oDTValidateRequestResponse = Validate:: request (
$ oDTRequestCurrent ,
Config:: get_MVC_PUBLIC_PATH () . ' /openapi/api.yaml '
);
header ( ' Content-Type: application/json ' );
echo json_encode (Convert:: objectToArray ( $ oDTValidateRequestResponse ));ตรวจสอบกับ OpenAPI URL
use OpenApi Model Validate ;
// validate against openapi URL
$ oDTValidateRequestResponse = Validate:: request (
$ oDTRequestCurrent ,
' https://example.com/api/openapi.yaml '
);
header ( ' Content-Type: application/json ' );
echo json_encode (Convert:: objectToArray ( $ oDTValidateRequestResponse ));การสร้างเส้นทาง MYMVC อัตโนมัติจากไฟล์ OpenAPI
เส้นทางทั้งหมดนำไปสู่ operationId ที่กำหนดไว้ใน OpenAPI
OpenApi Model Route:: autoCreateFromOpenApiFile (
Config:: get_MVC_PUBLIC_PATH () . ' /openapi/api.yaml ' ,
' FooControllerApi '
); เส้นทางทั้งหมดนำไปสู่ Api::delegate()
OpenApi Model Route:: autoCreateFromOpenApiFile (
Config:: get_MVC_PUBLIC_PATH () . ' /openapi/api.yaml ' ,
' FooControllerApi ' ,
' delegate '
);บันทึกจะถูกไล่ออกไปยังเหตุการณ์
กิจกรรมที่มีอยู่คือ:
myMVC_module_OpenApi::sYamlSourceฟังเหตุการณ์และเขียนเนื้อหาลงใน LogFile
MVC Event:: bind ( ' myMVC_module_OpenApi::sYamlSource ' , function ( $ sContent ){
MVC Log:: write ( $ sContent , ' openapi.log ' );
});