Skip to content

Commit

Permalink
add swagger api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zekroTJA committed Jan 19, 2022
1 parent 5ab8615 commit 0a6ab6a
Show file tree
Hide file tree
Showing 6 changed files with 491 additions and 0 deletions.
118 changes: 118 additions & 0 deletions docs/api/restapi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# ranna main API
The ranna main REST API.

## Version: 1.0

### /exec

#### POST
##### Summary

Get Spec Map

##### Description

Returns the available spec map.

##### Parameters

| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ---- |
| payload | body | The execution payload | Yes | [models.ExecutionRequest](#modelsexecutionrequest) |

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | OK | [models.ExecutionResponse](#modelsexecutionresponse) |
| 400 | Bad Request | [models.ErrorModel](#modelserrormodel) |
| 500 | Internal Server Error | [models.ErrorModel](#modelserrormodel) |

### /info

#### GET
##### Summary

Get System Info

##### Description

Returns general system and version information.

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | OK | [models.ExecutionResponse](#modelsexecutionresponse) |
| 500 | Internal Server Error | [models.ErrorModel](#modelserrormodel) |

### /spec

#### GET
##### Summary

Get Spec Map

##### Description

Returns the available spec map.

##### Responses

| Code | Description | Schema |
| ---- | ----------- | ------ |
| 200 | OK | [models.SpecMap](#modelsspecmap) |

### Models

#### models.ErrorModel

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| code | integer | | No |
| context | string | | No |
| error | string | | No |

#### models.ExecutionRequest

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| arguments | [ string ] | | No |
| code | string | | No |
| environment | object | | No |
| inline_expression | boolean | | No |
| language | string | | No |

#### models.ExecutionResponse

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| exectimems | integer | | No |
| stderr | string | | No |
| stdout | string | | No |

#### models.InlineSpec

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| import_regex | string | | No |
| template | string | | No |

#### models.Spec

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| cmd | string | | No |
| entrypoint | string | | No |
| example | string | | No |
| filename | string | | No |
| image | string | | No |
| inline | [models.InlineSpec](#modelsinlinespec) | | No |
| registry | string | | No |
| use | string | | No |

#### models.SpecMap

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| models.SpecMap | object | | |
197 changes: 197 additions & 0 deletions docs/api/swagger.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
{
"swagger": "2.0",
"info": {
"description": "The ranna main REST API.",
"title": "ranna main API",
"contact": {},
"version": "1.0"
},
"basePath": "/v1",
"paths": {
"/exec": {
"post": {
"description": "Returns the available spec map.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "Get Spec Map",
"parameters": [
{
"description": "The execution payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.ExecutionRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.ExecutionResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/models.ErrorModel"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/models.ErrorModel"
}
}
}
}
},
"/info": {
"get": {
"description": "Returns general system and version information.",
"produces": [
"application/json"
],
"summary": "Get System Info",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.ExecutionResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/models.ErrorModel"
}
}
}
}
},
"/spec": {
"get": {
"description": "Returns the available spec map.",
"produces": [
"application/json"
],
"summary": "Get Spec Map",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.SpecMap"
}
}
}
}
}
},
"definitions": {
"models.ErrorModel": {
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"context": {
"type": "string"
},
"error": {
"type": "string"
}
}
},
"models.ExecutionRequest": {
"type": "object",
"properties": {
"arguments": {
"type": "array",
"items": {
"type": "string"
}
},
"code": {
"type": "string"
},
"environment": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"inline_expression": {
"type": "boolean"
},
"language": {
"type": "string"
}
}
},
"models.ExecutionResponse": {
"type": "object",
"properties": {
"exectimems": {
"type": "integer"
},
"stderr": {
"type": "string"
},
"stdout": {
"type": "string"
}
}
},
"models.InlineSpec": {
"type": "object",
"properties": {
"import_regex": {
"type": "string"
},
"template": {
"type": "string"
}
}
},
"models.Spec": {
"type": "object",
"properties": {
"cmd": {
"type": "string"
},
"entrypoint": {
"type": "string"
},
"example": {
"type": "string"
},
"filename": {
"type": "string"
},
"image": {
"type": "string"
},
"inline": {
"$ref": "#/definitions/models.InlineSpec"
},
"registry": {
"type": "string"
},
"use": {
"type": "string"
}
}
},
"models.SpecMap": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/models.Spec"
}
}
}
}
Loading

0 comments on commit 0a6ab6a

Please sign in to comment.