Skip to content

Instantly share code, notes, and snippets.

View wawhal's full-sized avatar

Rishichandra Wawhal wawhal

View GitHub Profile
@wawhal
wawhal / metadata_object.json
Last active November 21, 2023 07:37
metadata_object.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "MetadataObject",
"anyOf": [
{
"oneOf": [
{
"title": "CompatibilityConfig",
"type": "object",
"required": [
type Foo = {response: { foo: string}}
type NullableFoo = Foo | null
type ListFoo = Foo[]
type Complex<T> = (((T | null)[][] | null) | null)[]
type ComplexFoo = Complex<Foo>
@wawhal
wawhal / gist:43e1049b859941af96155dc27cca5525
Last active September 12, 2023 11:11
ndc-schema-spec-test.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "SchemaResponse",
"type": "object",
"required": [
"collections",
"functions",
"object_types",
"procedures",
"scalar_types"
@wawhal
wawhal / introspection.bash
Created January 11, 2021 18:51
introspection.bash
curl 'https://<project-name>.hasura.app/v1/graphql' \
-H 'content-type: application/json' \
--data-binary '{"query":"\n query IntrospectionQuery {\n __schema {\n queryType { name }\n mutationType { name }\n subscriptionType { name }\n types {\n ...FullType\n }\n directives {\n name\n description\n locations\n args {\n ...InputValue\n }\n }\n }\n }\n\n fragment FullType on __Type {\n kind\n name\n description\n fields(includeDeprecated: true) {\n name\n description\n args {\n ...InputValue\n }\n type {\n ...TypeRef\n }\n isDeprecated\n deprecationReason\n }\n inputFields {\n ...InputValue\n }\n interfaces {\n ...TypeRef\n }\n enumValues(includeDeprecated: true) {\n name\n description\n isDeprecated\n deprecationR
input LoginInfo {
email: String
password: String
}
type UserInfo {
accessToken: String
userId: Int
}
todos (
id integer not null primary key,
task text not null,
created_at timestamptz default now,
is_complete bool default false,
user_id integer not null foreign key references users(id),
update_mutation_identifier int default 0
)
todos (
id int not null primary key,
task text not null,
created_at timestamptz default now,
is_complete bool default false,
user_id int not null foreign key references users(id)
)
// Installation
// yarn add apollo-boost apollo-link-ws subscriptions-transport-ws react-apollo graphql
// npm install --save apollo-boost apollo-link-ws subscriptions-transport-ws react-apollo graphql
import React from 'react';
import { View, Text } from 'react-native';
import { ApolloClient } from 'apollo-client';
import { WebSocketLink } from 'apollo-link-ws';
import { InMemoryCache } from 'apollo-cache-inmemory';
@wawhal
wawhal / hge-docker-image-heroku.md
Created July 5, 2019 07:12
A guide to deploy a Hasura GraphQL Engine docker image to Heroku

1. Deploy to Heroku (skip if you already have a Heroku app)

Deploy to Heroku and instantly get a realtime GraphQL API backed by Heroku Postgres:

Deploy to Heroku

Note the name of the app

2. Clone the HGE template repo and cd into it

import React from 'react';
import { Subscription } from 'react-apollo';
import gql from 'graphql-tag';
const ConvertScreen = () => {
const urlParams = new URLSearchParams(window.location.search);
const id = urlParams.get('id');
return (
<Subscription