Vizgql.Console 0.0.5

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global Vizgql.Console --version 0.0.5
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local Vizgql.Console --version 0.0.5
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Vizgql.Console&version=0.0.5
nuke :add-package Vizgql.Console --version 0.0.5

Goals

The goal of this project is to have a tool for vizualizing and testing authorization for GraphQL schemas. It is not always clear and easy to vizualize how authorization constraints (roles/policies) are applied fields. This projects aims to give you tools to automatically test this, and genrate vizualisations.

Vizgql.Core

This package contains the logic for parsing and finding validation errors for schemas.

Installation

dotnet add package Vizgql.Core

In unit tests

We can assert validation of a schema with the SchemaAuthorization class. It exposes AssertValidate which validates the schema sdl. You can configure some of it behaviour by also passing a ValidationOptions object. AssertValidate will throw exceptions if the schema fails some validation check. The package is not specific to any testing framework.

Example test

[Test]
public void ExampleTest()
{
    SchemaAuthorization.AssertValidate(
                sdlSchema,
                new ValidationOptions(AllowFieldWithoutAuthorization: true)
            );
}

Other

You can use the Validate method to find all warnings for the schema.

ValidationOptions

public sealed record ValidationOptions(
    bool AllowRootTypeWithoutAuthorization = false,
    bool AllowRootTypeEmptyAuthorize = true,
    bool AllowFieldWithoutAuthorization = false
);

AllowRootTypeWithoutAuthorization

If this is enabled, validation will pass for missing @authorize directive on root types such as Query and Mutation.

AllowRootTypeEmptyAuthorize

If enabled validation will pass for missing constraints such as roles/policies on root types such as Query and Mutation.

AllowFieldWithoutAuthorization

If enabled validation will pass for missing @authorize directive on fields.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
0.0.8 96 4/25/2024
0.0.7 281 1/12/2024
0.0.6 177 1/9/2024
0.0.5 223 11/10/2023
0.0.3 214 10/10/2023
0.0.2 153 9/19/2023

Test release