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 ; Validasi terhadap file 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 ));Validasi terhadap URL OpenAPI
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 ));Rute MyMVC menciptakan otomatis dari file OpenAPI
Semua rute mengarah ke operationId yang diberikan, diatur di OpenAPI
OpenApi Model Route:: autoCreateFromOpenApiFile (
Config:: get_MVC_PUBLIC_PATH () . ' /openapi/api.yaml ' ,
' FooControllerApi '
); Semua rute mengarah secara eksplisit ke Api::delegate()
OpenApi Model Route:: autoCreateFromOpenApiFile (
Config:: get_MVC_PUBLIC_PATH () . ' /openapi/api.yaml ' ,
' FooControllerApi ' ,
' delegate '
);Log ditembakkan ke acara.
Acara yang tersedia adalah:
myMVC_module_OpenApi::sYamlSourceDengarkan acara dan tulis kontennya ke logfile
MVC Event:: bind ( ' myMVC_module_OpenApi::sYamlSource ' , function ( $ sContent ){
MVC Log:: write ( $ sContent , ' openapi.log ' );
});