Modified API Docs based on feedback

* Removed "Basic " from example
* Removed HTTPS from scheme
* Updated Info Object
* Fixed Ident

Signed-off-by: Simon Pelczer <templum.dev@gmail.com>
This commit is contained in:
Simon Pelczer
2018-08-07 18:50:33 +02:00
committed by Alex Ellis
parent 4963f39e87
commit 5143917782

View File

@ -1,22 +1,21 @@
swagger: '2.0' swagger: '2.0'
info: info:
description: OpenFaaS API documentation description: OpenFaaS API documentation
version: 0.8.2 version: 0.8.9
title: OpenFaaS API Gateway title: OpenFaaS API Gateway
license: license:
name: MIT name: MIT
basePath: / basePath: /
schemes: schemes:
- http - http
- https
paths: paths:
'/system/functions': '/system/functions':
get: get:
summary: 'Get a list of deployed functions with: stats and image digest' summary: 'Get a list of deployed functions with: stats and image digest'
consumes: consumes:
- application/json - application/json
produces: produces:
- application/json - application/json
responses: responses:
'200': '200':
description: List of deployed functions. description: List of deployed functions.
@ -28,16 +27,16 @@ paths:
summary: Deploy a new function. summary: Deploy a new function.
description: '' description: ''
consumes: consumes:
- application/json - application/json
produces: produces:
- application/json - application/json
parameters: parameters:
- in: body - in: body
name: body name: body
description: Function to deploy description: Function to deploy
required: true required: true
schema: schema:
$ref: '#/definitions/FunctionDefintion' $ref: '#/definitions/FunctionDefintion'
responses: responses:
'202': '202':
description: Accepted description: Accepted
@ -49,16 +48,16 @@ paths:
summary: Update a function. summary: Update a function.
description: '' description: ''
consumes: consumes:
- application/json - application/json
produces: produces:
- application/json - application/json
parameters: parameters:
- in: body - in: body
name: body name: body
description: Function to update description: Function to update
required: true required: true
schema: schema:
$ref: '#/definitions/FunctionDefintion' $ref: '#/definitions/FunctionDefintion'
responses: responses:
'200': '200':
description: Accepted description: Accepted
@ -72,16 +71,16 @@ paths:
summary: Remove a deployed function. summary: Remove a deployed function.
description: '' description: ''
consumes: consumes:
- application/json - application/json
produces: produces:
- application/json - application/json
parameters: parameters:
- in: body - in: body
name: body name: body
description: Function to delete description: Function to delete
required: true required: true
schema: schema:
$ref: '#/definitions/DeleteFunctionRequest' $ref: '#/definitions/DeleteFunctionRequest'
responses: responses:
'200': '200':
description: OK description: OK
@ -96,62 +95,62 @@ paths:
summary: 'Event-sink for AlertManager, for auto-scaling' summary: 'Event-sink for AlertManager, for auto-scaling'
description: 'Internal use for AlertManager, requires valid AlertManager alert JSON' description: 'Internal use for AlertManager, requires valid AlertManager alert JSON'
consumes: consumes:
- application/json - application/json
produces: produces:
- application/json - application/json
parameters: parameters:
- in: body - in: body
name: body name: body
description: Function to delete description: Function to delete
schema: schema:
type: object type: object
example: |- example: |-
{"receiver": "scale-up", {"receiver": "scale-up",
"status": "firing", "status": "firing",
"alerts": [{ "alerts": [{
"status": "firing", "status": "firing",
"labels": { "labels": {
"alertname": "APIHighInvocationRate", "alertname": "APIHighInvocationRate",
"code": "200", "code": "200",
"function_name": "func_nodeinfo", "function_name": "func_nodeinfo",
"instance": "gateway:8080", "instance": "gateway:8080",
"job": "gateway", "job": "gateway",
"monitor": "faas-monitor", "monitor": "faas-monitor",
"service": "gateway", "service": "gateway",
"severity": "major", "severity": "major",
"value": "8.998200359928017" "value": "8.998200359928017"
}, },
"annotations": { "annotations": {
"description": "High invocation total on gateway:8080", "description": "High invocation total on gateway:8080",
"summary": "High invocation total on gateway:8080" "summary": "High invocation total on gateway:8080"
}, },
"startsAt": "2017-03-15T15:52:57.805Z", "startsAt": "2017-03-15T15:52:57.805Z",
"endsAt": "0001-01-01T00:00:00Z", "endsAt": "0001-01-01T00:00:00Z",
"generatorURL": "http://4156cb797423:9090/graph?g0.expr=rate%28gateway_function_invocation_total%5B10s%5D%29+%3E+5\u0026g0.tab=0" "generatorURL": "http://4156cb797423:9090/graph?g0.expr=rate%28gateway_function_invocation_total%5B10s%5D%29+%3E+5\u0026g0.tab=0"
}], }],
"groupLabels": { "groupLabels": {
"alertname": "APIHighInvocationRate", "alertname": "APIHighInvocationRate",
"service": "gateway" "service": "gateway"
}, },
"commonLabels": { "commonLabels": {
"alertname": "APIHighInvocationRate", "alertname": "APIHighInvocationRate",
"code": "200", "code": "200",
"function_name": "func_nodeinfo", "function_name": "func_nodeinfo",
"instance": "gateway:8080", "instance": "gateway:8080",
"job": "gateway", "job": "gateway",
"monitor": "faas-monitor", "monitor": "faas-monitor",
"service": "gateway", "service": "gateway",
"severity": "major", "severity": "major",
"value": "8.998200359928017" "value": "8.998200359928017"
}, },
"commonAnnotations": { "commonAnnotations": {
"description": "High invocation total on gateway:8080", "description": "High invocation total on gateway:8080",
"summary": "High invocation total on gateway:8080" "summary": "High invocation total on gateway:8080"
}, },
"externalURL": "http://f054879d97db:9093", "externalURL": "http://f054879d97db:9093",
"version": "3", "version": "3",
"groupKey": 18195285354214864953 "groupKey": 18195285354214864953
} }
responses: responses:
'200': '200':
description: Alert handled successfully description: Alert handled successfully
@ -163,20 +162,20 @@ paths:
description: >- description: >-
See https://github.com/openfaas/faas/blob/master/guide/asynchronous.md. See https://github.com/openfaas/faas/blob/master/guide/asynchronous.md.
parameters: parameters:
- in: path - in: path
name: functionName name: functionName
description: Function name description: Function name
type: string
required: true
- in: body
name: input
description: (Optional) data to pass to function
schema:
type: string type: string
required: true format: binary
- in: body example:
name: input '{"hello": "world"}'
description: (Optional) data to pass to function required: false
schema:
type: string
format: binary
example:
'{"hello": "world"}'
required: false
responses: responses:
'202': '202':
description: Request accepted and queued description: Request accepted and queued
@ -188,20 +187,20 @@ paths:
post: post:
summary: Invoke a function defined in OpenFaaS summary: Invoke a function defined in OpenFaaS
parameters: parameters:
- in: path - in: path
name: functionName name: functionName
description: Function name description: Function name
type: string
required: true
- in: body
name: input
description: (Optional) data to pass to function
schema:
type: string type: string
required: true format: binary
- in: body example:
name: input '{"hello": "world"}'
description: (Optional) data to pass to function required: false
schema:
type: string
format: binary
example:
'{"hello": "world"}'
required: false
responses: responses:
'200': '200':
description: Value returned from function description: Value returned from function
@ -213,20 +212,20 @@ paths:
get: get:
summary: Scale a function summary: Scale a function
parameters: parameters:
- in: path - in: path
name: functionName name: functionName
description: Function name description: Function name
type: string
required: true
- in: body
name: input
description: Function to scale plus replica count
schema:
type: string type: string
required: true format: binary
- in: body example:
name: input '{"service": "hello-world", "replicas": 10}'
description: Function to scale plus replica count required: false
schema:
type: string
format: binary
example:
'{"service": "hello-world", "replicas": 10}'
required: false
responses: responses:
'200': '200':
description: Scaling OK description: Scaling OK
@ -240,11 +239,11 @@ paths:
get: get:
summary: Get a summary of an OpenFaaS function summary: Get a summary of an OpenFaaS function
parameters: parameters:
- in: path - in: path
name: functionName name: functionName
description: Function name description: Function name
type: string type: string
required: true required: true
responses: responses:
'200': '200':
description: Function Summary description: Function Summary
@ -258,7 +257,7 @@ paths:
get: get:
summary: Get info such as provider version number and provider orchestrator summary: Get info such as provider version number and provider orchestrator
produces: produces:
- application/json - application/json
responses: responses:
'200': '200':
description: Info result description: Info result
@ -284,27 +283,46 @@ definitions:
type: object type: object
properties: properties:
provider: provider:
type: string type: object
description: The OpenFaaS Provider description: The OpenFaaS Provider
example: faas-swarm properties:
provider:
type: string
example: faas-swarm
orchestration:
type: string
example: swarm
version:
type: object
description: Version of the OpenFaaS Provider
properties:
commit_message:
type: string
example: Sample Message
sha:
type: string
example: 7108418d9dd6b329ddff40e7393b3166f8160a88
release:
type: string
format: semver
example: 0.2.6
version: version:
type: object type: object
description: Version of the OpenFaaS Provider description: Version of the Gateway
properties: properties:
commit_message:
type: string
example: Sample Message
sha: sha:
type: string type: string
example: 7108418d9dd6b329ddff40e7393b3166f8160a88 example: 7108418d9dd6b329ddff40e7393b3166f8160a88
release: release:
type: string type: string
format: semver format: semver
example: 0.2.6 example: 0.8.9
orchestration:
type: string
example: swarm
required: required:
- provider - provider
- version - version
- orchestration
DeleteFunctionRequest: DeleteFunctionRequest:
type: object type: object
properties: properties:
@ -313,7 +331,7 @@ definitions:
description: Name of deployed function description: Name of deployed function
example: nodeinfo example: nodeinfo
required: required:
- functionName - functionName
FunctionDefintion: FunctionDefintion:
type: object type: object
properties: properties:
@ -345,15 +363,15 @@ definitions:
description: Constraints are specific to OpenFaaS Provider description: Constraints are specific to OpenFaaS Provider
example: "node.platform.os == linux" example: "node.platform.os == linux"
labels: labels:
type: string
items:
type: array
description: An array of labels used by the back-end for making scheduling or routing decisions description: An array of labels used by the back-end for making scheduling or routing decisions
annotations:
type: string
description: An array of annotations used by the back-end for management, orchestration, events and build tasks
items:
type: array type: array
items:
type: string
annotations:
description: An array of annotations used by the back-end for management, orchestration, events and build tasks
type: array
items:
type: string
secrets: secrets:
type: array type: array
items: items:
@ -365,7 +383,7 @@ definitions:
description: >- description: >-
Private registry base64-encoded basic auth (as present in Private registry base64-encoded basic auth (as present in
~/.docker/config.json) ~/.docker/config.json)
example: Basic dXNlcjpwYXNzd29yZA== example: dXNlcjpwYXNzd29yZA==
limits: limits:
type: object type: object
properties: properties:
@ -385,9 +403,9 @@ definitions:
type: string type: string
example: "0.01" example: "0.01"
required: required:
- service - service
- image - image
- envProcess - envProcess
FunctionListEntry: FunctionListEntry:
type: object type: object
properties: properties:
@ -423,13 +441,13 @@ definitions:
additionalProperties: additionalProperties:
type: string type: string
required: required:
- name - name
- image - image
- invocationCount - invocationCount
- replicas - replicas
- availableReplicas - availableReplicas
- envProcess - envProcess
- labels - labels
externalDocs: externalDocs:
description: More documentation available on Github description: More documentation available on Github
url: 'https://github.com/openfaas/faas' url: 'https://github.com/openfaas/faas'