Skip to content

Instantly share code, notes, and snippets.

View marbemac's full-sized avatar

Marc MacLeod marbemac

View GitHub Profile
| files.readFile 3 ms (3)
| files.exists 1 ms (4)
| files.writeFileAtomically.....................................2,958 ms (2)
| ├─ files.writeFile 2,953 ms (2)
| └─ files.rename 5 ms (2)
| Rebuild App.................................................102,326 ms (1)
| ├─ compiler.compile(the app)....................................142 ms (1)
| │ └─ compileUnibuild (the app).................................142 ms (2)
| │ ├─ files.readdir 19 ms (126)
| │ ├─ files.stat 9 ms (813)
@marbemac
marbemac / config.json
Last active March 17, 2016 19:02
The default Prism config file.
{
"port": "4010",
"forwardHost": null,
"basePath": null,
"log": false,
"logLocation": "https://api.stoplight.io/v1",
"debug": true,
"mock": {
"enabled": false,
@marbemac
marbemac / spec.json
Last active March 18, 2016 00:19
A barebones swagger example, that includes the StopLight extension to instruct Prism to validate and add a response header to all requests.
{
"swagger": "2.0",
"host": "myapi.com",
"schemes": ["http"],
"info": {},
"paths": {},
"definitions": {},
"x-stoplight": {
"beforeScript": "function(ctx, request) {}",
"afterScript": "function(ctx, request, response) { // messages contain any warnings or errors var messages = response.validate(); var isValid = response.valid.get(); // Set a header here, so that your testing tools can throw errors appropriately if (isValid) { response.header.set('Validation', 'Passed'); } else { response.header.set('Validation', 'Failed'); } }",
{
"swagger": "2.0",
"schemes": [
"http"
],
"basePath": "/api",
"host": "localhost:3000",
"info": {
"version": "",
@marbemac
marbemac / swagger.json
Last active June 28, 2017 17:54
Stoplight To-do Demo Swagger
{
"swagger": "2.0",
"info": {
"version": "1.0",
"title": "To-do Demo",
"description": "## Welcome\n\nThis is a place to put general notes and extra information, for internal use.\n\nTo get started designing/documenting this API, select a version on the left."
},
"host": "todos.stoplight.io",
"schemes": [
"http"
{
"name": "Retweet Stoplight's latest tweet",
"description": "This scenario will grab the latest Stoplight tweet, and retweet it. The twitter API requires that requests be authenticated with oauth1. Before you can run this scenario, you must fill out the variables below.\n\n1. Create a new app at [https://apps.twitter.com](https://apps.twitter.com). No callback url needed.\n2. Navigate to the keys and access tokens tab of your app (see screenshot), and copy paste the tokens and secrets below.\n3. Click run scenario above!\n\n![](http://i.imgur.com/I6Eg08M.png)",
"steps": [
{
"functions": [
{
"name": "Get latest tweet",
"input": {
"authorization": {
@marbemac
marbemac / gist:8ab63f09d04073bb4f8c17de91d3a585
Created October 13, 2016 19:55
random github gist flow
{
"name": "Random Github Gist",
"steps": [
{
"functions": [
{
"name": "List gists and save random id",
"input": {
"request": {
"method": "get",
{
"steps": [
{
"functions": [
{
"input": {
"request": {
"postData": {
"text": "{\n \"foo\": \"bar\"\n}"
},
swagger: '2.0'
info:
version: 0.2.0
title: VMware Cello
description: RESTful API for VMware Cello User Service
termsOfService: 'https://github.com/vmware/cello/blob/master/LICENSE'
license:
name: Apache 2.0
url: 'https://github.com/vmware/cello/blob/master/LICENSE'
contact:
---
swagger: '2.0'
info:
version: '1.0'
title: To-do Demo
description: |-
## Welcome
This is a place to put general notes and extra information, for internal use.