github.com/unionj-cloud/go-doudou@v1.3.8-0.20221011095552-0088008e5b31/cmd/internal/openapi/v3/codegen/testdata/test5.json (about)

     1  {
     2    "openapi": "3.0.2",
     3    "info": {
     4      "title": "Usersvc",
     5      "description": "Usersvc User Center Service",
     6      "version": "v20220202"
     7    },
     8    "paths": {
     9      "/download/avatar": {
    10        "get": {
    11          "description": "GetDownloadAvatar demonstrate how to define download file api\nthere must be *os.File parameter among output parameters",
    12          "parameters": [
    13            {
    14              "name": "userId",
    15              "in": "query",
    16              "required": true,
    17              "schema": {
    18                "type": "string"
    19              }
    20            }
    21          ],
    22          "responses": {
    23            "200": {
    24              "content": {
    25                "application/octet-stream": {
    26                  "schema": {
    27                    "type": "string",
    28                    "format": "binary",
    29                    "description": "download file"
    30                  }
    31                }
    32              }
    33            }
    34          }
    35        }
    36      },
    37      "/page/users": {
    38        "post": {
    39          "description": "PageUsers demonstrate how to define POST and Content-Type as application/json api",
    40          "requestBody": {
    41            "content": {
    42              "application/json": {
    43                "schema": {
    44                  "$ref": "#/components/schemas/PageQuery",
    45                  "description": "comments above input and output struct type parameters in vo package will display on online document\nnot comments here"
    46                }
    47              }
    48            },
    49            "required": true
    50          },
    51          "responses": {
    52            "200": {
    53              "content": {
    54                "application/json": {
    55                  "schema": {
    56                    "$ref": "#/components/schemas/PageUsersResp"
    57                  }
    58                }
    59              }
    60            }
    61          }
    62        }
    63      },
    64      "/page/users/2": {
    65        "post": {
    66          "description": "PageUsers2 demonstrate how to define POST and Content-Type as application/json api",
    67          "requestBody": {
    68            "content": {
    69              "application/json": {
    70                "schema": {
    71                  "$ref": "#/components/schemas/PageQuery",
    72                  "description": "comments above input and output struct type parameters in vo package will display on online document\nnot comments here"
    73                }
    74              }
    75            }
    76          },
    77          "responses": {
    78            "200": {
    79              "content": {
    80                "application/json": {
    81                  "schema": {
    82                    "$ref": "#/components/schemas/PageUsers2Resp"
    83                  }
    84                }
    85              }
    86            }
    87          }
    88        }
    89      },
    90      "/sign/up": {
    91        "post": {
    92          "description": "SignUp demonstrate how to define POST and Content-Type as application/x-www-form-urlencoded api",
    93          "requestBody": {
    94            "content": {
    95              "application/x-www-form-urlencoded": {
    96                "schema": {
    97                  "$ref": "#/components/schemas/SignUpReq"
    98                }
    99              }
   100            },
   101            "required": true
   102          },
   103          "responses": {
   104            "200": {
   105              "content": {
   106                "application/json": {
   107                  "schema": {
   108                    "$ref": "#/components/schemas/SignUpResp"
   109                  }
   110                }
   111              }
   112            }
   113          }
   114        }
   115      },
   116      "/upload/avatar": {
   117        "post": {
   118          "description": "UploadAvatar demonstrate how to define upload files api\nthere must be one []v3.FileModel or v3.FileModel parameter among input parameters\nremember to close the readers by Close method of v3.FileModel if you don't need them anymore when you finished your own business logic",
   119          "requestBody": {
   120            "content": {
   121              "multipart/form-data": {
   122                "schema": {
   123                  "$ref": "#/components/schemas/UploadAvatarReq"
   124                }
   125              }
   126            },
   127            "required": true
   128          },
   129          "responses": {
   130            "200": {
   131              "content": {
   132                "application/json": {
   133                  "schema": {
   134                    "$ref": "#/components/schemas/UploadAvatarResp"
   135                  }
   136                }
   137              }
   138            }
   139          }
   140        }
   141      },
   142      "/upload/avatar/2": {
   143        "post": {
   144          "description": "UploadAvatar2 demonstrate how to define upload files api\nremember to close the readers by Close method of v3.FileModel if you don't need them anymore when you finished your own business logic",
   145          "requestBody": {
   146            "content": {
   147              "multipart/form-data": {
   148                "schema": {
   149                  "$ref": "#/components/schemas/UploadAvatar2Req"
   150                }
   151              }
   152            },
   153            "required": true
   154          },
   155          "responses": {
   156            "200": {
   157              "content": {
   158                "application/json": {
   159                  "schema": {
   160                    "$ref": "#/components/schemas/UploadAvatar2Resp"
   161                  }
   162                }
   163              }
   164            }
   165          }
   166        }
   167      },
   168      "/user": {
   169        "get": {
   170          "description": "GetUser demonstrate how to define GET api with query string parameters",
   171          "parameters": [
   172            {
   173              "name": "userId",
   174              "in": "query",
   175              "description": "user id\ncomments above input and output basic type parameters will display on online document",
   176              "required": true,
   177              "schema": {
   178                "type": "string",
   179                "description": "user id\ncomments above input and output basic type parameters will display on online document"
   180              }
   181            },
   182            {
   183              "name": "photo",
   184              "in": "query",
   185              "required": true,
   186              "schema": {
   187                "type": "string"
   188              }
   189            }
   190          ],
   191          "responses": {
   192            "200": {
   193              "content": {
   194                "application/json": {
   195                  "schema": {
   196                    "$ref": "#/components/schemas/GetUserResp"
   197                  }
   198                }
   199              }
   200            }
   201          }
   202        }
   203      },
   204      "/user/2": {
   205        "get": {
   206          "description": "GetUser2 demonstrate how to define GET api with query string parameters",
   207          "parameters": [
   208            {
   209              "name": "userId",
   210              "in": "query",
   211              "description": "user id\ncomments above input and output basic type parameters will display on online document",
   212              "required": true,
   213              "schema": {
   214                "type": "string",
   215                "description": "user id\ncomments above input and output basic type parameters will display on online document"
   216              }
   217            },
   218            {
   219              "name": "photo",
   220              "in": "query",
   221              "schema": {
   222                "type": "string"
   223              }
   224            }
   225          ],
   226          "responses": {
   227            "200": {
   228              "content": {
   229                "application/json": {
   230                  "schema": {
   231                    "$ref": "#/components/schemas/GetUser2Resp"
   232                  }
   233                }
   234              }
   235            }
   236          }
   237        }
   238      },
   239      "/user/3": {
   240        "get": {
   241          "description": "GetUser3 demonstrate how to define GET api with query string parameters",
   242          "parameters": [
   243            {
   244              "name": "userId",
   245              "in": "query",
   246              "description": "user id\ncomments above input and output basic type parameters will display on online document",
   247              "required": true,
   248              "schema": {
   249                "type": "string",
   250                "description": "user id\ncomments above input and output basic type parameters will display on online document"
   251              }
   252            },
   253            {
   254              "name": "photo",
   255              "in": "query",
   256              "schema": {
   257                "type": "string"
   258              }
   259            },
   260            {
   261              "name": "attrs",
   262              "in": "query",
   263              "required": true,
   264              "schema": {
   265                "type": "array",
   266                "items": {
   267                  "type": "integer",
   268                  "format": "int32"
   269                }
   270              }
   271            },
   272            {
   273              "name": "pattrs",
   274              "in": "query",
   275              "schema": {
   276                "type": "array",
   277                "items": {
   278                  "type": "integer",
   279                  "format": "int32"
   280                }
   281              }
   282            }
   283          ],
   284          "responses": {
   285            "200": {
   286              "content": {
   287                "application/json": {
   288                  "schema": {
   289                    "$ref": "#/components/schemas/GetUser3Resp"
   290                  }
   291                }
   292              }
   293            }
   294          }
   295        }
   296      },
   297      "/user/4": {
   298        "get": {
   299          "description": "GetUser4 demonstrate how to define GET api with query string parameters\nphoto *string, pattrs *[]int 是一类问题, TODO\nattrs2 []int 是一类问题",
   300          "parameters": [
   301            {
   302              "name": "userId",
   303              "in": "query",
   304              "description": "user id\ncomments above input and output basic type parameters will display on online document",
   305              "required": true,
   306              "schema": {
   307                "type": "string",
   308                "description": "user id\ncomments above input and output basic type parameters will display on online document"
   309              }
   310            },
   311            {
   312              "name": "photo",
   313              "in": "query",
   314              "schema": {
   315                "type": "string"
   316              }
   317            },
   318            {
   319              "name": "pattrs",
   320              "in": "query",
   321              "schema": {
   322                "type": "array",
   323                "items": {
   324                  "type": "integer",
   325                  "format": "int32"
   326                }
   327              }
   328            },
   329            {
   330              "name": "attrs2",
   331              "in": "query",
   332              "required": true,
   333              "schema": {
   334                "type": "array",
   335                "items": {
   336                  "type": "integer",
   337                  "format": "int32"
   338                }
   339              }
   340            }
   341          ],
   342          "responses": {
   343            "200": {
   344              "content": {
   345                "application/json": {
   346                  "schema": {
   347                    "$ref": "#/components/schemas/GetUser4Resp"
   348                  }
   349                }
   350              }
   351            }
   352          }
   353        }
   354      }
   355    },
   356    "components": {
   357      "schemas": {
   358        "GetUser2Resp": {
   359          "title": "GetUser2Resp",
   360          "type": "object",
   361          "properties": {
   362            "code": {
   363              "type": "integer",
   364              "format": "int32"
   365            },
   366            "data": {
   367              "type": "string"
   368            }
   369          },
   370          "required": [
   371            "code"
   372          ]
   373        },
   374        "GetUser3Resp": {
   375          "title": "GetUser3Resp",
   376          "type": "object",
   377          "properties": {
   378            "code": {
   379              "type": "integer",
   380              "format": "int32"
   381            },
   382            "data": {
   383              "type": "string"
   384            }
   385          },
   386          "required": [
   387            "code"
   388          ]
   389        },
   390        "GetUser4Resp": {
   391          "title": "GetUser4Resp",
   392          "type": "object",
   393          "properties": {
   394            "code": {
   395              "type": "integer",
   396              "format": "int32"
   397            },
   398            "data": {
   399              "type": "string"
   400            },
   401            "msg": {
   402              "type": "string"
   403            }
   404          },
   405          "required": [
   406            "code"
   407          ]
   408        },
   409        "GetUserResp": {
   410          "title": "GetUserResp",
   411          "type": "object",
   412          "properties": {
   413            "code": {
   414              "type": "integer",
   415              "format": "int32"
   416            },
   417            "data": {
   418              "type": "string"
   419            }
   420          },
   421          "required": [
   422            "code",
   423            "data"
   424          ]
   425        },
   426        "Order": {
   427          "title": "Order",
   428          "type": "object",
   429          "properties": {
   430            "col": {
   431              "type": "string"
   432            },
   433            "sort": {
   434              "type": "string"
   435            }
   436          },
   437          "description": "排序条件",
   438          "required": [
   439            "col",
   440            "sort"
   441          ]
   442        },
   443        "Page": {
   444          "title": "Page",
   445          "type": "object",
   446          "properties": {
   447            "orders": {
   448              "type": "array",
   449              "items": {
   450                "$ref": "#/components/schemas/Order"
   451              },
   452              "description": "排序规则"
   453            },
   454            "pageNo": {
   455              "type": "integer",
   456              "format": "int32",
   457              "description": "页码"
   458            },
   459            "size": {
   460              "type": "integer",
   461              "format": "int32",
   462              "description": "每页行数"
   463            }
   464          },
   465          "required": [
   466            "orders",
   467            "pageNo",
   468            "size"
   469          ]
   470        },
   471        "PageFilter": {
   472          "title": "PageFilter",
   473          "type": "object",
   474          "properties": {
   475            "dept": {
   476              "type": "integer",
   477              "format": "int32",
   478              "description": "所属部门ID"
   479            },
   480            "name": {
   481              "type": "string",
   482              "description": "真实姓名,前缀匹配"
   483            }
   484          },
   485          "description": "筛选条件",
   486          "required": [
   487            "name",
   488            "dept"
   489          ]
   490        },
   491        "PageQuery": {
   492          "title": "PageQuery",
   493          "type": "object",
   494          "properties": {
   495            "filter": {
   496              "$ref": "#/components/schemas/PageFilter"
   497            },
   498            "page": {
   499              "$ref": "#/components/schemas/Page"
   500            }
   501          },
   502          "description": "分页筛选条件",
   503          "required": [
   504            "filter",
   505            "page"
   506          ]
   507        },
   508        "PageRet": {
   509          "title": "PageRet",
   510          "type": "object",
   511          "properties": {
   512            "hasNext": {
   513              "type": "boolean"
   514            },
   515            "items": {
   516              "type": "object"
   517            },
   518            "pageNo": {
   519              "type": "integer",
   520              "format": "int32"
   521            },
   522            "pageSize": {
   523              "type": "integer",
   524              "format": "int32"
   525            },
   526            "total": {
   527              "type": "integer",
   528              "format": "int32"
   529            }
   530          },
   531          "description": "PageRet pagination query result",
   532          "required": [
   533            "items",
   534            "pageNo",
   535            "pageSize",
   536            "total",
   537            "hasNext"
   538          ]
   539        },
   540        "PageUsers2Resp": {
   541          "title": "PageUsers2Resp",
   542          "type": "object",
   543          "properties": {
   544            "code": {
   545              "type": "integer",
   546              "format": "int32",
   547              "description": "it indicates there is an error if code is not 0"
   548            },
   549            "data": {
   550              "$ref": "#/components/schemas/PageRet",
   551              "description": "page data"
   552            }
   553          },
   554          "required": [
   555            "code",
   556            "data"
   557          ]
   558        },
   559        "PageUsersResp": {
   560          "title": "PageUsersResp",
   561          "type": "object",
   562          "properties": {
   563            "code": {
   564              "type": "integer",
   565              "format": "int32",
   566              "description": "it indicates there is an error if code is not 0"
   567            },
   568            "data": {
   569              "$ref": "#/components/schemas/PageRet",
   570              "description": "page data"
   571            }
   572          },
   573          "required": [
   574            "code",
   575            "data"
   576          ]
   577        },
   578        "SignUpReq": {
   579          "title": "SignUpReq",
   580          "type": "object",
   581          "properties": {
   582            "actived": {
   583              "type": "boolean"
   584            },
   585            "password": {
   586              "type": "integer",
   587              "format": "int32"
   588            },
   589            "score": {
   590              "type": "number",
   591              "format": "double"
   592            },
   593            "username": {
   594              "type": "string"
   595            }
   596          },
   597          "required": [
   598            "username",
   599            "password",
   600            "actived",
   601            "score"
   602          ]
   603        },
   604        "SignUpResp": {
   605          "title": "SignUpResp",
   606          "type": "object",
   607          "properties": {
   608            "code": {
   609              "type": "integer",
   610              "format": "int32"
   611            },
   612            "data": {
   613              "type": "string"
   614            }
   615          },
   616          "required": [
   617            "code",
   618            "data"
   619          ]
   620        },
   621        "UploadAvatar2Req": {
   622          "title": "UploadAvatar2Req",
   623          "type": "object",
   624          "properties": {
   625            "pf": {
   626              "type": "array",
   627              "items": {
   628                "type": "string",
   629                "format": "binary"
   630              }
   631            },
   632            "pf2": {
   633              "type": "string",
   634              "format": "binary"
   635            },
   636            "pf3": {
   637              "type": "string",
   638              "format": "binary"
   639            },
   640            "ps": {
   641              "type": "string"
   642            }
   643          },
   644          "required": [
   645            "pf",
   646            "ps"
   647          ]
   648        },
   649        "UploadAvatar2Resp": {
   650          "title": "UploadAvatar2Resp",
   651          "type": "object",
   652          "properties": {
   653            "ri": {
   654              "type": "integer",
   655              "format": "int32"
   656            },
   657            "rs": {
   658              "type": "string"
   659            }
   660          },
   661          "required": [
   662            "ri",
   663            "rs"
   664          ]
   665        },
   666        "UploadAvatarReq": {
   667          "title": "UploadAvatarReq",
   668          "type": "object",
   669          "properties": {
   670            "pf": {
   671              "type": "array",
   672              "items": {
   673                "type": "string",
   674                "format": "binary"
   675              }
   676            },
   677            "ps": {
   678              "type": "string"
   679            }
   680          },
   681          "required": [
   682            "pf",
   683            "ps"
   684          ]
   685        },
   686        "UploadAvatarResp": {
   687          "title": "UploadAvatarResp",
   688          "type": "object",
   689          "properties": {
   690            "ri": {
   691              "type": "integer",
   692              "format": "int32"
   693            },
   694            "rs": {
   695              "type": "string"
   696            }
   697          },
   698          "required": [
   699            "ri",
   700            "rs"
   701          ]
   702        },
   703        "UserVo": {
   704          "title": "UserVo",
   705          "type": "object",
   706          "properties": {
   707            "dept": {
   708              "type": "string"
   709            },
   710            "id": {
   711              "type": "integer",
   712              "format": "int32"
   713            },
   714            "name": {
   715              "type": "string"
   716            },
   717            "phone": {
   718              "type": "string"
   719            }
   720          },
   721          "required": [
   722            "id",
   723            "name",
   724            "phone",
   725            "dept"
   726          ]
   727        }
   728      }
   729    }
   730  }