Skip to content

Instantly share code, notes, and snippets.

View marbemac's full-sized avatar

Marc MacLeod marbemac

View GitHub Profile
import { safeParse, safeStringify } from '@shared/utils-json';
import { cache } from 'react';
/**
* By default react cache only supports primitive arguments.
*
* This fn wraps react cache to support a single object argument.
*/
export function safeCache<R>(fn: () => R): () => R;
export function safeCache<T, R>(fn: (p: T) => R): (p: T) => R;
module.exports = {
async activate() {
SL.graph.onDidChangeSourceNodeContent(({ node }) => {
if (!node || node.subtype !== 'md') return;
let diagnostics = [];
if (node.raw.match('swagger')) {
diagnostics = [
{
code: 'swagger-check',
{
"name": "openapi-over-swagger",
"version": "0.0.1",
"main": "https://gist.githubusercontent.com/marbemac/99ca51fb1e871c888dc33b455240f08d/raw/c1b57e79aaa2e3ff655f7e9306cd13ffd3031977/plugin.js"
}
@marbemac
marbemac / giphy-oas.json
Created September 22, 2017 23:44
Giphy API OAS Example
{
"swagger": "2.0",
"info": {
"version": "1.0",
"title": "Giphy",
"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. # Title\nNo Description"
},
"host": "api.giphy.com",
"basePath": "/v1",
"schemes": [
@marbemac
marbemac / todos.json
Last active February 27, 2017 18:36
todos 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. # Title\nNo Description"
},
"host": "todos.stoplight.io",
"schemes": [
"http"
@marbemac
marbemac / gist:43b580a527fe674156ae5db8eb7682a5
Created October 26, 2016 17:48
simple todos crud test scenario
{
"flowVersion": "1.0",
"name": "To-do CRUD",
"description": "This scenario shows a test for a typical CRUD resource. \n\n1. You need to enter an apiKey variable of `123` below, otherwise steps will fail (try with and without it).\n2. Step 2 is purposefully setup to have a failing test, for demonstration purposes.",
"steps": [
{
"functions": [
{
"name": "Create It",
"input": {
---
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.
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:
{
"steps": [
{
"functions": [
{
"input": {
"request": {
"postData": {
"text": "{\n \"foo\": \"bar\"\n}"
},
@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",