Consolidate the API docs into a single spec file for ease of testing
This commit is contained in:
parent
81451f888c
commit
72935aef37
|
@ -1,33 +0,0 @@
|
|||
---
|
||||
openapi: "3.0.0"
|
||||
info:
|
||||
description: |
|
||||
Janky Server API defintion
|
||||
version: "1.0.0"
|
||||
title: Janky APIs
|
||||
contact:
|
||||
email: "rtyler+janky@brokenco.de"
|
||||
license:
|
||||
name: "AGPL v3.0"
|
||||
url: "https://www.gnu.org/licenses/agpl-3.0.en.html"
|
||||
servers:
|
||||
- url: 'http://localhost:8000/api/v1'
|
||||
description: Local dev server (APIv1)
|
||||
|
||||
paths:
|
||||
'/projects/{name}':
|
||||
post:
|
||||
summary: 'Trigger execution for this project'
|
||||
description:
|
||||
parameters:
|
||||
- in: path
|
||||
name: name
|
||||
required: true
|
||||
example: 'janky'
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
404:
|
||||
summary: 'No project configured by that name'
|
||||
200:
|
||||
summary: 'Execution has been triggered'
|
|
@ -2,7 +2,7 @@
|
|||
openapi: "3.0.0"
|
||||
info:
|
||||
description: |
|
||||
Janky Agent API defintion
|
||||
Janky API defintion
|
||||
version: "1.0.0"
|
||||
title: Janky APIs
|
||||
contact:
|
||||
|
@ -11,12 +11,42 @@ info:
|
|||
name: "AGPL v3.0"
|
||||
url: "https://www.gnu.org/licenses/agpl-3.0.en.html"
|
||||
servers:
|
||||
- url: 'http://localhost:9000/api/v1'
|
||||
description: Local dev agent (APIv1)
|
||||
- url: 'http://localhost:8000'
|
||||
description: Local dev server
|
||||
- url: 'http://localhost:9000'
|
||||
description: Local dev agent
|
||||
|
||||
tags:
|
||||
- name: 'agent'
|
||||
description: 'Agent APIs'
|
||||
- name: 'server'
|
||||
description: 'Server APIs'
|
||||
|
||||
paths:
|
||||
/capabilities:
|
||||
'/api/v1/projects/{name}':
|
||||
post:
|
||||
tags:
|
||||
- 'server'
|
||||
summary: 'Trigger execution for this project'
|
||||
description:
|
||||
parameters:
|
||||
- in: path
|
||||
name: name
|
||||
required: true
|
||||
example: 'janky'
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
404:
|
||||
summary: 'No project configured by that name'
|
||||
200:
|
||||
summary: 'Execution has been triggered'
|
||||
|
||||
|
||||
'/api/v1/capabilities':
|
||||
get:
|
||||
tags:
|
||||
- 'agent'
|
||||
summary: "Retrieve a list of capabilities of this agent"
|
||||
description:
|
||||
responses:
|
||||
|
@ -26,8 +56,10 @@ paths:
|
|||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CapsResponse'
|
||||
/execute:
|
||||
'/api/v1/execute':
|
||||
put:
|
||||
tags:
|
||||
- 'agent'
|
||||
summary: "Execute a series of commands on this agent"
|
||||
description:
|
||||
requestBody:
|
|
@ -1 +1 @@
|
|||
{"openapi":"3.0.0","info":{"description":"Janky Agent API defintion\n","version":"1.0.0","title":"Janky APIs","contact":{"email":"rtyler+janky@brokenco.de"},"license":{"name":"AGPL v3.0","url":"https://www.gnu.org/licenses/agpl-3.0.en.html"}},"servers":[{"url":"http://localhost:9000/api/v1","description":"Local dev agent (APIv1)"}],"paths":{"/capabilities":{"get":{"summary":"Retrieve a list of capabilities of this agent","description":null,"responses":{"200":{"description":"Getting capabilities","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CapsResponse"}}}}}}},"/execute":{"put":{"summary":"Execute a series of commands on this agent","description":null,"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommandRequest"},"example":{"commands":[{"script":"echo \"Hi\""}]}}}},"responses":{"201":{"description":"Successfully accepted the commands for execution","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommandResponse"}}}},"409":{"description":"Returned when the agent is busy with another series of commands"}}}}},"components":{"schemas":{"CapsResponse":{"type":"object","properties":{"caps":{"type":"array","items":{"$ref":"#/components/schemas/Capability"}}}},"Capability":{"type":"object","properties":{"name":{"type":"string"},"path":{"type":"string"},"data":{"type":"object"}}},"Command":{"type":"object","properties":{"script":{"type":"string","description":"A script that can be exec()'d on the agent"}}},"CommandRequest":{"type":"object","properties":{"commands":{"type":"array","items":{"$ref":"#/components/schemas/Command"}}}},"CommandResponse":{"type":"object","properties":{"uuid":{"type":"string","format":"uuid"},"stream":{"description":"URL to streaming WebSockets logs","type":"string","format":"url"},"task":{"description":"URL to the task metadata","type":"string","format":"url"},"log":{"description":"URL to the raw log of the task run","type":"string","format":"url"}}}}}}
|
||||
{"openapi":"3.0.0","info":{"description":"Janky API defintion\n","version":"1.0.0","title":"Janky APIs","contact":{"email":"rtyler+janky@brokenco.de"},"license":{"name":"AGPL v3.0","url":"https://www.gnu.org/licenses/agpl-3.0.en.html"}},"servers":[{"url":"http://localhost:8000","description":"Local dev server"},{"url":"http://localhost:9000","description":"Local dev agent"}],"tags":[{"name":"agent","description":"Agent APIs"},{"name":"server","description":"Server APIs"}],"paths":{"/api/v1/projects/{name}":{"post":{"tags":["server"],"summary":"Trigger execution for this project","description":null,"parameters":[{"in":"path","name":"name","required":true,"example":"janky","schema":{"type":"string"}}],"responses":{"404":{"summary":"No project configured by that name"},"200":{"summary":"Execution has been triggered"}}}},"/api/v1/capabilities":{"get":{"tags":["agent"],"summary":"Retrieve a list of capabilities of this agent","description":null,"responses":{"200":{"description":"Getting capabilities","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CapsResponse"}}}}}}},"/api/v1/execute":{"put":{"tags":["agent"],"summary":"Execute a series of commands on this agent","description":null,"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommandRequest"},"example":{"commands":[{"script":"echo \"Hi\""}]}}}},"responses":{"201":{"description":"Successfully accepted the commands for execution","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommandResponse"}}}},"409":{"description":"Returned when the agent is busy with another series of commands"}}}}},"components":{"schemas":{"CapsResponse":{"type":"object","properties":{"caps":{"type":"array","items":{"$ref":"#/components/schemas/Capability"}}}},"Capability":{"type":"object","properties":{"name":{"type":"string"},"path":{"type":"string"},"data":{"type":"object"}}},"Command":{"type":"object","properties":{"script":{"type":"string","description":"A script that can be exec()'d on the agent"}}},"CommandRequest":{"type":"object","properties":{"commands":{"type":"array","items":{"$ref":"#/components/schemas/Command"}}}},"CommandResponse":{"type":"object","properties":{"uuid":{"type":"string","format":"uuid"},"stream":{"description":"URL to streaming WebSockets logs","type":"string","format":"url"},"task":{"description":"URL to the task metadata","type":"string","format":"url"},"log":{"description":"URL to the raw log of the task run","type":"string","format":"url"}}}}}}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
exec ruby -ryaml -rjson -e 'puts JSON.dump(YAML.load(STDIN.read))' < api-description-agent.yml > apidocs/api-description.json
|
||||
exec ruby -ryaml -rjson -e 'puts JSON.dump(YAML.load(STDIN.read))' < api-description.yml > apidocs/api-description.json
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
exec ruby -ryaml -rjson -e 'puts JSON.dump(YAML.load(STDIN.read))' < api-description-server.yml > apidocs/api-description.json
|
Loading…
Reference in New Issue