GithubHelp home page GithubHelp logo

mrthearman / graphene-django-extensions Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 3.14 MB

Extensions for writing GraphQL schemas with the graphene-django library with less boilerplate.

Home Page: https://pypi.org/project/graphene-django-extensions/

License: MIT License

Makefile 0.59% Python 99.41%
extensions graphene graphene-django

graphene-django-extensions's Introduction

Graphene Django Extensions

Coverage Status GitHub Workflow Status PyPI GitHub GitHub Last Commit GitHub Issues Downloads Python Version

pip install graphene-django-extensions

Documentation: https://mrthearman.github.io/graphene-django-extensions/

Source Code: https://github.com/MrThearMan/graphene-django-extensions/

Contributing: https://github.com/MrThearMan/graphene-django-extensions/blob/main/CONTRIBUTING.md


Extensions for writing GraphQL schemas with the graphene-django library with less boilerplate.

The main features are:

  • A new ObjectType DjangoNode, which:

    • adds convenience methods for managing permissions for both the ObjectType and individual fields.
    • adds a hook for adding filtering to both single items and lists returned by the ObjectType.
    • adds convenience methods for creating Fields, ListFields, Nodes, and Connections for the ObjectType.
    • adds filterset filters automatically to ListFields created for the ObjectType.
    • automatically optimizes queries using graphene-django-query-optimizer.
  • A new MutationType DjangoMutation, which:

    • adds convenience methods for managing permissions.
    • adds create, update operation with serializers and delete operations with optional validation hook.
    • adds an option for custom model operations.
    • makes updates fully partial by default.
    • adds better error handling.
  • A new ModelSerializer NestingModelSerializer, which:

    • adds pre and post save handlers for creating or updating related entities from nested serializer fields, all within a single transaction to ensure atomicity.
    • adds better handling of constraint integrity errors by finding violation_error_message from the constraint.
    • adds get_or_default method for finding default values for field validation.
  • A new FilterSet ModelFilterSet, which:

    • changes the default filters for related fields to the custom IntChoiceFilter and IntMultipleChoiceFilter filters, which don't make database queries to check if the given primary keys for the filters actually correspond to existing rows for the database model.
    • adds a custom ordering filter automatically to all subclasses, with the default pk filter.
    • allows adding new ordering filters with the Meta.order_by attribute.
    • order_by fields are converted to enums for better autocompletion in GraphiQL.
    • allows combining multiple method filters with the Meta.combination_methods attribute.

graphene-django-extensions's People

Contributors

dependabot[bot] avatar matti-lamppu avatar mrthearman avatar pre-commit-ci[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

graphene-django-extensions's Issues

custom scalar with max length for input object type

I have read the docs thoroughly before making this feature request.

  • Yes

I have read through other open issues, and my issue is not a duplicate.

  • Yes

Description

What is the current behavior?

input that can not set max_length for them:

import graphene
class BaseCreateInput(graphene.InputObjectType):
      name = graphene.String(required=True)

What is the expected behavior?
input that can set max_lenght for them:

import graphene
class BaseCreateInput(graphene.InputObjectType):
      name = graphene.String(required=True,max_lenght =125)

Motivation

Main Problem That Solve with this Feature
In this senario unnecessary and invalid data will not send into database.

Would you like to solve this issue yourself with a pull request?

No

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.