dotnet-sdlexport 0.0.23

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global dotnet-sdlexport --version 0.0.23                
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 dotnet-sdlexport --version 0.0.23                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=dotnet-sdlexport&version=0.0.23                
nuke :add-package dotnet-sdlexport --version 0.0.23                

graphql-sdl-exporter

<a href="https://www.buymeacoffee.com/sungam3r" target="_blank"><img src="https://bmc-cdn.nyc3.digitaloceanspaces.com/BMC-button-images/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>

License

codecov Nuget NuGet

GitHub Release Date GitHub commits since latest release (by date) Size

GitHub contributors Activity Activity Activity

Run unit tests Publish preview to GitHub registry Publish release to Nuget registry CodeQL analysis

.NET Core Global Tool for generating SDL from url or executable file.

Installation

You can install the latest version via NuGet.

> dotnet tool install -g dotnet-sdlexport

Command Line Options

Just type

> sdlexport

to see all available options. See CommandLineOptions for more information.

What is it ?

This tool generates a text SDL (Schema Definition Language) file from the given URL or path to the executable ASP.NET Core assembly. In the case of using URL, the tool immediately sends introspection request to that URL. If the path to the file is specified as the source, then the tool starts the temporary process and stops it after receiving the introspection response. The tool will be able to send requests only when it starts the process on the URL it knows. This parameter is passed through the --url command line switch and has default value http://localhost:8088. This parameter is then passed as the --server.urls command line switch to the process being launched.

It should be noted that with this method, the service should not (although it may) perform any side work at startup, such as contacting external systems, databases, etc. as this may slow down the process of obtaining the schema. The tool passes API_ONLY_RESTRICTED_ENVIRONMENT command line key to the process being launched. By the presence of this key, it is possible to disable the execution of code that is not required to obtain a schema:

public static Task Main(string[] args) => CreateBuilder(args)
    .Build()
    .RunAsync();

private static IWebHostBuilder CreateBuilder(string[] args)
    => args.Contains("API_ONLY_RESTRICTED_ENVIRONMENT")
    ? WebHost.CreateDefaultBuilder<StartupApiOnly>(args)
    : WebHost.CreateDefaultBuilder<Startup>(args);

Why do I need it ?

SDL is easier to work with than with raw JSON introspection response. SDL is easier to read and understand. SDL is also much more compact in comparison with raw JSON - in this case it's easier to track changes. SDL file, like any code file, can be stored as an artifact in the version control system and act as a service public API.

Experimental features

The tool can get information about directives if the server supports this feature. If the server does not support directive return (in this case server returns a request validation error), then the tool uses the classic introspection request. The official specification does not describe such a possibility, although discussions are underway to expand the specification to add this feature.

Usage

  1. GitHub GraphQL API v4 [Generated SDL]
sdlexport --source https://api.github.com/graphql --auth bearer|<YOUR_TOKEN> --out samples/github.graphql
  1. SWAPI - A GraphQL schema and server wrapping Star Wars API. [Generated SDL]
sdlexport --source https://swapi-graphql.netlify.com/.netlify/functions/index --out samples/swapi.graphql
  1. HIVDB - A curated database to represent, store and analyze HIV drug resistance data. [Generated SDL]
sdlexport --source https://hivdb.stanford.edu/graphql --out samples/hivdb.graphql
  1. Countries - Information about countries, continents, and languages, based on Countries List. [Generated SDL]
sdlexport --source https://countries.trevorblades.com --out samples/countries.graphql
  1. You can export the schema directly from your published ASP.NET Core app
> sdlexport --source C:\MyWebHost.dll --out samples/myschema.graphql

To see the full list of available options:

> sdlexport

See also

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  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. 
.NET Core netcoreapp3.1 is compatible. 
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.24 364 4/24/2023
0.0.23 223 4/21/2023
0.0.22 261 3/7/2023
0.0.21 256 3/7/2023
0.0.20 351 12/2/2022
0.0.19 512 2/17/2022
0.0.18 373 8/2/2021
0.0.17 368 4/28/2021
0.0.16 337 4/22/2021
0.0.15 349 4/20/2021
0.0.14 359 4/15/2021
0.0.13 366 3/25/2021
0.0.12 328 3/16/2021
0.0.11 499 10/25/2020
0.0.10 436 10/21/2020
0.0.9 400 10/21/2020
0.0.8 393 9/10/2020
0.0.7 459 7/24/2020
0.0.6 444 7/6/2020
0.0.5 450 4/23/2020
0.0.4 466 3/20/2020
0.0.3 457 2/4/2020
0.0.2 657 12/28/2019
0.0.1 618 12/28/2019