Skip to content

Instantly share code, notes, and snippets.

@cortinico
Created October 21, 2019 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cortinico/850d942340f0df210c514e182bbad29d to your computer and use it in GitHub Desktop.
Save cortinico/850d942340f0df210c514e182bbad29d to your computer and use it in GitHub Desktop.
Sample Swagger Spec for a Yelp API
{
"definitions": {
"Category": {
"description": "A Category used to group businesses",
"properties": {
"id": {
"description": "Unique ID of the Category",
"format": "int64",
"type": "integer"
},
"name": {
"description": "Name of this Category",
"type": "string"
}
},
"type": "object"
},
"Business": {
"description": "Represents a specific Business on Yelp",
"properties": {
"category": {
"$ref": "#/definitions/Category",
"description": "Optional category of the business"
},
"id": {
"description": "Unique ID of this Business",
"format": "int64",
"type": "integer"
},
"name": {
"description": "Name of this specific Business",
"type": "string"
},
"photoUrls": {
"description": "Photo URls for this Business",
"items": {
"type": "string"
},
"type": "array"
},
"status": {
"description": "Status of this Business on Yelp",
"enum": [
"OPEN",
"PERMANENTLY_CLOSED",
"TEMPORARILY_CLOSED"
],
"type": "string"
}
},
"required": [
"id",
"name"
],
"type": "object"
}
},
"info": {
"description": "This is a sample API used for code generation.",
"title": "Yelp Sample Businesses API",
"version": "1.0.0"
},
"paths": {
"/business/{businessId}": {
"get": {
"description": "Returns a single Business by its ID",
"operationId": "getBusinessById",
"parameters": [
{
"description": "ID of Business to search for",
"format": "int64",
"in": "path",
"name": "businessId",
"required": true,
"type": "integer"
}
],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/Business"
}
}
},
"summary": "Find business by ID"
}
}
},
"swagger": "2.0"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment