swagger OK resopnse bodies
parent
f11261f0da
commit
4aea3dab40
13
deploy.sh
13
deploy.sh
|
|
@ -8,19 +8,16 @@ function main() {
|
||||||
go test ./...
|
go test ./...
|
||||||
fi
|
fi
|
||||||
GOOS=linux GOARCH=arm GOARM=5 gobuild $exec
|
GOOS=linux GOARCH=arm GOARM=5 gobuild $exec
|
||||||
for authed in dndex; do # dndex-auth; do
|
scp -r ./public/swagger/* zach@tickle.lan:./dndex1/files/swagger/
|
||||||
scp ./public/swagger/* zach@tickle.lan:./$authed/files/swagger/
|
scp $exec zach@tickle.lan:./dndex1/dndex.new
|
||||||
scp $exec zach@tickle.lan:./$authed/dndex.new
|
ssh zach@tickle.lan bash -c "true; while [ -e ./dndex1/dndex.new ]; do printf '.'; sleep 3; done; echo"
|
||||||
ssh zach@tickle.lan bash -c "true; while [ -e ./$authed/dndex.new ]; do printf '.'; sleep 3; done; echo"
|
if [ -n "$BIG" ]; then
|
||||||
done &
|
|
||||||
wait
|
|
||||||
GOOS=linux gobuild $exec
|
GOOS=linux gobuild $exec
|
||||||
echo scp $exec bel@remote.blapointe.com:/home/bel/services/bin/dndex.new
|
echo scp $exec bel@remote.blapointe.com:/home/bel/services/bin/dndex.new
|
||||||
echo ssh bel@remote.blapointe.com bash -c 'true; md5sum ./services/bin/dndex*; while [ -e ./services/bin/dndex.new ]; do printf "."; sleep 3; done; md5sum ./services/bin/dndex*'
|
echo ssh bel@remote.blapointe.com bash -c 'true; md5sum ./services/bin/dndex*; while [ -e ./services/bin/dndex.new ]; do printf "."; sleep 3; done; md5sum ./services/bin/dndex*'
|
||||||
rm $exec
|
|
||||||
if [ -n "$BIG" ]; then
|
|
||||||
big
|
big
|
||||||
fi
|
fi
|
||||||
|
rm $exec
|
||||||
}
|
}
|
||||||
|
|
||||||
function gobuild() {
|
function gobuild() {
|
||||||
|
|
|
||||||
31
init.sh
31
init.sh
|
|
@ -1,31 +0,0 @@
|
||||||
#! /bin/bash
|
|
||||||
|
|
||||||
port=57017
|
|
||||||
|
|
||||||
if false && ! curl -sS localhost:$port > /dev/null; then
|
|
||||||
prefix=/tmp/whodunit.db
|
|
||||||
mkdir -p $prefix/data
|
|
||||||
mongod \
|
|
||||||
--dbpath $prefix/data \
|
|
||||||
--logpath $prefix/log \
|
|
||||||
--pidfilepath $prefix/pid \
|
|
||||||
--port $port \
|
|
||||||
--fork
|
|
||||||
fi
|
|
||||||
|
|
||||||
mshell() {
|
|
||||||
mongo \
|
|
||||||
--quiet \
|
|
||||||
--port $port \
|
|
||||||
--eval "$*"
|
|
||||||
}
|
|
||||||
|
|
||||||
remove() {
|
|
||||||
mshell \
|
|
||||||
'db.getSiblingDB("db")["col"].remove({})'
|
|
||||||
}
|
|
||||||
|
|
||||||
export DBURI=${DB_URI:-"mongodb://localhost:$port"}
|
|
||||||
|
|
||||||
export DRIVERTYPE=boltdb
|
|
||||||
export DBURI=$(mktemp)
|
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
paths:
|
||||||
|
summary: "Interact with one entity within a namespace"
|
||||||
|
delete:
|
||||||
|
description: "Delete an existing entity"
|
||||||
|
tags:
|
||||||
|
- entities
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/token"
|
||||||
|
- $ref: "#/components/parameters/id"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
$ref: "#/components/schemas/responseOK"
|
||||||
|
|
||||||
|
get:
|
||||||
|
description: "Get an existing entity"
|
||||||
|
tags:
|
||||||
|
- entities
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/token"
|
||||||
|
- $ref: "#/components/parameters/id"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
$ref: "#/components/schemas/responseOneResolved"
|
||||||
|
|
||||||
|
put:
|
||||||
|
description: "Replace an existing entity"
|
||||||
|
tags:
|
||||||
|
- entities
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/token"
|
||||||
|
- $ref: "#/components/parameters/id"
|
||||||
|
requestBody:
|
||||||
|
$ref: "#/components/schemas/requestOne"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
$ref: "#/components/schemas/responseOne"
|
||||||
|
|
||||||
|
patch:
|
||||||
|
description: "Update an existing entity"
|
||||||
|
tags:
|
||||||
|
- entities
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/token"
|
||||||
|
- $ref: "#/components/parameters/id"
|
||||||
|
requestBody:
|
||||||
|
$ref: "#/components/schemas/requestOne"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
$ref: "#/components/schemas/responseOne"
|
||||||
|
|
||||||
|
components:
|
||||||
|
parameters:
|
||||||
|
token:
|
||||||
|
$ref: "../swagger.yaml#/components/parameters/token"
|
||||||
|
id:
|
||||||
|
$ref: "../swagger.yaml#/components/parameters/id"
|
||||||
|
|
||||||
|
schemas:
|
||||||
|
requestOne:
|
||||||
|
$ref: "../swagger.yaml#/components/schemas/requestOne"
|
||||||
|
responseOne:
|
||||||
|
$ref: "../swagger.yaml#/components/schemas/responseOne"
|
||||||
|
responseOneResolved:
|
||||||
|
$ref: "../swagger.yaml#/components/schemas/responseOneResolved"
|
||||||
|
responseOK:
|
||||||
|
$ref: "../swagger.yaml#/components/schemas/responseOK"
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
paths:
|
||||||
|
summary: "Interact with one field of one entity within a namespace"
|
||||||
|
delete:
|
||||||
|
description: "Delete an existing entity's field's value"
|
||||||
|
tags:
|
||||||
|
- entities
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/token"
|
||||||
|
- $ref: "#/components/parameters/id"
|
||||||
|
- $ref: "#/components/parameters/path"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
$ref: "#/components/schemas/responseOne"
|
||||||
|
|
||||||
|
get:
|
||||||
|
description: "Get an existing entity's field's value"
|
||||||
|
tags:
|
||||||
|
- entities
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/token"
|
||||||
|
- $ref: "#/components/parameters/id"
|
||||||
|
- $ref: "#/components/parameters/path"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
$ref: "#/components/schemas/responseOne"
|
||||||
|
|
||||||
|
put:
|
||||||
|
description: "Replace an existing entity's field's value"
|
||||||
|
tags:
|
||||||
|
- entities
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/token"
|
||||||
|
- $ref: "#/components/parameters/id"
|
||||||
|
- $ref: "#/components/parameters/path"
|
||||||
|
requestBody:
|
||||||
|
$ref: "#/components/schemas/requestOne"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
$ref: "#/components/schemas/responseOne"
|
||||||
|
|
||||||
|
patch:
|
||||||
|
description: "Update an existing entity's field's value"
|
||||||
|
tags:
|
||||||
|
- entities
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/token"
|
||||||
|
- $ref: "#/components/parameters/id"
|
||||||
|
- $ref: "#/components/parameters/path"
|
||||||
|
requestBody:
|
||||||
|
$ref: "#/components/schemas/requestOne"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
$ref: "#/components/schemas/responseOne"
|
||||||
|
|
||||||
|
components:
|
||||||
|
parameters:
|
||||||
|
token:
|
||||||
|
$ref: "../swagger.yaml#/components/parameters/token"
|
||||||
|
id:
|
||||||
|
$ref: "../swagger.yaml#/components/parameters/id"
|
||||||
|
path:
|
||||||
|
$ref: "../swagger.yaml#/components/parameters/path"
|
||||||
|
schemas:
|
||||||
|
responseOne:
|
||||||
|
$ref: "../swagger.yaml#/components/schemas/responseOne"
|
||||||
|
requestOne:
|
||||||
|
$ref: "../swagger.yaml#/components/schemas/requestOne"
|
||||||
|
objectOne:
|
||||||
|
$ref: "../swagger.yaml#/components/schemas/objectOne"
|
||||||
|
responseOK:
|
||||||
|
$ref: "../swagger.yaml#/components/schemas/responseOK"
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
paths:
|
||||||
|
summary: "Interact with all entities within a namespace"
|
||||||
|
get:
|
||||||
|
description: "Get names and IDs of all entities"
|
||||||
|
tags:
|
||||||
|
- entities
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/token"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
content:
|
||||||
|
applicaiton/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
Name: string
|
||||||
|
ID: string
|
||||||
|
example:
|
||||||
|
Name: John Smith
|
||||||
|
ID: abc-123
|
||||||
|
|
||||||
|
post:
|
||||||
|
description: "Create a new entity"
|
||||||
|
tags:
|
||||||
|
- entities
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/token"
|
||||||
|
requestBody:
|
||||||
|
$ref: "#/components/schemas/requestOne"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
$ref: "#/components/schemas/responseOne"
|
||||||
|
|
||||||
|
components:
|
||||||
|
parameters:
|
||||||
|
token:
|
||||||
|
$ref: "../swagger.yaml#/components/parameters/token"
|
||||||
|
schemas:
|
||||||
|
requestOne:
|
||||||
|
$ref: "../swagger.yaml#/components/schemas/requestOne"
|
||||||
|
responseOne:
|
||||||
|
$ref: "../swagger.yaml#/components/schemas/responseOne"
|
||||||
|
|
@ -12,8 +12,7 @@ info:
|
||||||
version: 0.1.0
|
version: 0.1.0
|
||||||
|
|
||||||
servers:
|
servers:
|
||||||
- url: http://api.dndex.lan:8080/
|
- url: http://api1.dndex.lan:8080/
|
||||||
- url: http://authapi.dndex.lan:8080/
|
|
||||||
|
|
||||||
paths:
|
paths:
|
||||||
/version:
|
/version:
|
||||||
|
|
@ -24,11 +23,22 @@ paths:
|
||||||
$ref: "./users/register.yaml#/paths"
|
$ref: "./users/register.yaml#/paths"
|
||||||
/users/login:
|
/users/login:
|
||||||
$ref: "./users/login.yaml#/paths"
|
$ref: "./users/login.yaml#/paths"
|
||||||
#/entities:
|
/entities:
|
||||||
# $ref: "./entities.yaml#/paths"
|
$ref: "./entities/index.yaml#/paths"
|
||||||
|
/entities/{id}:
|
||||||
|
$ref: "./entities/id.yaml#/paths"
|
||||||
|
/entities/{id}/{path}:
|
||||||
|
$ref: "./entities/idsub.yaml#/paths"
|
||||||
|
|
||||||
components:
|
components:
|
||||||
parameters:
|
parameters:
|
||||||
|
id:
|
||||||
|
name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
|
||||||
path:
|
path:
|
||||||
name: path
|
name: path
|
||||||
in: path
|
in: path
|
||||||
|
|
@ -44,9 +54,23 @@ components:
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
schemas:
|
schemas:
|
||||||
|
responseOneResolved:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/objectOneResolved"
|
||||||
|
|
||||||
|
responseOne:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/objectOne"
|
||||||
|
|
||||||
responseOK:
|
responseOK:
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
properties:
|
properties:
|
||||||
ok:
|
ok:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
|
@ -59,40 +83,53 @@ components:
|
||||||
type: string
|
type: string
|
||||||
example: http://imgur.com/big-tiddy-goth-gf.jpg
|
example: http://imgur.com/big-tiddy-goth-gf.jpg
|
||||||
|
|
||||||
objectID:
|
requestOne:
|
||||||
title: "one ID"
|
content:
|
||||||
type: string
|
application/json:
|
||||||
example: "abc-123-def-456"
|
schema:
|
||||||
|
$ref: "#/components/schemas/objectOne"
|
||||||
|
|
||||||
objectOne:
|
oneID: { type: string, example: "abc-123-def-456" }
|
||||||
title: "one entity"
|
oneName: { type: string, example: "Jeff Snow" }
|
||||||
type: object
|
oneType: { type: string, example: "Doggo" }
|
||||||
properties:
|
oneTitle: { type: string, example: "Meme Lord" }
|
||||||
_id:
|
oneText: { type: string, example: "Lorem ipsum" }
|
||||||
$ref: "/components/schemas/objectID"
|
oneModified: { type: int, example: 1234567890 }
|
||||||
name:
|
oneAttachments:
|
||||||
type: string
|
|
||||||
example: "Jeff Snow"
|
|
||||||
type:
|
|
||||||
type: string
|
|
||||||
example: "doggo"
|
|
||||||
title:
|
|
||||||
type: string
|
|
||||||
example: "Meme Lord"
|
|
||||||
text:
|
|
||||||
type: string
|
|
||||||
example: "Lorem ipsum"
|
|
||||||
modified:
|
|
||||||
type: int
|
|
||||||
example: 8675309
|
|
||||||
attachments:
|
|
||||||
type: object
|
type: object
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
location:
|
location:
|
||||||
type: string
|
type: string
|
||||||
example: "/files/my/file.txt"
|
example:
|
||||||
|
"abc-123-def-456":
|
||||||
|
location: "/__files__/my/file.txt"
|
||||||
|
|
||||||
|
objectOneResolved:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
_id: { $ref: "#/components/schemas/oneID" }
|
||||||
|
name: { $ref: "#/components/schemas/oneName" }
|
||||||
|
type: { $ref: "#/components/schemas/oneType" }
|
||||||
|
title: { $ref: "#/components/schemas/oneTitle" }
|
||||||
|
text: { $ref: "#/components/schemas/oneText" }
|
||||||
|
modified: { $ref: "#/components/schemas/oneModified" }
|
||||||
|
attachments: { $ref: "#/components/schemas/oneAttachments" }
|
||||||
|
connections:
|
||||||
|
type: object
|
||||||
|
additionalProperties: { $ref: "#/components/schemas/objectOne" }
|
||||||
|
|
||||||
|
objectOne:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
_id: { $ref: "#/components/schemas/oneID" }
|
||||||
|
name: { $ref: "#/components/schemas/oneName" }
|
||||||
|
type: { $ref: "#/components/schemas/oneType" }
|
||||||
|
title: { $ref: "#/components/schemas/oneTitle" }
|
||||||
|
text: { $ref: "#/components/schemas/oneText" }
|
||||||
|
modified: { $ref: "#/components/schemas/oneModified" }
|
||||||
|
attachments: { $ref: "#/components/schemas/oneAttachments" }
|
||||||
connections:
|
connections:
|
||||||
type: object
|
type: object
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
|
|
@ -100,7 +137,9 @@ components:
|
||||||
properties:
|
properties:
|
||||||
relationship:
|
relationship:
|
||||||
type: string
|
type: string
|
||||||
example: "friendly"
|
example:
|
||||||
|
"abc-123-def-456":
|
||||||
|
relationship: "friendly"
|
||||||
|
|
||||||
securitySchemes:
|
securitySchemes:
|
||||||
token:
|
token:
|
||||||
|
|
|
||||||
|
|
@ -13,3 +13,16 @@ paths:
|
||||||
DnDex-User:
|
DnDex-User:
|
||||||
type: string
|
type: string
|
||||||
example: "namespace"
|
example: "namespace"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
token:
|
||||||
|
type: string
|
||||||
|
example: abc-123
|
||||||
|
salt:
|
||||||
|
type: string
|
||||||
|
example: def-456
|
||||||
|
|
|
||||||
|
|
@ -15,3 +15,11 @@ paths:
|
||||||
DnDex-Auth:
|
DnDex-Auth:
|
||||||
type: string
|
type: string
|
||||||
example: "password"
|
example: "password"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
$ref: "#/components/schemas/responseOK"
|
||||||
|
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
responseOK:
|
||||||
|
$ref: "../swagger.yaml#/components/schemas/responseOK"
|
||||||
|
|
|
||||||
|
|
@ -13,3 +13,4 @@ paths:
|
||||||
version:
|
version:
|
||||||
type: string
|
type: string
|
||||||
example: "02c5d795cf631a33528234a9cf52907c6cd34834"
|
example: "02c5d795cf631a33528234a9cf52907c6cd34834"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue