dotnet-sdlexport 0.0.24

dotnet tool install --global dotnet-sdlexport --version 0.0.24                
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.24                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=dotnet-sdlexport&version=0.0.24                
nuke :add-package dotnet-sdlexport --version 0.0.24                

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 376 4/24/2023
0.0.23 228 4/21/2023
0.0.22 266 3/7/2023
0.0.21 261 3/7/2023
0.0.20 356 12/2/2022
0.0.19 519 2/17/2022
0.0.18 380 8/2/2021
0.0.17 373 4/28/2021
0.0.16 344 4/22/2021
0.0.15 356 4/20/2021
0.0.14 366 4/15/2021
0.0.13 373 3/25/2021
0.0.12 335 3/16/2021
0.0.11 506 10/25/2020
0.0.10 443 10/21/2020
0.0.9 407 10/21/2020
0.0.8 401 9/10/2020
0.0.7 466 7/24/2020
0.0.6 451 7/6/2020
0.0.5 457 4/23/2020
0.0.4 473 3/20/2020
0.0.3 464 2/4/2020
0.0.2 664 12/28/2019
0.0.1 625 12/28/2019