-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
OpenApiDocument
Rico Suter edited this page Oct 5, 2020
·
4 revisions
- Package: NSwag.Core
- Type: NSwag.OpenApiDocument
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.