multi fixtures
This commit is contained in:
@@ -1,66 +0,0 @@
|
||||
basepath: ""
|
||||
host: ""
|
||||
types:
|
||||
AStr:
|
||||
name: AStr
|
||||
desc: ""
|
||||
fields:
|
||||
A:
|
||||
type: string
|
||||
array: false
|
||||
desc: ""
|
||||
map: false
|
||||
mapkey: ""
|
||||
mapval: ""
|
||||
B:
|
||||
type: string
|
||||
array: true
|
||||
desc: ""
|
||||
map: false
|
||||
mapkey: ""
|
||||
mapval: ""
|
||||
col: ""
|
||||
methods:
|
||||
SomeAPI:
|
||||
desc: SomeAPI
|
||||
verb: PUT
|
||||
path: /someapi
|
||||
perm: ASD
|
||||
reqtype:
|
||||
typename: AStr
|
||||
ispointer: true
|
||||
isarray: false
|
||||
restype:
|
||||
typename: AStr
|
||||
ispointer: true
|
||||
isarray: true
|
||||
raw: false
|
||||
SomeAPI2:
|
||||
desc: SomeAPI2
|
||||
verb: POST
|
||||
path: /someapi
|
||||
perm: ""
|
||||
reqtype:
|
||||
typename: AStr
|
||||
ispointer: true
|
||||
isarray: false
|
||||
restype:
|
||||
typename: AStr
|
||||
ispointer: true
|
||||
isarray: true
|
||||
raw: false
|
||||
SomeAPI3:
|
||||
desc: SomeAPI3
|
||||
verb: POST
|
||||
path: /someapi3
|
||||
perm: ""
|
||||
reqtype:
|
||||
typename: AStr
|
||||
ispointer: true
|
||||
isarray: false
|
||||
restype:
|
||||
typename: AStr
|
||||
ispointer: true
|
||||
isarray: true
|
||||
raw: false
|
||||
namespace: ""
|
||||
@@ -0,0 +1,21 @@
|
||||
methods:
|
||||
SomeAPI3:
|
||||
desc: SomeAPI3
|
||||
verb: PUT
|
||||
path: /someapi
|
||||
perm: ASD
|
||||
reqtype:
|
||||
typename: time.Time
|
||||
ispointer: false
|
||||
isarray: false
|
||||
restype:
|
||||
typename: string
|
||||
ispointer: false
|
||||
isarray: true
|
||||
raw: false
|
||||
namespace: ""
|
||||
imports:
|
||||
context: context
|
||||
time: time
|
||||
used_imports:
|
||||
- time
|
||||
+23
-40
@@ -2,26 +2,10 @@ package goapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto"
|
||||
"time"
|
||||
)
|
||||
|
||||
//
|
||||
/*@API*/
|
||||
type ARequestStruct struct {
|
||||
A *string `json:"SUPERCALIFRAGILISPEALIDOUX"`
|
||||
B int64 `json:"bcd"`
|
||||
C time.Time
|
||||
D *string
|
||||
}
|
||||
|
||||
/*@API*/
|
||||
type AResponseStruct struct {
|
||||
A string
|
||||
B int64
|
||||
C time.Time
|
||||
D *string
|
||||
}
|
||||
|
||||
/*@API*/
|
||||
type AStr struct {
|
||||
Country string
|
||||
@@ -29,41 +13,40 @@ type AStr struct {
|
||||
HouseNumber int64
|
||||
IsCondo bool
|
||||
SomeWeirdTest string `json:"SUPERCALIFRAGILISPEALIDOUX"`
|
||||
Recursive map[string]AStr
|
||||
Arrofpstr []string `json:"arrofpstr,omitempty"`
|
||||
When time.Time
|
||||
Some crypto.Decrypter
|
||||
}
|
||||
|
||||
/*@API*/
|
||||
type AStr2 struct {
|
||||
Firstname string `json:"firstname"`
|
||||
Lastname string `json:"lastname"`
|
||||
Products []string
|
||||
Addresses map[string]AStr
|
||||
/*
|
||||
@API
|
||||
@PATH: /someapi
|
||||
@PERM: ASD
|
||||
@VERB: POST
|
||||
*/
|
||||
func SomeAPI(ctx context.Context, s string) (out string, err error) {
|
||||
print("Got:" + s)
|
||||
out = time.Now().String() + " - Hey Ya!"
|
||||
return
|
||||
}
|
||||
|
||||
/*@API*/
|
||||
type Noop struct{}
|
||||
|
||||
/*
|
||||
@API
|
||||
@PATH: /someapi
|
||||
@PERM: ASD
|
||||
@VERB: PUT
|
||||
*/
|
||||
func SomeAPI(ctx context.Context, a *Noop) ([]*AStr, error) {
|
||||
return nil, nil
|
||||
}
|
||||
//func SomeAPI2(ctx context.Context, s dcsession.Session) ([]string, error) {
|
||||
// return nil, nil
|
||||
//}
|
||||
|
||||
/*
|
||||
@API
|
||||
@PATH: /someapi
|
||||
@PERM: ASD
|
||||
@VERB: PUT
|
||||
*/
|
||||
func SomeAPI2(ctx context.Context, a *AStr2) ([]*AStr, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
/*
|
||||
@API
|
||||
@PATH: /someapi3
|
||||
*/
|
||||
func SomeAPI3(ctx context.Context, a *AStr) ([]*AStr, error) {
|
||||
return nil, nil
|
||||
}
|
||||
//func SomeAPI3(ctx context.Context, a time.Time) ([]string, error) {
|
||||
// return nil, nil
|
||||
//}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"go.digitalcircle.com.br/tools/apigen/test/goapi"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
aapi := goapi.Init()
|
||||
http.DefaultServeMux.HandleFunc("/", aapi.Mux.ServeHTTP)
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
###
|
||||
#SomeAPI
|
||||
PUT https://host/basepath/someapi
|
||||
Content-Type: application/json
|
||||
Cookie: dc=<MYCOOKIE>
|
||||
|
||||
{}
|
||||
|
||||
###
|
||||
#SomeAPI2
|
||||
POST https://host/basepath/someapi
|
||||
Content-Type: application/json
|
||||
Cookie: dc=<MYCOOKIE>
|
||||
|
||||
{
|
||||
"addresses": {
|
||||
"a": {
|
||||
"SUPERCALIFRAGILISPEALIDOUX": "A STRING VALUE",
|
||||
"city": "A STRING VALUE",
|
||||
"country": "A STRING VALUE",
|
||||
"housenumber": 123456,
|
||||
"iscondo": true
|
||||
},
|
||||
"b": {
|
||||
"SUPERCALIFRAGILISPEALIDOUX": "A STRING VALUE",
|
||||
"city": "A STRING VALUE",
|
||||
"country": "A STRING VALUE",
|
||||
"housenumber": 123456,
|
||||
"iscondo": true
|
||||
},
|
||||
"c": {
|
||||
"SUPERCALIFRAGILISPEALIDOUX": "A STRING VALUE",
|
||||
"city": "A STRING VALUE",
|
||||
"country": "A STRING VALUE",
|
||||
"housenumber": 123456,
|
||||
"iscondo": true
|
||||
}
|
||||
},
|
||||
"firstname": "A STRING VALUE",
|
||||
"lastname": "A STRING VALUE",
|
||||
"products": [
|
||||
"A STRING VALUE",
|
||||
"A STRING VALUE",
|
||||
"A STRING VALUE"
|
||||
]
|
||||
}
|
||||
|
||||
###
|
||||
#SomeAPI3
|
||||
POST https://host/basepath/someapi3
|
||||
Content-Type: application/json
|
||||
Cookie: dc=<MYCOOKIE>
|
||||
|
||||
{
|
||||
"SUPERCALIFRAGILISPEALIDOUX": "A STRING VALUE",
|
||||
"city": "A STRING VALUE",
|
||||
"country": "A STRING VALUE",
|
||||
"housenumber": 123456,
|
||||
"iscondo": true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user