Giter Site home page Giter Site logo

michannne / graphql-core Goto Github PK

View Code? Open in Web Editor NEW
11.0 3.0 3.0 106 KB

A wrapper library for GraphQL.NET that provides additional features to ease enterprise integration

License: MIT License

C# 100.00%
graphql graphql-netcore graphql-core graphql-dotnet graphiql dotnet-core dotnet

graphql-core's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

michanne bubdm

graphql-core's Issues

Add support for all c# value-types and enum types

GenericType works for Model A, containing following member types:

  • Int
  • String
  • Float
  • Bool
  • Double
  • Long

But additional value types, such as char, decimal, byte etc, throw runtime error
Edit: Enum types also throw an error

Expected result
All C# value types are supported

Add support for Guid types

Creating a model such as the following:

    public class Book_WithValueTypes : Book
    {
        public Guid Identifier { get; set; }
        public char Category { get; set; }
        public decimal Dewey { get; set; }
        public byte OwnerCount { get; set; }
        public sbyte Modifier { get; set; }
        public short Value { get; set; }
        public uint Copies { get; set; }
        public ulong Pages { get; set; }
        public ushort AuthorCount { get; set; }
        public BookDescription Info { get; set; }
    }

fails to create Object node as Guid is not supported

Add unit tests for adding user-defined models

Full test coverage should be available for following features:

  • Adding User-defined Models
    • Models with value-types
    • Models with enum-types
    • Models with enumerable types
    • Models with user-defined types

Each test must check for:

  • Has a wrapper class been generated as a derived type of the GenericType instance of the user's model?
  • Can the instance of the GenericType be retrieved from the service provider using the wrapper class type?
  • Does the instance of the GenericType have fields? Do they correspond with the user model's fields?
  • Is the GenericType queryable after adding it (user can write query statements resolving to the user's model)?
  • Can other classes be built on top of the user-defined model? Are those classes resolving the property of the user-defined model correctly?

Update README to include reference of a GraphQLController

User has been confused about app not working
No documentation showing in GraphiQL and Intellisense not working in GraphiQL

Problem was that user did not have a GraphQLController to handle requests

Expected Outcome
User should know to add GraphQLController to add references
Readme should reference the need to add a GraphQLController to their project
(Maybe this can be simplified?)

Add github.io page

Users should be able to reference a centralized github.io page to read more documentation, see more examples of usage and installation, and tips for usage of the framework.

Make config argument optional

(config) argument of .AddGraphQL() should be optional
If user passes in a configuration, AddGraphQL() should return a null object and build the config passed in
Otherwise, it should return a new builder which can be extended

Simplify Query Argument Syntax

Is your feature request related to a problem? Please describe.
Current query arg syntax is unwiedly, and involves the use of an extension method to convert a C# type into a graph type. Yes, it should be up to the user to supply the correct graph-type, but there should be an easier way so user does not have to think too much of the type or conversions before passing it in.

Describe the solution you'd like
Something simple, and easy for the user without giving up their control of the type being passed, but without conversion, such as:

services.AddGraphQL()
.Query<Author>(
    () => new Query()
    {
        Expression = "author",
        Args = new ArgList() {
			["authorId"] = (long authorId) => {
				DefaultValue = 0,
				Description = "The Author to be searched"
			},
			["bookId"] = (long bookId) => {
				DefaultValue = 0,
				Description = "The Book to be searched"
			},
			["bookName"] = (string bookName) => {
				DefaultValue = null,
				Description = "The name of the Book to be searched"
			},
		},
        Resolver = (context) => authorRepo.GetAll().Where(a => a.AuthorId == (long)context.Arguments["authorId"])
    })
.Build()

Describe alternatives you've considered
Improving the conversion syntax may also be helpful, but the real solution I feel is change how the arguments are added, in GraphQL.NET is equally painful

Add support for cyclical types

Class A references Class B
Class B references Class A

This situation throws a 'Duplicate type class' from app

Expected Outcome
If Class A is already registered, it should not be throwing a duplicate type error. Instead, it should use GenericType in the field prop and pass without looping again over A's properties

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.