Skip to content

Instantly share code, notes, and snippets.

@jer
Created July 21, 2016 04:17
Show Gist options
  • Save jer/99462dc36c1bb2c6ef58b5b69c694778 to your computer and use it in GitHub Desktop.
Save jer/99462dc36c1bb2c6ef58b5b69c694778 to your computer and use it in GitHub Desktop.
Example with bad required fields
{
"paths" : {
"/v3/platforms/{id}" : {
"get" : {
"parameters" : [
{
"required" : true,
"description" : "Identifier of this platform",
"in" : "path",
"name" : "id",
"type" : "string",
"example" : "334b3152916f7cbc59579f7a18744450d5a5a907",
"x-constraint" : {
"length" : 40
},
"x-format" : {
"hex" : true
}
}
],
"summary" : "Get a single platform",
"operationId" : "getV3PlatformsId",
"description" : "Returns a platform record",
"responses" : {
"200" : {
"schema" : {
"$ref" : "#/definitions/Model 8",
"title" : "Get Platform"
},
"description" : "Successful"
}
},
"tags" : [
"v3"
]
},
"put" : {
"responses" : {
"default" : {
"description" : "Successful",
"schema" : {
"type" : "string"
}
}
},
"description" : "Update a specific platform",
"summary" : "Update a platform",
"operationId" : "putV3PlatformsId",
"tags" : [
"v3"
],
"parameters" : [
{
"name" : "id",
"in" : "path",
"required" : true,
"description" : "Identifier of this platform",
"x-format" : {
"hex" : true
},
"x-constraint" : {
"length" : 40
},
"example" : "334b3152916f7cbc59579f7a18744450d5a5a907",
"type" : "string"
},
{
"name" : "body",
"schema" : {
"$ref" : "#/definitions/Update Platform"
},
"in" : "body"
}
]
}
},
"/v3/platforms" : {
"get" : {
"parameters" : [
{
"name" : "page",
"in" : "query",
"minimum" : 1,
"default" : 1,
"type" : "integer",
"description" : "Page to paginate"
},
{
"maximum" : 50,
"minimum" : 1,
"default" : 50,
"in" : "query",
"name" : "count",
"type" : "integer",
"description" : "Count to paginate"
}
],
"tags" : [
"v3"
],
"responses" : {
"200" : {
"schema" : {
"$ref" : "#/definitions/Model 4",
"title" : null
},
"description" : "Successful"
}
},
"description" : "Returns all platform records with pagination",
"operationId" : "getV3Platforms",
"summary" : "Get platforms with pagination"
},
"post" : {
"tags" : [
"v3"
],
"operationId" : "postV3Platforms",
"summary" : "Create a platform",
"responses" : {
"default" : {
"schema" : {
"type" : "string"
},
"description" : "Successful"
}
},
"description" : "Create a specific platform",
"parameters" : [
{
"schema" : {
"$ref" : "#/definitions/Create Platform"
},
"in" : "body",
"name" : "body"
}
]
}
},
"/v3/pipelines" : {
"post" : {
"operationId" : "postV3Pipelines",
"summary" : "Create a new pipeline",
"responses" : {
"default" : {
"description" : "Successful",
"schema" : {
"type" : "string"
}
}
},
"description" : "Create a specific pipeline",
"tags" : [
"v3"
],
"parameters" : [
{
"in" : "body",
"schema" : {
"$ref" : "#/definitions/Create Pipeline"
},
"name" : "body"
}
]
},
"get" : {
"tags" : [
"v3"
],
"description" : "Returns all pipeline records",
"responses" : {
"200" : {
"description" : "Successful",
"schema" : {
"title" : null,
"$ref" : "#/definitions/Model 3"
}
}
},
"operationId" : "getV3Pipelines",
"summary" : "Get pipelines with pagination",
"parameters" : [
{
"default" : 1,
"minimum" : 1,
"name" : "page",
"in" : "query",
"description" : "Page to paginate",
"type" : "integer"
},
{
"in" : "query",
"name" : "count",
"default" : 50,
"maximum" : 50,
"minimum" : 1,
"description" : "Count to paginate",
"type" : "integer"
}
]
}
},
"/v3/login" : {
"post" : {
"summary" : "Login route",
"operationId" : "postV3Login",
"responses" : {
"default" : {
"description" : "Successful",
"schema" : {
"type" : "string"
}
}
},
"description" : "Authenticate user with github oauth provider",
"tags" : [
"v3"
]
},
"get" : {
"description" : "Authenticate user with github oauth provider",
"responses" : {
"default" : {
"description" : "Successful",
"schema" : {
"type" : "string"
}
}
},
"summary" : "Login route",
"operationId" : "getV3Login",
"tags" : [
"v3"
]
}
},
"/v3/status" : {
"get" : {
"tags" : [
"v3"
],
"summary" : "API status",
"operationId" : "getV3Status",
"responses" : {
"default" : {
"schema" : {
"type" : "string"
},
"description" : "Successful"
}
},
"description" : "Should respond with 200: ok"
}
},
"/v3/builds" : {
"post" : {
"tags" : [
"v3"
],
"responses" : {
"default" : {
"schema" : {
"type" : "string"
},
"description" : "Successful"
}
},
"description" : "Save a specific build",
"operationId" : "postV3Builds",
"summary" : "Save a build",
"parameters" : [
{
"in" : "body",
"schema" : {
"$ref" : "#/definitions/Create Build"
},
"name" : "body"
}
]
},
"get" : {
"tags" : [
"v3"
],
"responses" : {
"200" : {
"description" : "Successful",
"schema" : {
"title" : null,
"$ref" : "#/definitions/Model 1"
}
}
},
"description" : "Returns all build records",
"operationId" : "getV3Builds",
"summary" : "Get builds with pagination",
"parameters" : [
{
"default" : 1,
"minimum" : 1,
"name" : "page",
"in" : "query",
"description" : "Page to paginate",
"type" : "integer"
},
{
"name" : "count",
"in" : "query",
"maximum" : 50,
"default" : 50,
"minimum" : 1,
"description" : "Count to paginate",
"type" : "integer"
}
]
}
},
"/v3/builds/{id}" : {
"get" : {
"tags" : [
"v3"
],
"operationId" : "getV3BuildsId",
"summary" : "Get a single build",
"description" : "Returns a build record",
"responses" : {
"200" : {
"schema" : {
"title" : "Get Build",
"$ref" : "#/definitions/Model 5"
},
"description" : "Successful"
}
},
"parameters" : [
{
"required" : true,
"description" : "Identifier of this Build",
"name" : "id",
"in" : "path",
"type" : "string",
"example" : "4b8d9b530d2e5e297b4f470d5b0a6e1310d29c5e",
"x-constraint" : {
"length" : 40
},
"x-format" : {
"hex" : true
}
}
]
},
"put" : {
"responses" : {
"default" : {
"schema" : {
"type" : "string"
},
"description" : "Successful"
}
},
"description" : "Save a specific build",
"summary" : "Save a build",
"operationId" : "putV3BuildsId",
"tags" : [
"v3"
],
"parameters" : [
{
"description" : "Identifier of this Job",
"required" : true,
"in" : "path",
"name" : "id",
"example" : "50dc14f719cdc2c9cb1fb0e49dd2acc4cf6189a0",
"type" : "string",
"x-format" : {
"hex" : true
},
"x-constraint" : {
"length" : 40
}
},
{
"name" : "body",
"schema" : {
"$ref" : "#/definitions/Update Build"
},
"in" : "body"
}
]
}
},
"/v3/builds/{id}/logs" : {
"get" : {
"parameters" : [
{
"name" : "id",
"in" : "path",
"description" : "Identifier of this Build",
"required" : true,
"x-format" : {
"hex" : true
},
"x-constraint" : {
"length" : 40
},
"example" : "4b8d9b530d2e5e297b4f470d5b0a6e1310d29c5e",
"type" : "string"
}
],
"tags" : [
"v3"
],
"description" : "Streams logs",
"responses" : {
"default" : {
"schema" : {
"type" : "string"
},
"description" : "Successful"
}
},
"summary" : "Get logs for a build",
"operationId" : "getV3BuildsIdLogs"
}
},
"/v3/jobs/{id}" : {
"put" : {
"tags" : [
"v3"
],
"responses" : {
"default" : {
"schema" : {
"type" : "string"
},
"description" : "Successful"
}
},
"description" : "Update a specific job",
"summary" : "Update a job",
"operationId" : "putV3JobsId",
"parameters" : [
{
"in" : "path",
"name" : "id",
"required" : true,
"description" : "Identifier of this Job",
"x-constraint" : {
"length" : 40
},
"x-format" : {
"hex" : true
},
"type" : "string",
"example" : "50dc14f719cdc2c9cb1fb0e49dd2acc4cf6189a0"
},
{
"schema" : {
"$ref" : "#/definitions/Update Job"
},
"in" : "body",
"name" : "body"
}
]
},
"get" : {
"parameters" : [
{
"x-format" : {
"hex" : true
},
"x-constraint" : {
"length" : 40
},
"example" : "50dc14f719cdc2c9cb1fb0e49dd2acc4cf6189a0",
"type" : "string",
"name" : "id",
"in" : "path",
"description" : "Identifier of this Job",
"required" : true
}
],
"tags" : [
"v3"
],
"operationId" : "getV3JobsId",
"summary" : "Get a single job",
"responses" : {
"200" : {
"schema" : {
"title" : "Get Job",
"$ref" : "#/definitions/Model 6"
},
"description" : "Successful"
}
},
"description" : "Returns a job record"
}
},
"/v3/jobs" : {
"get" : {
"parameters" : [
{
"type" : "integer",
"description" : "Page to paginate",
"default" : 1,
"minimum" : 1,
"in" : "query",
"name" : "page"
},
{
"in" : "query",
"name" : "count",
"default" : 50,
"maximum" : 50,
"minimum" : 1,
"type" : "integer",
"description" : "Count to paginate"
}
],
"responses" : {
"200" : {
"schema" : {
"title" : null,
"$ref" : "#/definitions/Model 2"
},
"description" : "Successful"
}
},
"description" : "Returns all jobs records",
"operationId" : "getV3Jobs",
"summary" : "Get jobs with pagination",
"tags" : [
"v3"
]
}
},
"/v3/logout" : {
"post" : {
"summary" : "Logout route",
"operationId" : "postV3Logout",
"description" : "Clears the cookie used for authentication",
"responses" : {
"default" : {
"schema" : {
"type" : "string"
},
"description" : "Successful"
}
},
"tags" : [
"v3"
]
}
},
"/v3/pipelines/{id}" : {
"put" : {
"parameters" : [
{
"description" : "Identifier of this Pipeline",
"required" : true,
"in" : "path",
"name" : "id",
"type" : "string",
"example" : "2d991790bab1ac8576097ca87f170df73410b55c",
"x-constraint" : {
"length" : 40
},
"x-format" : {
"hex" : true
}
},
{
"name" : "body",
"schema" : {
"$ref" : "#/definitions/Create Pipeline"
},
"in" : "body"
}
],
"tags" : [
"v3"
],
"description" : "Save a specific pipeline",
"responses" : {
"default" : {
"schema" : {
"type" : "string"
},
"description" : "Successful"
}
},
"operationId" : "putV3PipelinesId",
"summary" : "Save a pipeline"
},
"get" : {
"responses" : {
"200" : {
"schema" : {
"$ref" : "#/definitions/Model 7",
"title" : "Get Pipeline"
},
"description" : "Successful"
}
},
"description" : "Returns a pipeline record",
"operationId" : "getV3PipelinesId",
"summary" : "Get a single pipeline",
"tags" : [
"v3"
],
"parameters" : [
{
"in" : "path",
"name" : "id",
"required" : true,
"description" : "Identifier of this Pipeline",
"x-format" : {
"hex" : true
},
"x-constraint" : {
"length" : 40
},
"example" : "2d991790bab1ac8576097ca87f170df73410b55c",
"type" : "string"
}
]
}
}
},
"info" : {
"title" : "Screwdriver API Documentation",
"version" : "3"
},
"swagger" : "2.0",
"definitions" : {
"Update Platform" : {
"properties" : {
"experimental" : {
"default" : false,
"type" : "boolean",
"description" : "Whether platform is experimental"
}
},
"type" : "object",
"required" : [
"experimental"
]
},
"Get Pipeline" : {
"type" : "object",
"required" : [
"id",
"platform",
"scmUrl",
"createTime"
],
"properties" : {
"id" : {
"example" : "2d991790bab1ac8576097ca87f170df73410b55c",
"description" : "Identifier of this Pipeline",
"type" : "string",
"x-format" : {
"hex" : true
},
"x-constraint" : {
"length" : 40
}
},
"platform" : {
"example" : "nodejs_app@4",
"description" : "Specified Platform + Version",
"type" : "string"
},
"configUrl" : {
"required" : false,
"type" : "string",
"description" : "Source Code URL for Screwdriver configuration",
"example" : "git@github.com:screwdriver-cd/optional-config.git#master"
},
"createTime" : {
"format" : "date",
"description" : "When this pipeline was created",
"type" : "string"
},
"scmUrl" : {
"example" : "git@github.com:screwdriver-cd/data-model.git#master",
"type" : "string",
"description" : "Source Code URL for the application"
}
}
},
"Model 6" : {
"type" : "object",
"$ref" : "#/definitions/Get Job"
},
"Model 7" : {
"type" : "object",
"$ref" : "#/definitions/Get Pipeline"
},
"Update Job" : {
"type" : "object",
"properties" : {
"state" : {
"default" : "ENABLED",
"enum" : [
"ENABLED",
"DISABLED"
],
"type" : "string",
"description" : "Current state of the Job",
"example" : "ENABLED"
}
},
"required" : [
"state"
]
},
"Update Build" : {
"required" : [
"status"
],
"type" : "object",
"properties" : {
"status" : {
"default" : "QUEUED",
"enum" : [
"SUCCESS",
"FAILURE",
"QUEUED",
"ABORTED",
"INPROGRESS"
],
"example" : "SUCCESS",
"description" : "Current status of the build",
"type" : "string"
}
}
},
"Create Build" : {
"properties" : {
"jobId" : {
"type" : "string",
"description" : "Identifier of the Job",
"example" : "50dc14f719cdc2c9cb1fb0e49dd2acc4cf6189a0",
"x-constraint" : {
"length" : 40
},
"x-format" : {
"hex" : true
}
}
},
"type" : "object",
"required" : [
"jobId"
]
},
"Create Platform" : {
"type" : "object",
"properties" : {
"config" : {
"example" : {
"notification" : "batman@email.com"
},
"type" : "object",
"description" : "Config of platform"
},
"docUrl" : {
"example" : "http://blah.com",
"required" : false,
"description" : "Doc URL for the platform",
"type" : "string",
"default" : ""
},
"name" : {
"example" : "node",
"type" : "string",
"description" : "Name of platform"
},
"author" : {
"example" : "batman",
"description" : "Author of platform",
"type" : "string"
},
"experimental" : {
"default" : false,
"required" : false,
"description" : "Whether platform is experimental",
"type" : "boolean"
},
"scmUrl" : {
"example" : "git@github.com:screwdriver-cd/data-model.git#c55494cdc55063ecd854800cc4ccc949659c1519",
"description" : "Source Code URL for Screwdriver configuration",
"type" : "string"
},
"version" : {
"example" : "1.0.0",
"description" : "Version of platform",
"type" : "string"
}
},
"required" : [
"name",
"version",
"config",
"author",
"scmUrl"
]
},
"Model 2" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/Get Job"
}
},
"Get Job" : {
"properties" : {
"description" : {
"maximum" : 100,
"required" : false,
"description" : "Description of the Job",
"type" : "string",
"example" : "builds and tests the code"
},
"name" : {
"maximum" : 25,
"example" : "main",
"type" : "string",
"description" : "Name of the Job"
},
"id" : {
"x-constraint" : {
"length" : 40
},
"x-format" : {
"hex" : true
},
"description" : "Identifier of this Job",
"type" : "string",
"example" : "50dc14f719cdc2c9cb1fb0e49dd2acc4cf6189a0"
},
"state" : {
"example" : "ENABLED",
"type" : "string",
"description" : "Current state of the Job",
"default" : "ENABLED",
"enum" : [
"ENABLED",
"DISABLED"
]
},
"pipelineId" : {
"x-format" : {
"hex" : true
},
"x-constraint" : {
"length" : 40
},
"example" : "2d991790bab1ac8576097ca87f170df73410b55c",
"description" : "Identifier of the Pipeline",
"type" : "string"
}
},
"type" : "object",
"required" : [
"id",
"name",
"pipelineId",
"state"
]
},
"Model 8" : {
"type" : "object",
"$ref" : "#/definitions/Get Platform"
},
"Model 1" : {
"items" : {
"$ref" : "#/definitions/Get Build"
},
"type" : "array"
},
"Get Platform" : {
"properties" : {
"version" : {
"description" : "Version of platform",
"type" : "string",
"example" : "1.0.0"
},
"experimental" : {
"description" : "Whether platform is experimental",
"type" : "boolean",
"default" : false
},
"author" : {
"example" : "batman",
"type" : "string",
"description" : "Author of platform"
},
"docUrl" : {
"default" : "",
"type" : "string",
"description" : "Doc URL for the platform",
"example" : "http://blah.com"
},
"config" : {
"example" : {
"notification" : "batman@email.com"
},
"type" : "object",
"description" : "Config of platform"
},
"scmUrl" : {
"example" : "git@github.com:screwdriver-cd/data-model.git#c55494cdc55063ecd854800cc4ccc949659c1519",
"type" : "string",
"description" : "Source Code URL for Screwdriver configuration"
},
"name" : {
"example" : "node",
"description" : "Name of platform",
"type" : "string"
},
"id" : {
"example" : "334b3152916f7cbc59579f7a18744450d5a5a907",
"description" : "Identifier of this platform",
"type" : "string",
"x-format" : {
"hex" : true
},
"x-constraint" : {
"length" : 40
}
}
},
"type" : "object",
"required" : [
"id",
"name",
"version",
"config",
"author",
"docUrl",
"scmUrl",
"experimental"
]
},
"Model 5" : {
"$ref" : "#/definitions/Get Build",
"type" : "object"
},
"Model 4" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/Get Platform"
}
},
"Get Build" : {
"type" : "object",
"properties" : {
"executor" : {
"example" : "executor-15",
"required" : false,
"description" : "What machine did it run on",
"type" : "string"
},
"id" : {
"example" : "4b8d9b530d2e5e297b4f470d5b0a6e1310d29c5e",
"description" : "Identifier of this Build",
"type" : "string",
"x-format" : {
"hex" : true
},
"x-constraint" : {
"length" : 40
}
},
"status" : {
"default" : "QUEUED",
"enum" : [
"SUCCESS",
"FAILURE",
"QUEUED",
"ABORTED",
"INPROGRESS"
],
"example" : "SUCCESS",
"type" : "string",
"description" : "Current status of the build"
},
"parameters" : {
"required" : false,
"description" : "Input parameters that defined this build",
"type" : "object"
},
"createTime" : {
"description" : "When this build was created",
"type" : "string",
"format" : "date"
},
"runNumber" : {
"example" : 15,
"type" : "number",
"description" : "Incrementing number of a Job",
"x-constraint" : {
"positive" : true
}
},
"sha1" : {
"example" : "ccc49349d3cffbd12ea9e3d41521480b4aa5de5f",
"type" : "string",
"required" : false,
"description" : "SHA1 this project was built on",
"x-format" : {
"hex" : true
},
"x-constraint" : {
"length" : 40
}
},
"startTime" : {
"required" : false,
"type" : "string",
"description" : "When this build started on a build machine",
"format" : "date"
},
"jobId" : {
"x-format" : {
"hex" : true
},
"x-constraint" : {
"length" : 40
},
"example" : "50dc14f719cdc2c9cb1fb0e49dd2acc4cf6189a0",
"description" : "Identifier of the Job",
"type" : "string"
},
"endTime" : {
"description" : "When this build stopped running",
"required" : false,
"type" : "string",
"format" : "date"
},
"cause" : {
"description" : "Reason why this build started",
"type" : "string",
"example" : "Commit ccc493 was pushed to master"
}
},
"required" : [
"id",
"jobId",
"runNumber",
"cause",
"createTime",
"status"
]
},
"Create Pipeline" : {
"type" : "object",
"properties" : {
"scmUrl" : {
"type" : "string",
"description" : "Source Code URL for the application",
"example" : "git@github.com:screwdriver-cd/data-model.git#master"
},
"configUrl" : {
"required" : false,
"description" : "Source Code URL for Screwdriver configuration",
"type" : "string",
"example" : "git@github.com:screwdriver-cd/optional-config.git#master"
}
},
"required" : [
"scmUrl"
]
},
"Model 3" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/Get Pipeline"
}
}
},
"basePath" : "/",
"host" : "a4677c9873c9611e6aa7102b92f75d5c-1135862614.us-west-2.elb.amazonaws.com",
"tags" : [],
"schemes" : [
"http"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment