Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Azure Functions with Swagger
swagger: '2.0'
info:
title: xxxx.azurewebsites.net
version: 1.0.0
host: xxxx.azurewebsites.net
basePath: /
schemes:
- https
- http
paths:
/api/products:
post:
description: >-
Replace with Operation Object
#http://swagger.io/specification/#operationObject
operationId: /api/products/post
consumes:
- application/json
produces:
- application/json
parameters:
- name: product
in: body
required: true
schema:
$ref: "#/definitions/CreateProductRequestModel"
responses:
'200':
description: Success operation
schema:
$ref: "#/definitions/CreateProductResponseModel"
security:
- apikeyQuery: []
- apikeyHeader: []
'/api/products/{productId}':
get:
description: >-
Replace with Operation Object
#http://swagger.io/specification/#operationObject
operationId: '/api/products/{productId}/get'
produces:
- application/json
parameters:
- name: productId
in: path
required: true
type: string
responses:
'200':
description: Success operation
schema:
$ref: "#/definitions/GetProductResponseModel"
security:
- apikeyQuery: []
- apikeyHeader: []
definitions:
CreateProductRequestModel:
type: object
properties:
productName:
type: string
productDescription:
type: string
productPrice:
type: number
format: double
required:
- productName
- productDescription
- productPrice
example:
productName: Product A
productDescription: This is Product A
productPrice: 123.45
CreateProductResponseModel:
type: object
properties:
productId:
type: string
productName:
type: string
productDescription:
type: string
productPrice:
type: number
format: double
required:
- productId
- productName
- productDescription
- productPrice
example:
productId: f3198d5e-341d-4267-bf63-bb3ef692b70d
productName: Product A
productDescription: This is Product A
productPrice: 123.45
GetProductResponseModel:
type: object
properties:
productId:
type: string
productName:
type: string
productDescription:
type: string
productPrice:
type: number
format: double
required:
- productId
- productName
- productDescription
- productPrice
example:
productId: f3198d5e-341d-4267-bf63-bb3ef692b70d
productName: Product A
productDescription: This is Product A
productPrice: 123.45
securityDefinitions:
apikeyQuery:
type: apiKey
name: code
in: query
apikeyHeader:
type: apiKey
name: x-functions-key
in: header
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment