OasReader 3.7.0.20

dotnet add package OasReader --version 3.7.0.20
 
NuGet\Install-Package OasReader -Version 3.7.0.20
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OasReader" Version="3.7.0.20" />
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OasReader" Version="3.7.0.20" />
 
Directory.Packages.props
<PackageReference Include="OasReader" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add OasReader --version 3.7.0.20
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: OasReader, 3.7.0.20"
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package OasReader@3.7.0.20
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=OasReader&version=3.7.0.20
 
Install as a Cake Addin
#tool nuget:?package=OasReader&version=3.7.0.20
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Build NuGet Quality Gate Status codecov

Multi Document Reader for OpenAPI.NET

An OpenAPI reader that merges external references into a single document using the Microsoft OpenAPI toolset.

This is based on the work done by Jan Kokenberg and contains source code from the dotnet-openapi-merger CLI tool

Usage

The class OpenApiMultiFileReader is used to load an OpenAPI specifications document file locally or remotely using a YAML or JSON file. OpenApiMultiFileReader will automatically merge external references if the OAS file uses them.

Local Files: External references must be in the same folder as the main OAS file or in subdirectories.

Remote Files: When loading OAS files remotely, external references can be:

  • Absolute URLs: https://example.com/components.yaml#/components/schemas/Pet
  • Relative URLs: components.yaml#/components/schemas/Pet (resolved relative to the main file's URL)
ReadResult result = await OpenApiMultiFileReader.Read("petstore.yaml");
OpenApiDocument document = result.OpenApiDocument;

Example with Local External References

In the example below, we have OpenAPI specifications that are split into multiple documents. petstore.yaml contains the paths and petstore.components.yaml contain the components/schemas

petstore.yaml

openapi: 3.0.3
paths:
 /pet:
 post:
 tags:
 - pet
 summary: Add a new pet to the store
 description: Add a new pet to the store
 operationId: addPet
 requestBody:
 description: Create a new pet in the store
 content:
 application/json:
 schema:
 $ref: 'petstore.components.yaml#/components/schemas/Pet' 
 required: true
 responses:
 "200":
 description: Successful operation
 content:
 application/json:
 schema:
 $ref: 'petstore.components.yaml#/components/schemas/Pet'

Example with Remote External References

You can also use remote external references with absolute URLs:

openapi: 3.0.3
paths:
 /pet:
 post:
 tags:
 - pet
 summary: Add a new pet to the store
 description: Add a new pet to the store
 operationId: addPet
 requestBody:
 description: Create a new pet in the store
 content:
 application/json:
 schema:
 $ref: 'https://example.com/openapi/components.yaml#/components/schemas/Pet' 
 required: true
 responses:
 "200":
 description: Successful operation
 content:
 application/json:
 schema:
 $ref: 'https://example.com/openapi/components.yaml#/components/schemas/Pet'

Or with relative URLs when the main file is also remote:

openapi: 3.0.3
paths:
 /pet:
 post:
 requestBody:
 content:
 application/json:
 schema:
 $ref: 'components.yaml#/components/schemas/Pet' # Resolved relative to main file's URL

petstore.components.yaml

openapi: 3.0.3
components:
 schemas:
 Pet:
 required:
 - name
 - photoUrls
 type: object
 properties:
 id:
 type: integer
 format: int64
 example: 10
 name:
 type: string
 example: doggie
 category:
 $ref: '#/components/schemas/Category'
 photoUrls:
 type: array
 xml:
 wrapped: true
 items:
 type: string
 xml:
 name: photoUrl
 tags:
 type: array
 xml:
 wrapped: true
 items:
 $ref: '#/components/schemas/Tag'
 status:
 type: string
 description: pet status in the store
 enum:
 - available
 - pending
 - sold
 Category:
 type: object
 properties:
 id:
 type: integer
 format: int64
 example: 1
 name:
 type: string
 example: Dogs
 xml:
 name: category

For tips and tricks on software development, check out my blog

If you find this useful and feel a bit generous then feel free to buy me a coffee ☕

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed.
.NET Core netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed.
.NET Standard netstandard2.0 is compatible. netstandard2.1 was computed.
.NET Framework net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed.
MonoAndroid monoandroid was computed.
MonoMac monomac was computed.
MonoTouch monotouch was computed.
Tizen tizen40 was computed. tizen60 was computed.
Xamarin.iOS xamarinios was computed.
Xamarin.Mac xamarinmac was computed.
Xamarin.TVOS xamarintvos was computed.
Xamarin.WatchOS xamarinwatchos was computed.
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on OasReader:

Package Downloads
Refitter.Core

Core library used by the Refitter CLI tool for generating a C# REST API Client using the Refit library.

HttpGenerator.Core

Core library used by the HttpGenerator CLI tool for generating .http files for the popular REST Client IDE extension.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on OasReader:

Repository Stars
christianhelle/refitter
A tool for generating Refit interfaces and contracts from OpenAPI (Swagger) specifications
Version Downloads Last Updated
3.7.0.20 83 7/2/2026
3.5.0.19 6,505 3/21/2026
3.4.0.18 447 3/6/2026
3.3.1.17 754 2/23/2026
1.6.16.16 179,623 12/10/2024
1.6.16.15 96,108 7/30/2024
1.6.11.14 1,081,343 1/7/2024
1.6.11.13 257 1/7/2024
1.6.11.12 2,506 1/6/2024
1.6.11.11 448 1/6/2024
1.6.11.10 221 1/6/2024
1.6.11.9 250 1/6/2024
1.6.11.8 473 1/5/2024
1.6.11.7 406 1/4/2024
1.6.11.6 248 1/4/2024
1.6.11.5 253 1/4/2024
1.6.11.4 251 1/4/2024
1.6.11.3 243 1/3/2024
1.6.11.2 242 1/3/2024
0.1.0.1-preview 215 1/3/2024