cylkdev / absinthe_generator

Generators for absinthe (WIP NOT READY YET)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AbsintheGenerator

Test Hex pm

Collection of mix tasks to help generate absinthe projects and schemas

This can be used to generate either individiual parts of your application or full sections

Installation

Available in Hex, the package can be installed by adding absinthe_generator to your list of dependencies in mix.exs:

def deps do
  [
    {:absinthe_generator, "~> 0.1"}
  ]
end

Using via Mix Task

We have a few commands we gain access to using this package:

mix absinthe              # Lists help for absinthe.gen. commands
mix absinthe.gen          # Lists help for absinthe.gen. commands
mix absinthe.gen.mutation # Generates an absinthe mutation schema and inserts the record in the base schema.ex
mix absinthe.gen.query    # Generates an absinthe query schema and inserts the record in the base schema.ex
mix absinthe.gen.resolver # Generates an absinthe resolver
mix absinthe.gen.schema   # Generates an absinthe schema
mix absinthe.gen.type     # Generates an absinthe type

Using via Code

This library also enables developers to create configs that pass into each portion and those configs can be utilized to generate absinthe portions. To see more on this please checkout the docs for:

  • AbsintheGenerator.Schema
  • AbsintheGenerator.Mutation
  • AbsintheGenerator.Query
  • AbsintheGenerator.Resolver
  • AbsintheGenerator.Type

Each of these modules defines a struct, when passed to the &AbsintheGenerator.Schema.run/1 function this will generate a string template for your file

Contributing

This library favors output format over template format and therefore has some sacrifices made in the favor of well formatted output code

About

Generators for absinthe (WIP NOT READY YET)

License:MIT License


Languages

Language:Elixir 90.9%Language:HTML 9.1%