Giter VIP home page Giter VIP logo

Comments (19)

nozzlegear avatar nozzlegear commented on August 24, 2024 1

from shopifysharp.

clement911 avatar clement911 commented on August 24, 2024 1

I fixed another small bug and queued a new release to be reviewed.
https://github.com/nozzlegear/ShopifySharp/actions/runs/6413991536

from shopifysharp.

clement911 avatar clement911 commented on August 24, 2024

Speaking of, I think you had used some new c# feature in your recent commit 1f1ccd1 , which broke the build.

I also would like to use these new features 😀

from shopifysharp.

nozzlegear avatar nozzlegear commented on August 24, 2024

from shopifysharp.

clement911 avatar clement911 commented on August 24, 2024

I don't have a ton of experience in that area either.
Is there a way to see the percentage of nuget installs that targets .Net framework?

The change I have is similar in spirit to what Chili Cream would get you (if I understand Chili Cream).
It's just a few lines of code to query the graphl model via introspections and generate POCO classes.

from shopifysharp.

nozzlegear avatar nozzlegear commented on August 24, 2024

from shopifysharp.

clement911 avatar clement911 commented on August 24, 2024

FYI This is what the generated schema file looks like: https://github.com/Wish-Org/Wish.GraphQLSchemaGenerator/blob/main/Wish.GraphQLSchemaGenerator.Tests/shopify.cs

It makes it much easier to query grapqhl.

It's worth noting that the generated schema uses System.Text.Json and not Newtonsoft.

I've already updated ShopifySharp to be able to use System.Text.Json when using the GraphService.

However, we cannot include the generated shopify.cs above in ShopifySharp because it contains .NET 6 features such as System.DateOnly and interface default implementations 😢

from shopifysharp.

clement911 avatar clement911 commented on August 24, 2024

I think I figured it out 🙂

I've added a target framework for .net6.0 specifically and added a pre-compile directive to only include the generated GraphQL types for .net6 or greater.

<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>

https://github.com/nozzlegear/ShopifySharp/blob/d139d780d572e06e68bc415a2cfdcb99e1e45aff/ShopifySharp/Entities/GraphQL/GraphQLSchema.generated.cs#L1

Here is an example on how to use the generated graphql types to query grapqhl with strongly typed objects:

var res = await new GraphService(Utils.MyShopifyUrl, Utils.AccessToken).Post2Async(@"
{
orders(first:10)
{
nodes
{
id
createdAt
name
phone
lineItems(first: 10)
{
nodes
{
title
quantity
}
}
}
}
}
");
var orders = res.GetProperty("orders").Deserialize<OrderConnection>();
Assert.True(orders.nodes.Length > 0);
var o = orders.nodes[0];
Assert.True(o.name != null);
Assert.True(o.lineItems.nodes.First().quantity != null);

from shopifysharp.

clement911 avatar clement911 commented on August 24, 2024

I'm going to leave open though, as using pre-compile directive is not great.

from shopifysharp.

clement911 avatar clement911 commented on August 24, 2024

@nozzlegear ready for you to approve: https://github.com/nozzlegear/ShopifySharp/actions/runs/6182839771

from shopifysharp.

clement911 avatar clement911 commented on August 24, 2024

@nozzlegear I know I made a few important changes. Let me know if you have any concern.

from shopifysharp.

nozzlegear avatar nozzlegear commented on August 24, 2024

from shopifysharp.

clement911 avatar clement911 commented on August 24, 2024

Haha no worries. Thanks 👍

from shopifysharp.

clement911 avatar clement911 commented on August 24, 2024

No problem. There is no rush by the way so take your time

from shopifysharp.

clement911 avatar clement911 commented on August 24, 2024

@nozzlegear seems like you got busy.
Any chance you could review the pending release deployment?

from shopifysharp.

nozzlegear avatar nozzlegear commented on August 24, 2024

from shopifysharp.

clement911 avatar clement911 commented on August 24, 2024

I needed the latest lib so I've just pulled the pre-release nuget package.
It's in production already. No issues so far.

from shopifysharp.

nozzlegear avatar nozzlegear commented on August 24, 2024

from shopifysharp.

nozzlegear avatar nozzlegear commented on August 24, 2024

I'm going to close this for now I think. I'm not sure what (if anything) has changed, but we're now able to use C# 12 in the project records, file-scoped namespaces, and #nullable enable which previously wasn't available to netstandard2.0. It all builds just fine with no warnings, and the automated tests I have for .NET Framework 4.7.2 have no problems either.

The only thing that I've tried to use which I wasn't able to was System.Buffers (needs .NET 7.0 or greater) and the required keyword (needs .NET 8.0). I'm happy with using the preprocessor directives to add those as little "nice to have enhancements" for people using .NET 7/8, like I did with the ShopifyRequestValidationUtility.

from shopifysharp.

Related Issues (20)

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.