Skip to content

Instantly share code, notes, and snippets.

@hakant
Created August 1, 2018 20:58
Show Gist options
  • Save hakant/8fc34e740603881f26d1f3b960d472be to your computer and use it in GitHub Desktop.
Save hakant/8fc34e740603881f26d1f3b960d472be to your computer and use it in GitHub Desktop.
{
"swagger":"2.0",
"info":{
"version":"3.0",
"title":"Sample API 3.0",
"description":"A sample application with Swagger, Swashbuckle, and API versioning."
},
"paths":{
"/api/v3/People":{
"get":{
"tags":[
"People"
],
"summary":"Gets all people.",
"operationId":"ApiV3PeopleGet",
"consumes":[
],
"produces":[
"text/plain",
"application/json",
"text/json"
],
"parameters":[
],
"responses":{
"200":{
"description":"The successfully retrieved people.",
"schema":{
"uniqueItems":false,
"type":"array",
"items":{
"$ref":"#/definitions/Person"
}
}
}
}
},
"post":{
"tags":[
"People"
],
"summary":"Creates a new person.",
"operationId":"ApiV3PeoplePost",
"consumes":[
"application/json-patch+json",
"application/json",
"text/json",
"application/*+json"
],
"produces":[
"text/plain",
"application/json",
"text/json"
],
"parameters":[
{
"name":"person",
"in":"body",
"description":"The person to create.",
"required":false,
"schema":{
"$ref":"#/definitions/Person"
}
}
],
"responses":{
"201":{
"description":"The person was successfully created.",
"schema":{
"$ref":"#/definitions/Person"
}
},
"400":{
"description":"The person was invalid."
}
}
}
},
"/api/v3/People/{id}":{
"get":{
"tags":[
"People"
],
"summary":"Gets a single person.",
"operationId":"ApiV3PeopleByIdGet",
"consumes":[
],
"produces":[
"text/plain",
"application/json",
"text/json"
],
"parameters":[
{
"name":"id",
"in":"path",
"description":"The requested person identifier.",
"required":true,
"type":"integer",
"format":"int32"
}
],
"responses":{
"200":{
"description":"The person was successfully retrieved.",
"schema":{
"$ref":"#/definitions/Person"
}
},
"404":{
"description":"The person does not exist."
}
}
}
}
},
"definitions":{
"Person":{
"description":"Represents a person.",
"required":[
"firstName",
"lastName"
],
"type":"object",
"properties":{
"id":{
"format":"int32",
"description":"Gets or sets the unique identifier for a person.",
"type":"integer"
},
"firstName":{
"description":"Gets or sets the first name of a person.",
"maxLength":25,
"minLength":0,
"type":"string"
},
"lastName":{
"description":"Gets or sets the last name of a person.",
"maxLength":25,
"minLength":0,
"type":"string"
},
"email":{
"description":"Gets or sets the email address for a person.",
"type":"string"
},
"phone":{
"description":"Gets or sets the telephone number for a person.",
"type":"string"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment