All Projects → Ethelo → Kronky

Ethelo / Kronky

Licence: mit
Kronky bridges the gap between Ecto and Absinthe GraphQL by listing validation messages in a mutation payload.

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to Kronky

Framework
Strongly-typed JavaScript object with support for validation and error handling.
Stars: ✭ 136 (+21.43%)
Mutual labels:  graphql, validation
Elixir Boilerplate
⚗ The stable base upon which we build our Elixir projects at Mirego.
Stars: ✭ 627 (+459.82%)
Mutual labels:  graphql, ecto
Graphql Constraint Directive
Validate GraphQL fields
Stars: ✭ 401 (+258.04%)
Mutual labels:  graphql, validation
Accent
The first developer-oriented translation tool. True asynchronous flow between translators and your team.
Stars: ✭ 721 (+543.75%)
Mutual labels:  graphql, ecto
Graphql Query Complexity
GraphQL query complexity analysis and validation for graphql-js
Stars: ✭ 424 (+278.57%)
Mutual labels:  graphql, validation
Graphql Go Tools
Tools to write high performance GraphQL applications using Go/Golang.
Stars: ✭ 96 (-14.29%)
Mutual labels:  graphql, validation
Formql
FormQL - A framework for building dynamic forms in Angular
Stars: ✭ 110 (-1.79%)
Mutual labels:  graphql
Nestjs Example
NestJS example with GraphQL, Schema-Stitching, Dataloader, GraphQL Upload, RabbitMQ, Redis, Scalable Websocket and JWT authentication
Stars: ✭ 111 (-0.89%)
Mutual labels:  graphql
Persianjsonplaceholder
Persian fake REST/GraphQL API for testing and prototyping.
Stars: ✭ 110 (-1.79%)
Mutual labels:  graphql
Apollo Link
🔗 Interface for fetching and modifying control flow of GraphQL requests
Stars: ✭ 1,434 (+1180.36%)
Mutual labels:  graphql
Hypergraphql
GraphQL interface for querying and serving linked data on the Web.
Stars: ✭ 112 (+0%)
Mutual labels:  graphql
Pragma
Build GraphQL APIs In No Time
Stars: ✭ 111 (-0.89%)
Mutual labels:  graphql
Next
Directus is a real-time API and App dashboard for managing SQL database content. 🐰
Stars: ✭ 111 (-0.89%)
Mutual labels:  graphql
Graphql Fhir
A secure GraphQL implementation for the HL7 FHIR specification based on the current implementation guide for GraphQL with FHIR and developed with Node.js and Express.
Stars: ✭ 110 (-1.79%)
Mutual labels:  graphql
Typical
Typical: Fast, simple, & correct data-validation using Python 3 typing.
Stars: ✭ 111 (-0.89%)
Mutual labels:  validation
Json Serverless
Transform a JSON file into a serverless REST API in AWS cloud
Stars: ✭ 108 (-3.57%)
Mutual labels:  graphql
Kubeiql
A GraphQL interface for Kubernetes.
Stars: ✭ 112 (+0%)
Mutual labels:  graphql
Action policy Graphql
Action Policy integration for GraphQL
Stars: ✭ 110 (-1.79%)
Mutual labels:  graphql
Qlens
QLens is an electron app which dynamically generates GraphQL Schemas and Mongo Schema visualization. QLens significantly cuts development time by automating the formation of their GraphQL schemas based on information fetched from their non-relational database.
Stars: ✭ 110 (-1.79%)
Mutual labels:  graphql
Inapppy
Python In-app purchase validator for Apple AppStore and GooglePlay.
Stars: ✭ 110 (-1.79%)
Mutual labels:  validation

Absinthe Error Payloads

I have not had the time to keep this library up to date. There's a great fork of this that is maintained - so I recommend you check it out instead! https://github.com/mirego/absinthe-error-payload

Thanks Mirego!

Kronky

Kronky 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.

I recommend reading Validation and User Errors in GraphQL Mutations for more discussion on this. The excellent people behind Absinthe also approve this style from what I've seen in their slack.

Installation

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

def deps do
  [{:kronky, "~> 0.5.0"}]
end

Usage

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

Here's a quick summary of what Kronky includes

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

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

Kronky.Payload is middleware that takes your resolver output (either an updated object or a changeset with errors) and converts it into a Kronky 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 Kronky.TestHelper has some helper methods that make it easier to write ExUnit tests against your schema.

Caveats

Kronky does not currently support nested changesets/graphql objects. It'll probably die horribly if you try. If you need this feature, Kronky may not be for you.

Kronky is very very tightly coupled to Ecto internals, which is probably not a good thing. Any change in how Ecto.Changeset stores/returns validation errors will likely break Kronky until I can update. Use with caution!

Roadmap

  • Handle Nested Changesets/Objects
  • investigate identifying validations through Ecto.Changeset.validations instead of matching on specific error texts.
  • add tests for constraint validations (mock db?)

If you find any issues, or have suggestions for improvements, please open an issue. PRs welcome. :)

Ethelo

Kronky is maintained and funded by Ethelo. Ethelo focuses collective wisdom to find smart, practical and well-supported solutions to tough challenges. Learn about our corporate offerings at http://ethelo.com/, and our social change efforts at http://ethelo.org/.

Why Kronky?

Kronk translating Squirrel

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].