Socket
Book a DemoInstallSign in
Socket

GraphQL.Query.Builder.Formatter.SystemTextJson

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

GraphQL.Query.Builder.Formatter.SystemTextJson

A property name formatter for GraphQL.Query.Builder based on Newtonsoft.Json.

nugetNuGet
Version
1.0.3
Version published
Maintainers
1
Created
Source

System.Text.Json Formatter for GraphQL Query Builder

logo

A System.Text.Json property name formatter for GraphQL.Query.Builder (>= 2.0.0).

This formatter returns the JsonPropertyNameAttribute value.

Build Status Coverage Nuget Downloads

Install

dotnet add package GraphQL.Query.Builder.Formatter.SystemTextJson

Usage

public class Human
{
    [JsonPropertyName("firstName")]
    public string? FirstName { get; set; }
    
    [JsonPropertyName("lastName")]
    public string? LastName { get; set; }
}

// Initialize the options
QueryOptions options = new()
{
    Formatter = SystemTextJsonPropertyNameFormatter.Format
};

// Create the query with the options
var query = new Query<Human>("humans", options)
    .AddArguments(new { id = "uE78f5hq" })
    .AddField(h => h.FirstName)
    .AddField(h => h.LastName);

Console.WriteLine("{" + query.Build() + "}");
// Output:
// {humans(id:"uE78f5hq"){firstName lastName}

Keywords

graphql

FAQs

Package last updated on 28 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts