by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 20:29
    elauffenburger commented #592
  • Jan 31 2019 19:33
    bugged84 opened #1004
  • Jan 31 2019 19:24
    bugged84 edited #1003
  • Jan 31 2019 02:29
    joemcbride closed #1003
  • Jan 31 2019 02:29
    joemcbride commented #1003
  • Jan 31 2019 02:23
    bugged84 opened #1003
  • Jan 30 2019 20:04
    KoditkarVedant commented #160
  • Jan 30 2019 13:20
    sungam3r opened #1002
  • Jan 28 2019 22:35
    KoditkarVedant commented #980
  • Jan 28 2019 22:31
    KoditkarVedant synchronize #980
  • Jan 28 2019 20:57
    joemcbride labeled #1001
  • Jan 28 2019 20:57
    joemcbride commented #1001
  • Jan 28 2019 20:50
    sungam3r opened #1001
  • Jan 28 2019 17:32
    joemcbride commented #980
  • Jan 28 2019 17:28
    joemcbride commented #998
  • Jan 28 2019 17:27
    joemcbride commented #998
  • Jan 28 2019 17:27
    joemcbride commented #998
  • Jan 27 2019 20:46
    KoditkarVedant edited #1000
  • Jan 27 2019 20:45
    KoditkarVedant commented #1000
  • Jan 27 2019 20:43
    KoditkarVedant synchronize #1000
Soheil Pourbafrani
@ahoora08
Hi all,
I was wondering is it possible to simulate ALL command in SQL for Graphql, like
SELECT m_id FROM ids WHERE c_id = ALL (1, 2, 3 )
Robert Andersson
@inputfalken
Hi, I was wondering if there's any release date set for version 3.0. According to the roadmap it was supposed to be released 5 days ago.
Joe McBride
@joemcbride
@inputfalken Working on getting it released today ...
Joe McBride
@joemcbride
@inputfalken These have been released to Nuget.org. Working on getting the latest documentation published.
Joe McBride
@joemcbride
Robert Andersson
@inputfalken
Wonderful! šŸ‘
Sebastian Stehle
@SebastianStehle
Hi, How can I use a list as input type?
Joe McBride
@joemcbride
@SebastianStehle Wrap the argument in the list syntax.
new QueryArgument<ListGraphType<IdGraphType>> { Name = "ids" }
In Schema First:
type Query {
    droids(ids: [ID!]): [Droid!]
}
Sebastian Stehle
@SebastianStehle
Sorry, for the missing details, I have a InputObjectGraphType, but when I add a field with ListGraphType I get an exception, that output type cannot be used
Joe McBride
@joemcbride
So you have something like the following?
public class InputDroidType : InputObjectGraphType
{
  public InputDroidType()
  {
    Field<NonNullGraphType<IdGraphType>>("id");
    Field<StringGraphType>("name");
  }
}

new QueryArgument<ListGraphType<InputDroidType>> { Name = "droids" }
Sebastian Stehle
@SebastianStehle
no, more flike
public class InputDroidType : InputObjectGraphType
{
  public InputDroidType()
  {
    Field<NonNullGraphType<IdGraphType>>("id");
    Field<ListGraphType<StringGraphType>>("weapons");
  }
}
Joe McBride
@joemcbride
That should work, as long as all of the types in InputDroidType are input types.
Sebastian Stehle
@SebastianStehle
Yes, but ListGraphType is not an input type
Joe McBride
@joemcbride
No, but that should be ignored. Could be a bug that was introduced.
Sebastian Stehle
@SebastianStehle
it is not ;)
Joe McBride
@joemcbride
What is the exact error you are getting?
Sebastian Stehle
@SebastianStehle
System.ArgumentOutOfRangeException: 'Input type 'MySchemaDataMyArrayInputDto' can have fields only of input types: ScalarGraphType, EnumerationGraphType or IInputObjectGraphType. Field 'iv' has an output type. (Parameter 'fieldType')'
damn, sorry...it was my mistake, I have used the wrong type for the list item type
Joe McBride
@joemcbride
Okay good, had me a bit worried there :sweat_smile:
Sebastian Stehle
@SebastianStehle

I think it depends how I construct my types

ListGraphType<NonNullGraphType<StringGraphType>>

vs

new ListGraphType(new NonNullGraphType(new StringGraphType()))

the first approach does not work
Because it uses the ResolvedType and not the Type to check that
Joe McBride
@joemcbride
Indeed, that does seem like a problem. Would you mind posting an issue on the project?
Sebastian Stehle
@SebastianStehle

will do it later
but I have another question first. I have a very old issue: graphql-dotnet/graphql-dotnet#684 that is now closed

The question was whether we can map names

lets assume we have a non-trivial mapping

GraphQLName   |  C# Name
------------------------------------------
fooBar                    | foo_bar
hello                        | hello123

by looking at one side of the table we cannot calculate the other side

the answer was: use INameConverter, but I don't see how the interface would help. Because it only converts from C# to GraphQL
Joe McBride
@joemcbride
Iā€™m not super familiar with what was added, but it looks like a new features was added to the value converters, which allow you to convert from GraphQL names to C#. So the GraphQL request would be coming in with fooBar and you could convert it to foo_bar.
public class SomeInputGraphType : InputObjectGraphType
{
  public SomeInputGraphType()
  {
    Field<StringGraphType>("fooBar");
  }
}

ValueConverter.Register(v => new BarBar { foo_bar = (string)v["fooBar"] });

