- From “Willy Wonka & The Chocolate Factory”
- Watch the video
SLUGWORTH:
-
I congratulate you, little boy. Well done. You found the fifth Golden Ticket.
-
May I introduce myself. Arthur Slugworth, President of Slugworth Chocolates, Incorporated.
SLUGWORTH:
I congratulate you, little boy. Well done. You found the fifth Golden Ticket.
May I introduce myself. Arthur Slugworth, President of Slugworth Chocolates, Incorporated.
| abort 'Usage: ruby fill.rb <PROJECT_NUMBER> <NWO> <PAT>' unless ARGV.length == 3 | |
| require 'bundler/setup' | |
| require 'fileutils' | |
| require 'json' | |
| require 'faraday' | |
| class ProjectSync |
| #!/usr/bin/env ruby | |
| require "net/http" | |
| require "uri" | |
| require "yaml" | |
| require "json" | |
| require "fileutils" | |
| class String | |
| def dasherize |
GraphQL document is parsed:
This returns a tree of Absinthe.Language nodes (structs), effectively the AST:
This tree is converted to a tree of Absinthe.Blueprint nodes (structs):
| FROM cargosense/elixir-ubuntu:20.2-v1.6.2 | |
| # Install debian packages | |
| RUN apt-get update | |
| RUN apt-get install -y build-essential inotify-tools postgresql-client | |
| # Install Phoenix packages | |
| RUN mix local.hex --force | |
| RUN mix local.rebar --force | |
| RUN mix archive.install --force https://github.com/phoenixframework/archives/raw/master/phx_new.ez |
Here's a quick workaround (at least for local use) that involves downloading the assets:
First, make sure you're running absinthe_plug from master (you need an unreleased fix for HTTPS downloads):
In your mix.exs:
defp deps do
[
# ...| defmodule CoryWeb.Router do | |
| use CoryWeb, :router | |
| defmodule SchemaOnePlug do | |
| def init(_), do: Absinthe.Plug.init(schema: CoryWeb.SchemaOne) | |
| def call(conn, opts), do: Absinthe.Plug.call(conn, opts) | |
| end | |
| defmodule SchemaTwoPlug do | |
| def init(_), do: Absinthe.Plug.init(schema: CoryWeb.SchemaTwo) |
| mutation do | |
| field :create_foo, :create_foo_result do | |
| resolve fn _, _ -> | |
| # Return an :ok w/ a :create_foo_result | |
| # containing a `foo` and/or `errors` | |
| end | |
| end | |
| end | |
| @desc "The result of creating a Foo" |
| defmodule MyApp.Web.Schema.Types.Company do | |
| use Absinthe.Schema.Notation | |
| object :company_queries do | |
| field :companies, list_of(:company) do | |
| # ... | |
| end | |
| field :company, type: :company do |
| resolve_type fn | |
| # Guess type from struct name: | |
| # Example: %Foo{} -> :foo | |
| %str{}, _ -> | |
| str | |
| |> Some.Helper.Module.struct_to_object_type | |
| value, _ -> | |
| Logger.warn "Could not extract type from value: #{inspect value}" | |
| nil | |
| end |