Skip to content

Instantly share code, notes, and snippets.

@loudej
Created October 1, 2021 06:29
Show Gist options
  • Save loudej/17aa1add602f890e8d8f44688bae7a02 to your computer and use it in GitHub Desktop.
Save loudej/17aa1add602f890e8d8f44688bae7a02 to your computer and use it in GitHub Desktop.
example.json
{
"schemes": [],
"swagger": "2.0",
"info": {
"description": "# Overall api docs\n\nCan be used to do things.\n\n",
"title": "Swagger Example API",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0"
},
"host": "localhost:7878",
"basePath": "/",
"paths": {
"/api/changes/": {
"get": {
"description": "list changes",
"produces": [
"application/json"
],
"tags": [
"changes"
],
"summary": "list changes",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.ChangeAction"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.HTTPError"
}
}
}
}
},
"/api/changes/{changeName}": {
"post": {
"description": "review changes",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"changes"
],
"summary": "review changes",
"parameters": [
{
"type": "string",
"description": "Change Name",
"name": "changeName",
"in": "path",
"required": true
},
{
"description": "Change Info",
"name": "message",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/main.ChangeAction"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.ChangeAction"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.HTTPError"
}
}
}
}
},
"/api/functions/{image}": {
"post": {
"description": "eval functions",
"consumes": [
"text/vnd.yaml"
],
"produces": [
"text/vnd.yaml"
],
"tags": [
"functions"
],
"summary": "eval functions",
"parameters": [
{
"type": "string",
"description": "Kpt Function Image",
"name": "image",
"in": "path",
"required": true
},
{
"description": "resource list",
"name": "message",
"in": "body",
"required": true,
"schema": {
"type": "array",
"items": {
"type": "integer"
}
}
}
],
"responses": {
"200": {
"description": "resource list",
"schema": {
"$ref": "#/definitions/main.ResourceList"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.HTTPError"
}
}
}
}
},
"/api/instances/": {
"get": {
"description": "\nThis API will return a list of instances.\n\n* fast\n* efficient\n\n",
"produces": [
"application/json"
],
"tags": [
"instances"
],
"summary": "list instances",
"parameters": [
{
"type": "string",
"description": "Workspace",
"name": "workspace",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/main.Instance"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.HTTPError"
}
}
},
"x-codeSamples": {
"lang": "JavaScript",
"source": "console.log('Hello World');"
}
},
"post": {
"description": "create instance",
"consumes": [
"text/vnd.yaml"
],
"produces": [
"application/json"
],
"tags": [
"instances"
],
"summary": "create instance",
"parameters": [
{
"type": "string",
"description": "Workspace",
"name": "workspace",
"in": "query"
},
{
"description": "Instance",
"name": "message",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/main.Instance"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.Instance"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.HTTPError"
}
}
}
}
},
"/api/instances/validate": {
"post": {
"description": "validate instance",
"consumes": [
"text/vnd.yaml"
],
"produces": [
"application/json"
],
"tags": [
"instances"
],
"summary": "validate instance",
"parameters": [
{
"type": "string",
"description": "Workspace",
"name": "workspace",
"in": "query"
},
{
"description": "Instance",
"name": "message",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/main.ResourceList"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.ValidationResult"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/main.HTTPError"
}
}
}
}
},
"/api/instances/{id}": {
"get": {
"description": "get instance",
"produces": [
"text/vnd.yaml"
],
"tags": [
"instances"
],
"summary": "get instance",
"parameters": [
{
"type": "string",
"description": "Instance ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Workspace",
"name": "workspace",
"in": "query"
}
],
"responses": {
"200": {
"description": "Package ResourceList",
"schema": {
"$ref": "#/definitions/main.ResourceList"
}
},
"404": {
"description": "Instance not found",
"schema": {
"$ref": "#/definitions/main.HTTPError"
}
},
"500": {
"description": "Error getting instance",
"schema": {
"$ref": "#/definitions/main.HTTPError"
}
}
}
},
"put": {
"description": "sink instance",
"consumes": [
"text/vnd.yaml"
],
"produces": [
"application/json"
],
"tags": [
"instances"
],
"summary": "sink instance",
"parameters": [
{
"type": "string",
"description": "Instance ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Workspace",
"name": "workspace",
"in": "query"
},
{
"description": "Instance",
"name": "message",
"in": "body",
"required": true,
"schema": {
"type": "array",
"items": {
"type": "integer"
}
}
}
],
"responses": {
"200": {
"description": "Instance Stored",
"schema": {
"$ref": "#/definitions/main.SinkResult"
}
},
"500": {
"description": "Error sinking instance",
"schema": {
"$ref": "#/definitions/main.HTTPError"
}
}
}
}
},
"/api/workspaces/{type}": {
"get": {
"description": "list workspaces",
"produces": [
"application/json"
],
"tags": [
"workspaces"
],
"summary": "list workspaces",
"parameters": [
{
"type": "string",
"description": "Workspace Type",
"name": "type",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/kptstore.WorkspaceInfo"
}
}
},
"404": {
"description": "Unknown type",
"schema": {
"$ref": "#/definitions/main.HTTPError"
}
},
"500": {
"description": "Error listing workspaces",
"schema": {
"$ref": "#/definitions/main.HTTPError"
}
}
}
}
},
"/api/workspaces/{type}/{workspace}": {
"post": {
"description": "create change list",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"workspaces"
],
"summary": "create change list",
"parameters": [
{
"type": "string",
"description": "Workspace Type",
"name": "type",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Workspace",
"name": "workspace",
"in": "path",
"required": true
},
{
"description": "Pull Request Options",
"name": "message",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/main.PullRequestOptions"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/kptstore.PullRequestInfo"
}
}
},
"404": {
"description": "Unknown type",
"schema": {
"$ref": "#/definitions/main.HTTPError"
}
},
"500": {
"description": "Error sending changelist",
"schema": {
"$ref": "#/definitions/main.HTTPError"
}
}
}
}
}
},
"definitions": {
"kptstore.PullRequestInfo": {
"type": "object"
},
"kptstore.WorkspaceInfo": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
},
"main.ChangeAction": {
"type": "object",
"properties": {
"action": {
"type": "string"
},
"message": {
"type": "string"
}
}
},
"main.HTTPError": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"meta": {}
}
},
"main.Instance": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"name": {
"description": "Namespace string `json:\"namespace,omitempty\"`",
"type": "string"
},
"onMainBranch": {
"type": "boolean"
},
"package": {
"type": "string"
},
"title": {
"type": "string"
},
"workspaces": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"main.PullRequestOptions": {
"type": "object",
"properties": {
"body": {
"type": "string"
},
"title": {
"type": "string"
}
}
},
"main.ResourceList": {
"type": "object"
},
"main.SinkResult": {
"type": "object",
"properties": {
"errors": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"main.ValidationResult": {
"type": "object",
"properties": {
"errors": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"tags": [
{
"description": "# Changes\n\nThis is my favorite API.\n",
"name": "changes"
},
{
"description": "\nThis API will return a list of instances.\n\n* fast\n* efficient\n\n",
"name": "instances"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment