Git Product home page Git Product logo

eklee-azure-functions-graphql's People

Contributors

rheid avatar seekdavidlee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

eklee-azure-functions-graphql's Issues

New Version 0.32. problems with nullable model variables

Hi David Lee, thank you very much for the update to the GraphQL version of .NET. I have started to switch to this version and have found a few problems. I am using two DateTimeOffice variables with null values. These are now throwing an exception in the new version.

`[Description("Ende of the Publication")]
public DateTimeOffset? PublishingDateStart { get; set; }
[Description("Start of the Publication")]

screen-2021-01-24-60358

public DateTimeOffset? PublishingDateEnd { get; set; } `

[2021-01-24T16:56:18.300Z] Executed 'graphql' (Failed, Id=b2f31492-ffaf-4f59-98a5-ad22064279b0, Duration=7153ms)
[2021-01-24T16:56:18.301Z] System.Private.CoreLib: Exception while executing function: graphql. Autofac: An exception was thrown while activating Eklee.Azure.Functions.GraphQl.ModelConventionType1[[System.Nullable1[[System.DateTimeOffset, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]. Autofac: An exception was thrown while invoking the constructor 'Void .ctor(Microsoft.Extensions.Logging.ILogger)' on type 'ModelConventionType1'. GraphQL: A type name must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but nullable1 does not. (Parameter 'name').

New Version 0.32. Query Model 'ModelConventionConnection' is already registered

Hi David Lee, thank you very much for the update to the GraphQL version of .NET. I have started to switch to this version and have found a few problems. I am using two Querys variables with optional values. These are now throwing an exception in the new version.

        queryBuilderFactory.Create<Event>(coreQuery, "GetEvent")
        .WithPaging()
        .WithParameterBuilder()
        .WithProperty(x => x.Audiences, true)
        .WithProperty(x => x.Language, true)
        .WithProperty(x => x.Navigation, true)
        .WithProperty(x => x.MainTopics, true)
        .WithProperty(x => x.Name, true)
        .WithProperty(x => x.DateStart, true)
        .WithProperty(x => x.Place,true)
        .WithProperty(x => x.Abstract, true)
        .WithProperty(x => x.Description,true)

        .BeginQuery<Event>()

        .BuildQueryResult(ctx =>
        {
            var query = ctx.GetQueryResults<Event>();
            ctx.SetResults(query.OrderByDescending(q => q.CreatedOn).ToList());
        })
        .BuildQuery()
        .BuildWithListResult();


        queryBuilderFactory.Create<Page>(coreQuery, "GetPage")
            .WithPaging()
            .WithParameterBuilder()
            .WithProperty(x => x.Audiences, true)
            .WithProperty(x => x.Language, true)
            .WithProperty(x => x.Navigation, true)
            .WithProperty(x => x.MainTopics, true)
            .WithProperty(x => x.Name, true)
            .WithProperty(x => x.CreatedOn, true)
            .BeginQuery<Page>()

            .BuildQueryResult(ctx =>
            {
                var query = ctx.GetQueryResults<Page>();
                ctx.SetResults(query.OrderByDescending(q => q.CreatedOn).ToList());
            })
            .BuildQuery()
            .BuildWithListResult();

2021-01-24T17:08:49.819Z] Executed 'graphql' (Failed, Id=02497ed2-43ed-44cb-86f5-949e83684772, Duration=17089ms)
[2021-01-24T17:08:49.821Z] System.Private.CoreLib: Exception while executing function: graphql. GraphQL: Unable to register GraphType 'GraphQL.Types.Relay.ConnectionType2[[Eklee.Azure.Functions.GraphQl.ModelConventionType1[[genesis.com.api.Models.Page, genesis.com.api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Eklee.Azure.Functions.GraphQl, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null],[GraphQL.Types.Relay.EdgeType1[[Eklee.Azure.Functions.GraphQl.ModelConventionType1[[genesis.com.api.Models.Page, genesis.com.api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Eklee.Azure.Functions.GraphQl, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], GraphQL, Version=3.3.1.0, Culture=neutral, PublicKeyToken=null]]' with the name 'ModelConventionConnection';
the name 'ModelConventionConnection' is already registered to 'GraphQL.Types.Relay.ConnectionType2[[Eklee.Azure.Functions.GraphQl.ModelConventionType1[[genesis.com.api.Models.Event, genesis.com.api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Eklee.Azure.Functions.GraphQl, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null],[GraphQL.Types.Relay.EdgeType1[[Eklee.Azure.Functions.GraphQl.ModelConventionType1[[genesis.com.api.Models.Event, genesis.com.api, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Eklee.Azure.Functions.GraphQl, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], GraphQL, Version=3.3.1.0, Culture=neutral, PublicKeyToken=null]]'.

problems with nullable query variables

Hi David Lee, thanks for the quick help in the other two points. i still have a small issue. we are using an apollo server with a UI framework in the frontend. Here it is so that an unused filter sets the variable to null or does not pass it. like this:

Do you have an idea how I can allow a query variable to be null and then ignore this filter?

{
    "after": "",
    "audiences": "100000005,100000004,100000008",
    "between": "2021-01-01T00:00:00,2021-07-31T24:00:00",
    "language": "1033",
    "maintopics": "-",
    "place": "On-site",
    "name": " ",
    "navigation": "-",
    "pageSize": 15
}
query ($navigation: String, $name: String, $maintopics: String, $audiences: String!,
 $language: String!, $pageSize: Int!, $after: String, $between: String, $place: String) {
  getEvent(
    navigation: {contains: $navigation}
    name: {contains: $name}
    place: {contains: $place}
    language: {contains: $language}
    audiences: {contains: $audiences}
    maintopics: {contains: $maintopics}
    first: $pageSize
    after: $after
    datestart: {contains: $between}
  ) {
    totalCount
    items {
      id
      name
      url
      editor
      navigation
      leadimageUrl
      audiences
      language
      createdOn
      mainTopics
      topic2NdValue
      topic3NdValue
      thumbnail
      abstract
      venue
      place
      fees
      dateStart
      dateEnd
      layoutContent
      __typename
    }
    pageInfo {
      startCursor
      endCursor
      hasNextPage
      hasPreviousPage
      __typename
    }
    __typename
  }
}

I the the following error if a query variable is null or not present.

{
    "data": {
        "getEvent": null
    },
    "errors": [
        {
            "message": "Error trying to resolve getEvent.",
            "locations": [
                {
                    "line": 3,
                    "column": 3
                }
            ],
            "path": [
                "getEvent"
            ],
            "extensions": {
                "code": "NULL_REFERENCE"
            }
        }
    ]
}

How can I use testing your code inside of Visual Studio

HI ENG-KEONG DAVID LEE,

thanks for writing such a great libary for Azure Functions. I am thinking about using it in a project. I would like to work with automatic tests after this example:

https://docs.microsoft.com/en-us/azure/azure-functions/functions-test-a-function

Unfortunately I cannot call GraphQLFunction.Run because the ExecutionContext is missing in the test case. Do you have an idea how to do this best with Azure V3? or should I rather use your client?
[Fact]
[ExecutionContextDependencyInjection(typeof(FunctionModule))]
public async void Http_trigger_should_return_known_string()
{
var request = TestFactoryPages.CreateHttpRequest("name", "Bill");
ExecutionContext ex = new ExecutionContext();

        var response = (OkObjectResult)await GraphQLFunction.Run(request, logger, **ex**);
        Assert.Equal("Hello, Bill", response.Value);

    }

How can I query with OR and AND

Hello ENG-KEONG DAVID, #

thanks for the nice software you developed. Is it possible to shorten two filters directly with an OR or AND. Like in this example, but I want to search for James and Jack.

Thanks for your help.

query {
getTestResultsByCandidateFirstNameAndTaken(firstname:
{
equal:"James"
}, taken:
{
greaterThan:"2019-07-01"
}){
id
correctAnswers
totalQuestions
location
candidate {
employee {
firstName
lastName
email
department
id
type
}
taken
id
}
}
}

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.