Skip to content

Instantly share code, notes, and snippets.

@beriberikix
Created June 29, 2020 01:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beriberikix/fdc2da5ad0e99caf8d72aef295eae5b9 to your computer and use it in GitHub Desktop.
Save beriberikix/fdc2da5ad0e99caf8d72aef295eae5b9 to your computer and use it in GitHub Desktop.
coreapi: 0.0.0 #!OAS
servers:
- url: '{scheme}://example.com'
variables:
scheme:
enum:
- 'coap'
- 'coaps'
- 'coap+tcp'
- 'coaps+tcp'
default: 'coaps'
info:
title: Experimental Example
version: 0.0.0
paths:
/temperature:
get:
operationalId: getTemp
summary: Get temperature
parameters:
- name: type
in: options #!OAS
description: 'Type of message'
type: string
enum: [confirmable, non-confirmable]
- name: token
in: options
description: 'Token used to match response with request'
required: false
type: integer
format: byte #!OAS
responses:
'2.05':
description: >-
Temperature value found
content:
charset=utf-8:
schema:
$ref: '#components/schema/Temp'
examples:
recording: '22.3 C'
options: #!OAS
type:
description: 'Type of message'
type: string
enum: [acknowledgement, reset]
post:
delete:
put:
fetch: #!OAS
patch: #!OAS
ipatch: #!OAS
observables: #!OAS, but similar to webhooks.
# Arguably registration/re-registration could happen in Paths & this renamed to Notifications
# AsyncAPI "Channels" might be a better fit
paths:
/temperature/critical:
get:
operationalId: observeCriticalTemp
summary: get notified when temperature meets a threshold
parameters:
- name: observe
in: options #!OAS
description: Register to deregister observe request
required: true
type: boolean
notifications:
groups: #!OAS
components:
schema:
Temp:
required:
- recording
properties:
recording:
type: string
format: utf-8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment