All Projects → mirego → absinthe_error_payload

mirego / absinthe_error_payload

Licence: other
Bridges the gap between Ecto and Absinthe for mutation payload

Programming Languages

elixir
2628 projects
Makefile
30231 projects

Projects that are alternatives of or similar to absinthe error payload

Defql
Create elixir functions with SQL as a body.
Stars: ✭ 100 (-1.96%)
Mutual labels:  ecto
Mipha
Proj Elixir Forum build with phoenix 1.5.
Stars: ✭ 153 (+50%)
Mutual labels:  ecto
Ecto mnesia
Ecto adapter for Mnesia Erlang term database.
Stars: ✭ 223 (+118.63%)
Mutual labels:  ecto
Elixir Cowboy React Spa
Example application that shows how to use Cowboy 2.0 in conjunction with React and Redux to create data driven Single Page Applications
Stars: ✭ 112 (+9.8%)
Mutual labels:  ecto
Phoenix live dashboard
Realtime dashboard with metrics, request logging, plus storage, OS and VM insights
Stars: ✭ 1,657 (+1524.51%)
Mutual labels:  ecto
Phoenix Ecto Encryption Example
🔐 A detailed example for how to encrypt data in a Phoenix (Elixir) App before inserting into a database using Ecto Types
Stars: ✭ 166 (+62.75%)
Mutual labels:  ecto
Filterable
Filtering from incoming params in Elixir/Ecto/Phoenix with easy to use DSL.
Stars: ✭ 83 (-18.63%)
Mutual labels:  ecto
ecto erd
A mix task for generating Entity Relationship Diagram from Ecto schemas available in your project.
Stars: ✭ 173 (+69.61%)
Mutual labels:  ecto
Ecto autoslug field
Automatically create slugs for Ecto schemas.
Stars: ✭ 129 (+26.47%)
Mutual labels:  ecto
Ex audit
Ecto auditing library that transparently tracks changes and can revert them.
Stars: ✭ 214 (+109.8%)
Mutual labels:  ecto
Rethinkdb ecto
RethinkDB adapter for Ecto.
Stars: ✭ 112 (+9.8%)
Mutual labels:  ecto
Github ecto
Ecto adapter for GitHub API
Stars: ✭ 114 (+11.76%)
Mutual labels:  ecto
Rummage ecto
Search, Sort and Pagination for ecto queries
Stars: ✭ 190 (+86.27%)
Mutual labels:  ecto
Kronky
Kronky bridges the gap between Ecto and Absinthe GraphQL by listing validation messages in a mutation payload.
Stars: ✭ 112 (+9.8%)
Mutual labels:  ecto
Etso
Ecto 3 adapter allowing use of Ecto schemas held in ETS tables
Stars: ✭ 226 (+121.57%)
Mutual labels:  ecto
Ecto state machine
State machine pattern for Ecto
Stars: ✭ 91 (-10.78%)
Mutual labels:  ecto
Filtrex
A library for performing and validating complex filters from a client (e.g. smart filters)
Stars: ✭ 157 (+53.92%)
Mutual labels:  ecto
fat ecto
Query mechanism for Ecto
Stars: ✭ 20 (-80.39%)
Mutual labels:  ecto
Params
Easy parameters validation/casting with Ecto.Schema, akin to Rails' strong parameters.
Stars: ✭ 239 (+134.31%)
Mutual labels:  ecto
Formex
A better form library for Phoenix
Stars: ✭ 206 (+101.96%)
Mutual labels:  ecto



Bridges the gap between Ecto and Absinthe GraphQL
by listing validation messages in a mutation payload.

The primary philosophy is that messages generated by invalid and/or unexpected user input are DATA, and should be returned as such. On the other hand, errors made in using an API - like querying a field that doesn’t exist -, are actually ERRORS and should be returned as errors.

GraphQL fits perfectly here. Error are handled explicitly in the query and actual errors are treated as internal error on client side library.

Installation

Install by adding absinthe_error_payload to your list of dependencies in mix.exs:

def deps do
  [
    {:absinthe_error_payload, "~> 1.0"}
  ]
end

Usage

The best place to find usage examples is by looking at the test cases at the AbsintheErrorPayload GitHub or the docs for AbsintheErrorPayload.Payload

Here’s a quick summary of what AbsintheErrorPayload includes

AbsintheErrorPayload.ValidationMessage structs/objects are created with all the information you’d normally be able to access through Ecto.Changeset.traverse_errors/2.

AbsintheErrorPayload includes a schema definition to add ValidationMessages to your schema.

AbsintheErrorPayload.Payload is middleware that takes your resolver output (either an updated object or a changeset with errors) and converts it into a AbsintheErrorPayload Mutation Response (aka Payload).

Payloads have three fields

  • successful - Indicates if the mutation completed successfully or not. Boolean.
  • messages - a list of validation errors. Always empty on success
  • result - the data object that was created/updated/deleted on success. Always nil when unsuccessful.

Finally AbsintheErrorPayload.TestHelper has some helper methods that make it easier to write ExUnit tests against your schema.

Hey, this looks like Kronky!

This library has been forked from Kronky, renamed to AbsintheErrorPayload and published on hexpm. Kronky was not being updated and while it still worked for older versions, a more maintained release was requested by many users.

Thank you Ethelo for the awesome library!

License

AbsintheErrorPayload is © 2019 Mirego and may be freely distributed under the New BSD license. See the LICENSE.md file.

As mentioned above, AbsintheErrorPayload is based on Kronky which is licensed under the MIT license. See the KRONKY_LICENSE.md file.

The flask logo is based on this lovely icon by Danil Polshin, from The Noun Project. Used under a Creative Commons BY 3.0 license.

About Mirego

Mirego is a team of passionate people who believe that work is a place where you can innovate and have fun. We’re a team of talented people who imagine and build beautiful Web and mobile applications. We come together to share ideas and change the world.

We also love open-source software and we try to give back to the community as much as we can.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].