Skip to content

Instantly share code, notes, and snippets.

@jackphuongvu
Created December 3, 2018 18:49
Show Gist options
  • Select an option

  • Save jackphuongvu/68409d1928a597ec7b6a1a91dbac296a to your computer and use it in GitHub Desktop.

Select an option

Save jackphuongvu/68409d1928a597ec7b6a1a91dbac296a to your computer and use it in GitHub Desktop.
Update current working Code with Swagger that creates Docs API for this app
swagger: "2.0"
info:
description: "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters."
version: "1.0.0"
title: "English Chat App API"
termsOfService: "http://swagger.io/terms/"
contact:
email: "momabz6@gmail.com"
license:
name: "Apache 2.0"
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
host: "petstore.swagger.io"
basePath: "/v2"
tags:
- name: "user"
description: "Operations about user"
externalDocs:
description: "Find out more about our store"
url: "http://swagger.io"
schemes:
- "https"
- "http"
paths:
/auth/login:
post:
tags:
- "user"
summary: "Authentication User"
description: "Authentication User Description"
operationId: "authLogin"
consumes:
- "application/json"
# - "application/xml"
produces:
# - "application/xml"
- "application/json"
parameters:
- in: "body"
name: "body"
description: "parameters description post inside /auth/login"
required: true
# schema:
# $ref: "#/definitions/auth/login"
responses:
401:
description: "Unauthorized"
405:
description: "Invalid input"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
# Doing right here
securityDefinitions:
petstore_auth:
type: "oauth2"
authorizationUrl: "http://petstore.swagger.io/oauth/dialog"
flow: "implicit"
scopes:
write:pets: "modify pets in your account"
read:pets: "read your pets"
api_key:
type: "apiKey"
name: "api_key"
in: "header"
definitions:
/auth/login:
type: "object"
properties:
email:
type: "string"
format: "email"
externalDocs:
description: "Find out more about Swagger"
url: "http://swagger.io"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment