Skip to content

OpenApiDocument

Rico Suter edited this page Oct 5, 2020 · 4 revisions

Class to describe an OpenAPI 3.0.0 or Swagger 2.0 specification. Head over to the official OpenAPI 3 specification for more information.

var url = "http://petstore.swagger.io/v2/swagger.json";
var document = await OpenApiDocument.FromUrlAsync(url);

To load a specification from a string use:

var specificationJson = "{ ... }";
var document = await OpenApiDocument.FromJsonAsync(specificationJson);

To convert a document to JSON, call ToJson():

var json = document.ToJson();

See also OpenAPI 3 support.