You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The **OpenAPI.NET** SDK contains a useful object model for OpenAPI documents in .NET along with common serializers to extract raw OpenAPI JSON and YAML documents from the model.
14
13
15
14
**See more information on the OpenAPI specification and its history here: <ahref="https://www.openapis.org">OpenAPI Initiative</a>**
@@ -19,23 +18,14 @@ Project Objectives:
19
18
- Provide a single shared object model in .NET for OpenAPI descriptions.
20
19
- Include the most primitive Reader for ingesting OpenAPI JSON and YAML documents in both V2 and V3 formats.
21
20
- Provide OpenAPI description writers for both V2 and V3 specification formats.
22
-
- Enable developers to create Readers that translate different data formats into OpenAPI descriptions.
21
+
- Enable developers to create Readers that translate different data formats into OpenAPI descriptions.
> Note: version 2 of this library, which brings support for OpenAPI 3.1, is currently in preview. Due to early versioning issues with the preview, and package renaming, the installation must be done with a specific version number to get the latest version:
> Until this new version is generally available, dependabot will periodically create pull requests which **downgrade** to preview 9, they should be ignored.
> Note: we just released a new major version of the library, which brings support for OpenAPI 3.1!
39
29
> You can read more about the changes of this upcoming version [in the upgrade guide](./docs/upgrade-guide-2.md).
40
30
41
31
# Processors
@@ -89,19 +79,10 @@ var document = new OpenApiDocument
89
79
Reading and writing an OpenAPI description
90
80
91
81
```C#
92
-
var httpClient = new HttpClient
93
-
{
94
-
BaseAddress = new Uri("https://raw.githubusercontent.com/OAI/OpenAPI-Specification/")
95
-
};
96
-
97
-
var stream = await httpClient.GetStreamAsync("main/examples/v3.0/petstore.yaml");
98
-
99
-
// Read V3 as YAML
100
-
var openApiDocument = new OpenApiStreamReader().Read(stream, out var diagnostic);
82
+
var (openApiDocument, _) =awaitOpenApiDocument.LoadAsync("https://raw.githubusercontent.com/OAI/OpenAPI-Specification/refs/heads/main/_archive_/schemas/v3.0/pass/petstore.yaml");
101
83
102
84
// Write V2 as JSON
103
-
var outputString = openApiDocument.Serialize(OpenApiSpecVersion.OpenApi2_0, OpenApiConstants.Json);
0 commit comments