Field<SomeType>(
    "droid",
        arguments: new QueryArguments(
        new QueryArgument<SomeInputGraphType> { Name = "input" }
    ),
    resolve: context =>
    {
        // get argument will do the conversion
        var barBar = context.GetArgument<BarBar>("input");
    }
);
Milos Balaban
@84k1
Hi! When can we expect documentation for 3.0 ? Is it planned for any time soon( next week ) ?
Joe McBride
@joemcbride
@84k1 The documentation site is updated with the latest for 3.0, in particular see the v2 -> v3 migration guide. https://graphql-dotnet.github.io/docs/guides/migration3
Sebastian Stehle
@SebastianStehle
Hi, is the DocumentExecuter thread safe? Can it be used across multiple schemas?
Robert Andersson
@inputfalken

Hi, I'm wondering if there's a way to remove a field from a type based on InputObjectGraphType.

We want to be able to reuse types based on InputObjectGraphType by inheriting from our own types but remove fields depending on what's available in different contexts.

The way I know is very ugly but hopefully, there's a much simpler way than this example.

        public class CatSearchInputGraphType: AnimalSearchInputGraphType
{
            public CatSearchInputGraphType()
            {
                if (
                    Fields.FirstOrDefault(z =>
                            z.Name ==  "type")
                        is {} field
                    && Fields as List<FieldType>
                        is {} fields
                )
                {
                    fields.Remove(field);
                }
            }
        }
MrSlim
@ondraslim

Hello,

I am trying to prepare a sample project on GraphQL in dotnet and plan to present the technology to some of my colleagues. I planned to start from basics and add up more features and complexity to it. However, I am having trouble setting up subscriptions. I manage to connect and listen, but I do not get any notifications. I plan to demonstrate the feature through GraphQL Playground which should be able to handle the subscriptions.

I tried to reproduce subscriptions according to the .NET Boxed Template. I prepared AnimalSubsciptions.cs and adjusted AnimalDataStore to have IObservable collection adjusted Startup.cs methods - link to my repo with subscriptions. Everything necessary should be in RigantiGraphQlDemo.Api project, the client one was for my tests. Do you have any idea, what's wrong?

(I feel like it is better to share a link than copying all of the things I did for subscriptions as it would make the post a bit too big IMHO. Or would you prefer me copying the code here?) .

Thank you in advance.

MrSlim
@ondraslim
Nevermind, I figured it out :) Singleton vs Scoped lifetime was the issue
Aaron Edwards
@aaronjedwards
How can I customize the serialization for DateTimeOffsetGraphType in 3.0 when using System.Text.Json?
This is something i've stumbled on a few times now across different versions so it would be helpful to have in the documentation somewhere.
Joe McBride
@joemcbride

@aaronjedwards you will need to add a converter to the JSON options. You can pass the options you need, or modify them, by using a ctor of the DocumentWriter.

https://github.com/graphql-dotnet/graphql-dotnet/blob/b200fc47423bbabfb9f11233b9defc2803aac009/src/GraphQL.SystemTextJson/DocumentWriter.cs#L63

See this for how to write a converter:

https://stackoverflow.com/a/58103218

Mark McGookin
@markmcgookin
Hi folks, just a quick question. Is it possible to disable the tracing output in GQL queries?
image.png
Joe McBride
@joemcbride
@markmcgookin Yes - are you using the Server project? If so, then set options.EnableMetrics to false.
.AddGraphQL((options, provider) =>
        {
            options.EnableMetrics = Environment.IsDevelopment();
            var logger = provider.GetRequiredService<ILogger<Startup>>();
            options.UnhandledExceptionDelegate = ctx => logger.LogError("{Error} occured", ctx.OriginalException.Message);
        })
srs6814
@srs6814

Hello everyone,

@joemcbride First of all thank you so much for this library.
I am migrating from 2.4 to 3.0 for my company

While on the Startup.cs, while calling AddGraphql

' services.AddGraphQL(options =>
{
//options.EnableMetrics = true;
options.ExposeExceptions = CurrentEnvironment.IsDevelopment();
options.SetFieldMiddleware = false;
options.EnableMetrics = true;
});'

I am getting an error which is
System.TypeLoadException: 'Could not load type 'GraphQL.Http.IDocumentWriter' from assembly 'GraphQL, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null'.'

Any help would be greatly appreciated.

I saw a related question on stack-overflow
https://stackoverflow.com/questions/63079557/could-not-load-type-graphql-http-idocumentwriter-from-assembly-graphql-versi

srs6814
@srs6814
Looks like its the System.Text.Json change
Apologies for such a stupid question but still trying to figure out.
Joe McBride
@joemcbride
@srs6814 indeed it is. The implementation of IDocumentWriter is now located in the json specific libraries, with the interface at GraphQL.IDocumentWriter. See the upgrade docs: https://graphql-dotnet.github.io/docs/guides/migration3#json-parsing-and-serialization
srs6814
@srs6814
@joemcbride Thank you so much.
Joe McBride
@joemcbride
np, also answered that stack-overflow question with more details
madsrode
@madsrode
Hi all.
I'm wondering if there is any way to have multiple schemas (schema first, FederatedSchema.For()) on multiple endpoints.
With model first it would be like app.UseGraphQL<SchemaX>("/graphql/x"), but with FederatedSchema.For() it returns a ISchema so can't separate it by that. Anything I have missed?