[TOC]前端
gitos: https://gitee.com/mliang/couplergit
graph TB subgraph 服務中轉 browser1[前端]--請求-->coupler1[coupler] coupler1[coupler]--返回-->browser1[前端] coupler1[coupler]--請求-->server1[後端] server1[後端]--返回-->coupler1[coupler] end subgraph 服務模擬 coupler2[coupler]--返回-->browser2[前端] browser2[前端]--請求-->coupler2[coupler] end subgraph 接口測試 coupler3[coupler]--請求-->server3[後端] server3[後端]--返回-->coupler3[coupler] end
graph LR coupler((coupler))-->文檔生成 coupler-->歷史文檔比較
graph TB subgraph core config document interface params result server end
graph TB subgraph extend swagger graphql end
graph TB subgraph tools compare end
graph TB 1[加載接口文檔] 2[加載接口列表] 3{批量掃描接口} 4[記錄dead接口] 5[訪問alive接口] 6[準備參數] 7[訪問接口] 8[比較返回數據] 9[記錄比較結果] 10[整理記錄並輸出] 1-->2 2-->3 3--dead-->4 3--alive-->5 5-->6 6-->7 7-->8 8-->9 9-->10 4-->10
graph TB 1[加載接口文檔] 2[加載接口列表] 3[啓動服務器並監聽] 4[接口訪問] 5{接口是否存在} 6{參數是否正確} 7{是否遠程接口訪問} 8[掃描遠程接口] a{遠程接口是否存在} 9{訪問遠程} 10[比較返回數據] b{返回數據是否符合規範} 11[返回數據] 12{是否本地模擬接口} 13{是否存在本地數據} 14[組織mock數據] 15[加載本地數據] 16{是否將mock數據保存在本地} 17[將mock數據保存在本地] 20>記錄錯誤信息] 21[輸出錯誤信息] 1-->2 2-->3 3-->4 4-->5 5--否-->20 5--是-->6 6--否-->20 6--是-->7 7--是-->8 8-->a a--否-->20 a--是-->9 9--訪問失敗-->20 9-->10 10-->b b--否-->20 b--是-->11 7--否-->12 12--是-->13 13--是-->15 15-->11 13--否-->14 14-->11 14-->16 16--是-->17 11-->21
- apis - [{version}] - api.json - [{interface}.json]
- servers - url (string) - description (string) - info - description (string) - version (string) - paths - /{path} - Components - schemas - parameters - responses
- /{path} - get|post|put|delete|options|head|patch|trace - description (string) - parameters - name (string) - in (string:"query","header","path","cookie",default:get|) - required (boolean,default:false) - description (string) - responses - default|HTTP Status Code - description - content - application/json | text/plain - schema - type - properties - key - type - format
- servers - url (string) - description (string) - info - description (string) - version (string) - paths - /{path} - get|post|put|delete|options|head|patch|trace - description (string) - parameters - name (string) - in (string:"query","header","path","cookie") - required (boolean) - description (string) - responses - default|HTTP Status Code - description - content - application/json | text/plain - schema - type - properties - key - type - format - Components - schemas - parameters - responses
1 消息express
▪ 100 Continue ▪ 101 Switching Protocols ▪ 102 Processing
2 成功json
▪ 200 OK ▪ 201 Created ▪ 202 Accepted ▪ 203 Non-Authoritative Information ▪ 204 No Content ▪ 205 Reset Content ▪ 206 Partial Content ▪ 207 Multi-Status
3 重定向後端
▪ 300 Multiple Choices ▪ 301 Moved Permanently ▪ 302 Move temporarily ▪ 303 See Other ▪ 304 Not Modified ▪ 305 Use Proxy ▪ 306 Switch Proxy ▪ 307 Temporary Redirect
4 請求錯誤api
▪ 400 Bad Request ▪ 401 Unauthorized ▪ 402 Payment Required ▪ 403 Forbidden ▪ 404 Not Found ▪ 405 Method Not Allowed ▪ 406 Not Acceptable ▪ 407 Proxy Authentication Required ▪ 408 Request Timeout ▪ 409 Conflict ▪ 410 Gone ▪ 411 Length Required ▪ 412 Precondition Failed ▪ 413 Request Entity Too Large ▪ 414 Request-URI Too Long ▪ 415 Unsupported Media Type ▪ 416 Requested Range Not Satisfiable ▪ 417 Expectation Failed ▪ 421 too many connections ▪ 422 Unprocessable Entity ▪ 423 Locked ▪ 424 Failed Dependency ▪ 425 Unordered Collection ▪ 426 Upgrade Required ▪ 449 Retry With ▪ 451 Unavailable For Legal Reasons
5 服務器錯誤數組
▪ 500 Internal Server Error ▪ 501 Not Implemented ▪ 502 Bad Gateway ▪ 503 Service Unavailable ▪ 504 Gateway Timeout ▪ 505 HTTP Version Not Supported ▪ 506 Variant Also Negotiates ▪ 507 Insufficient Storage ▪ 509 Bandwidth Limit Exceeded ▪ 510 Not Extended ▪ 600 Unparseable Response Headers
- openapi (string) - info (Info Object) - title (string) - description (string) - termsOfService (string) - contact (Contact Object) - name (string) - url (string) - email (string) - license (License Object) - name (string) - url (string) - version (string) - servers ([Server Object]) - url (string) - description (string) - variables (Map[string, Server Variable Object]) - enum ([string]) - default (string) - description (string) - paths ([Paths Object]) - /{path} (Path Item Object) - $ref (string) - summary (string) - description (string) - get (Operation Object) - tags ([string]) - summary (string) - description (string) - externalDocs (External Documentation Object) - description (string) - url (string) - operationId (string) - parameters ([Parameter Object|Reference Object]) - name (string) - in (string:"query","header","path","cookie") - description (string) - required (boolean) - deprecated (boolean) - allowEmptyValue (boolean) - style (string:more) - explode (boolean) - allowReserved (boolean) - schema (Schema Object | Reference Object) - example (Any) - examples (Map[ string, Example Object | Reference Object]) - summary (string) - description (string) - value (Any) - externalValue (string) - content (Map[string, Media Type Object]) - requestBody (Request Body Object|Reference Object) - description (string) - content (Map[string, Media Type Object]) - schema (Schema Object | Reference Object) - example (Any) - examples (Map[ string, Example Object | Reference Object]) - encoding (Map[string, Encoding Object]) - contentType (string) - headers (Map[string, Header Object | Reference Object]) - style (string) - explode (boolean) - allowReserved (boolean) - required (boolean) - responses (Responses Object) - default|HTTP Status Code (Response Object | Reference Object) - description (string) - headers (Map[string, Header Object | Reference Object]) - content (Map[string, Media Type Object]) - links (Map[string, Link Object | Reference Object]) - operationRef (string) - operationId (string) - parameters (Map[string, Any | {expression}]) - requestBody (Any | {expression}) - description (string) - server (Server Object) - callbacks (Map[string, Callback Object|Reference Object]) - {expression} (Path Item Object) - deprecated (boolean) - security ([Security Requirement Object]) - type (string) - description (string) - name (string) - in (string) - scheme (string) - bearerFormat (string) - flows (OAuth Flows Object) - implicit (OAuth Flow Object) - authorizationUrl (string) - tokenUrl (string) - refreshUrl (string) - scopes (Map[string, string]) - password (OAuth Flow Object) - clientCredentials (OAuth Flow Object) - authorizationCode (OAuth Flow Object) - openIdConnectUrl (string) - servers ([Server Object]) - put (Operation Object) - post (Operation Object) - delete (Operation Object) - options (Operation Object) - head (Operation Object) - patch (Operation Object) - trace (Operation Object) - servers [Server Object] - parameters [Parameter Object | Reference Object] - components (Components Object) - schemas (Map[string,Schema Object|Reference Object]) - nullable (boolean) - discriminator (Discriminator Object) - propertyName (string) - mapping (Map[string, string]) - readOnly (boolean) - writeOnly (boolean) - xml (XML Object) - name (string) - namespace (string) - prefix (string) - attribute (boolean) - wrapped (boolean) - externalDocs (External Documentation Object) - example (Any) - deprecated (boolean) - responses (Map[string,Response Object|Reference Object]) - parameters (Map[string,Parameter Object|Reference Object]) - examples (Map[string,Example Object|Reference Object]) - requestBodies (Map[string,Request Body Object|Reference Object]) - headers (Map[string,Header Object|Reference Object]) - securitySchemes (Map[string,Security Scheme Object|Reference Object]) - links (Map[string,Link Object|Reference Object]) - callbacks (Map[string,Callback Object|Reference Object]) - security ([Security Requirement Object]) - tags ([Tag Object]) - name - description - externalDocs (External Documentation Object) - externalDocs (External Documentation Object)
Header Object follows the structure of the Parameter Object服務器