myMVC_module_OpenApi
1.1.0
pdo扩展git clone --branch 3.x https://github.com/gueff/myMVC.git myMVC_3.xgit克隆
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 ));从OpenAPI文件自动创建MYMVC路由
所有路线都导致其给定的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 ' );
});