Skip to content

Instantly share code, notes, and snippets.

@iamlow
Last active March 13, 2018 01:25
Show Gist options
  • Select an option

  • Save iamlow/2cbfa220eb41bb5e261b7d9ae5dc57b2 to your computer and use it in GitHub Desktop.

Select an option

Save iamlow/2cbfa220eb41bb5e261b7d9ae5dc57b2 to your computer and use it in GitHub Desktop.
Verify an oas yaml file to use swagger
swagger: "2.0"
info:
description: "This is a telelian-media-station api server."
version: "0.1.0"
title: "telelian-media-station"
termsOfService: "http://telelian.com/"
contact:
email: "[email protected]"
license:
name: "Unknown"
url: "http://telelian.com"
host: "192.168.0.3:1984"
basePath: "/api"
tags:
- name: "src"
description: "Media source"
- name: "mix"
description: "Media mixer"
- name: "sink"
description: "Media sink(rtmp, webrtc)"
schemes:
- "http"
paths:
/src:
post:
tags:
- "src"
summary: "Add a new source"
description: ""
operationId: "addSrc"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "src"
description: "Source bin that needs to be added to the service"
required: true
schema:
$ref: "#/definitions/Src"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/Src"
405:
description: "Invalid input"
put:
tags:
- "src"
summary: "Update an existing source"
description: ""
operationId: "updateSrc"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "src"
description: "Source bin that needs to be updated to the service"
requred: true
schema:
$ref: "#/definitions/Src"
responses:
200:
description: "successful operation"
400:
description: "Invalid ID supplied"
404:
description: "Source ID not found"
405:
description: "Validation exception"
/src/{srcId}:
get:
tags:
- "src"
summary: "Get source"
description: "Return a source"
operationId: "getSrcById"
produces:
- "application/json"
parameters:
- name: "srcId"
in: "path"
description: "ID of source to return"
required: true
type: "integer"
format: "int64"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/Src"
400:
description: "Invalid ID supplied"
404:
description: "Source not found"
delete:
tags:
- "src"
summary: "Deletes a source"
description: ""
operationId: "deleteSrc"
produces:
- "application/json"
parameters:
- name: "srcId"
in: "path"
description: "Source id to delete"
required: true
type: "integer"
format: "int64"
responses:
200:
description: "successful operation"
400:
description: "Invaid ID supplied"
404:
description: "Source not found"
definitions:
Src:
type: "object"
# required:
# - "name"
# - "srcUrl"
# - "destUrl"
properties:
id:
type: "integer"
format: "int64"
name:
type: "string"
example: "videotestsrc"
srcUrl:
type: "string"
example: "videotestsrc"
destUrl:
type: "string"
example: "rtmp://localhost/live/stream"
status:
type: "string"
description: "source status in the service"
enum:
- "available"
- "pending"
Error:
type: "object"
required:
- "code"
- "message"
properties:
code:
type: "integer"
format: "int32"
message:
type: "string"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment