Skip to content

Instantly share code, notes, and snippets.

View acunniffe's full-sized avatar
🏁
finishing things

Aidan Cunniffe acunniffe

🏁
finishing things
View GitHub Profile

New Optic Skills SDK

Setup

  1. Download a snapshot build

  2. Start Optic server `java -jar path/to/server.jar

  3. Clone the Optic Skills SDK Repo

  4. Run yarn install

  5. explore code within /examples

@acunniffe
acunniffe / test.js
Created August 16, 2018 00:47
combined value/schema example
{
in: {
type: "string",
enum: ["query", "body", "params", "header"],
from: tokenWithValue('query')
},
name: {
type: "string",
from: tokenWithValue('name')
}
@acunniffe
acunniffe / gist:50fa7d328287d293e8f237d414107050
Created August 14, 2018 22:05
proposed optic-skills-sdk lens example
/*
Express Parameter Lens
*/
import {js} from '../sdk-objects/lens/Snippet'
import {literalWithValue, tokenWithValue} from "../sdk-objects/lens/Finders";
const lens = js`
req.query.name
`
@acunniffe
acunniffe / gist:4dd226f885a9881ac81860097e1134dd
Created March 25, 2018 23:55
Optic Transformation Example
//input
const toDo = mongoose.model('todo', new mongoose.Schema({
'message': 'string',
'isDone': 'string'
}))
//output
app.post('/todo', (req, res)=> {
new toDo({
message: req.body.message,