Skip to content

Instantly share code, notes, and snippets.

@anymaniax
Last active May 17, 2021 16:46
Show Gist options
  • Save anymaniax/0845dfa1591f47708c32151362da9f3c to your computer and use it in GitHub Desktop.
Save anymaniax/0845dfa1591f47708c32151362da9f3c to your computer and use it in GitHub Desktop.
business-api
openapi: 3.0.0
components:
schemas:
Business:
type: object
properties:
name:
description: the name of the business
type: string
url:
description: the URL of the business
type: string
categories:
description: the categories this business belongs to
type: array
default: [ ]
items:
$ref: '#/components/schemas/Category'
location:
description: the pyhysical address of the business
type: object
$ref: '#/components/schemas/Location'
hours:
description: the hours of operation for this business
type: array
default: [ ]
items:
$ref: '#/components/schemas/Hour'
Category:
type: object
properties:
title:
description: name of the category
example: Thai
type: string
Location:
type: object
properties:
address1:
description: the address1 for the business
type: string
address2:
description: the address2 for the business
type: string
address3:
description: the address3 for the business
type: string
city:
description: the city for the business
type: string
state:
description: the state where business is located
type: string
postal_code:
description: the postal code for the business
type: string
Hour:
type: object
properties:
hours_type:
description: Is this business has regular or special hours
type: string
openapi: 3.0.0
components:
schemas:
Businesses:
type: array
default: []
items:
$ref: './business.yaml#/components/schemas/Business'
openapi: 3.0.0
info:
title: Businesses API
description: Information about businesses
version: 0.0.1
servers:
- url: https://api.businesses.com/
paths:
/businesses:
get:
summary: Returns 50 businesses
responses:
'200':
description: A JSON object with the results
content:
application/json:
schema:
$ref: './schema/businesses.yaml#/components/schemas/Businesses'
/business/random:
get:
summary: Returns a random business from a list of 50 businesses
responses:
'200':
description: A JSON object for a random business
content:
application/json:
schema:
$ref: './schema/business.yaml#/components/schemas/Business'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment