add int64 dataType

This commit is contained in:
MaxToby
2021-01-03 16:10:42 +08:00
parent ec36bd4c17
commit 65c9afac77
7 changed files with 70 additions and 244 deletions

View File

@ -1,3 +1,3 @@
package example
//go:generate goctl api plugin -plugin goctl-swagger="swagger" -api user.api -dir .
//go:generate goctl api plugin -plugin goctl-swagger="swagger" -api test.api -dir .

View File

@ -1,226 +0,0 @@
{
"swagger": "2.0",
"info": {
"title": "",
"version": ""
},
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/api/user/:id": {
"get": {
"summary": "获取用户信息",
"operationId": "/api/user/:id",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/UserInfoReply"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/UserInfoReq"
}
}
],
"tags": [
"user-api"
]
}
},
"/api/user/login": {
"post": {
"summary": "登录",
"operationId": "/api/user/login",
"responses": {
"200": {
"description": "A successful response.",
"schema": {}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {}
}
],
"tags": [
"user-api"
]
}
},
"/api/user/register": {
"post": {
"summary": "注册",
"description": "注册一个用户",
"operationId": "/api/user/register",
"responses": {
"200": {
"description": "A successful response.",
"schema": {}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {}
}
],
"tags": [
"user-api"
]
}
},
"/api/user/search": {
"get": {
"summary": "用户搜索",
"operationId": "/api/user/search",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/UserSearchReply"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/UserSearchReq"
}
}
],
"tags": [
"user-api"
]
}
},
"/user/ping": {
"get": {
"operationId": "/user/ping",
"responses": {
"200": {
"description": "A successful response.",
"schema": {}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {}
}
],
"tags": [
"greet"
]
}
}
},
"definitions": {
"LoginReq": {
"type": "object",
"properties": {
"Username": {
"type": "string"
},
"Password": {
"type": "string"
}
},
"title": "LoginReq"
},
"RegisterReq": {
"type": "object",
"properties": {
"Username": {
"type": "string"
},
"Password": {
"type": "string"
},
"Mobile": {
"type": "string"
}
},
"title": "RegisterReq"
},
"UserInfoReply": {
"type": "object",
"properties": {
"Name": {
"type": "string"
},
"Age": {
"type": "integer",
"format": "int32"
},
"Birthday": {
"type": "string"
},
"Description": {
"type": "string"
},
"Tag": {
"type": "array",
"items": {
"type": "string"
}
}
},
"title": "UserInfoReply"
},
"UserInfoReq": {
"type": "object",
"properties": {
"Id": {
"type": "string"
}
},
"title": "UserInfoReq"
},
"UserSearchReply": {
"type": "object",
"properties": {
"KeyWord": {
"type": "array",
"items": {
"$ref": "#/definitions/UserInfoReply"
}
}
},
"title": "UserSearchReply"
},
"UserSearchReq": {
"type": "object",
"properties": {
"KeyWord": {
"type": "string"
}
},
"title": "UserSearchReq"
}
}
}

49
example/test.api Normal file
View File

@ -0,0 +1,49 @@
info(
title: "小程序商城"
desc: "小程序商品首页"
version: "1.0"
)
type IndexResp struct {
NewList []NewList `json:"NewList"`
RandomList []RandomList `json:"Randomlist"`
BannerList []BannerList `json:"bannerlist"`
}
type NewList struct {
GoodsList
}
type RandomList struct {
GoodsList
}
type BannerList struct {
Image string `json:"image"`
Title string `json:"title"`
ID int64 `json:"id"`
}
type GoodsList {
GoodsID int64 `json:"goods_id"`
GoodsName string `json:"goods_name"`
CategoryID int64 `json:"category_id"`
Images string `json:"images"`
SpecType string `json:"spec_type"`
DeductStockType string `json:"deduct_stock_type"`
Content string `json:"content"`
SalesInitial int `json:"sales_initial"`
SalesActual int `json:"sales_actual"`
GoodsSort int `json:"goods_sort"`
DeliveryID int64 `json:"delivery_id"`
GoodsStatus string `json:"goods_status"`
IsDelete string `json:"is_delete"`
ImageFrist string `json:"ImageFrist"`
GoodsSales int `json:"goods_sales"`
}
service index-api {
@doc(
summary: "首页列表"
)
@server(
handler: IndexHandler
)
get /index/index returns (IndexResp)
}

View File

@ -75,5 +75,4 @@ service user-api {
service user-api {
@handler ping
get /user/ping
}
//goctl api plugin -plugin goctl-swagger -api user.api -dir .
}