Releases: microsoft/OpenAPI.NET
2.0.0-preview2
Changes:
- #1914: Release hidi and libs
- #1913: Bump up libs and hidi versions
- #1894: feature/3.1.1
- #1823: feature/3 0 4
- #1912: chore(deps): bump Verify.Xunit from 28.0.0 to 28.2.0
- #1909: chore(deps): bump Microsoft.OData.Edm from 8.1.0 to 8.2.0
- #1910: chore(deps): bump FluentAssertions from 6.12.1 to 6.12.2
- #1908: Release hidi
- #1907: Bump hidi version
- #1906: V2-preview1 release
See More
- #1904: V2.0-preview1 release
- #1903: Sync latest vnext changes
- #1897: Define JSON schema's Type property as a flaggable enum to allow storing multiple values
- #1900: chore(deps): bump Verify.Xunit from 27.1.0 to 28.0.0
- #1888: Remove DataTypeMismatch validation rule from the default ruleset
- #1899: OpenApiSchema refactor to remove recursive keywords
- #1898: Release Hidi
- #1896: Bump up hidi and conversion lib versions
- #1890: Update workbench tool to parse 3.1 and YAML docs
- #1895: chore(deps): bump Verify.Xunit from 27.0.1 to 27.1.0
- #1892: docs: fixes doc comments to align with changes made in #1883
- #1883: fix: emits number for integer formats
- #1893: merge/vnext to release2
- #1886: use nameof for CallerArgumentExpression
- #1887: Simplify null/empty string checks
- #1885: Release Hidi lib.
- #1884: Bump, Release Hidi
- #1881: chore(deps): bump Microsoft.OData.Edm from 8.0.2 to 8.1.0
- #1882: chore(deps): bump Microsoft.OpenApi.OData from 2.0.0-preview.5 to 2.0.0-preview.6
- #1877: Bump Verify.Xunit from 26.6.0 to 27.0.1
- #1873: Released Hidi
- #1871: Bumps up conversion lib. and hidi versions
- #1870: ci: removes zengin since he doesn't have access to the repo anymore
- #1869: Bump Microsoft.OpenApi.OData from 2.0.0-preview.3 to 2.0.0-preview.4
- #1868: Bump Microsoft.Extensions.Logging.Debug from 8.0.0 to 8.0.1
- #1867: Bump Microsoft.Extensions.Logging.Console from 8.0.0 to 8.0.1
- #1866: Sync v2 branch with the latest changes in vnext
- #1865: Bump v2 lib versions to 2.0.0-preview1
- #1863: Bump Microsoft.Extensions.Logging and Microsoft.Extensions.Logging.Abstractions
- #1862: Bump System.Text.Json from 8.0.4 to 8.0.5
- #1864: Bump Microsoft.Windows.Compatibility from 8.0.8 to 8.0.10
- #1861: Sync vnext changes with the v2 branch
- #1809: Use ConcurrentDictionary For Improving GetEnumFromDisplayName
- #1857: Avoid buffering JSON data into a new MemoryStream during parsing
- #1856: Remove validation rule to make paths and webhooks optional
- #1860: Releases Hidi
- #1859: Bumps up Hidi version
- #1858: Bump Microsoft.OpenApi.OData from 2.0.0-preview.2 to 2.0.0-preview.3
- #1826: Resolve external document dereference to OpenApiDocument using $ref to $id
- #1854: Allow hidi to transform an OpenAPI 3.1 document
- #1851: Fix $ref with $id serialization
- #1849: Set workspace baseUrl when creating a workspace
- #1820: Handle upcasting and downcasting of JSON schemas with type arrays
- #1847: Bump docker/build-push-action from 6.7.0 to 6.9.0
- #1848: Bump Microsoft.OData.Edm from 8.0.1 to 8.0.2
- #1787: Replace JsonSchema with OpenApiSchema
- #1766: Add JSON schema support
- #1729: Update packages
This list of changes was auto generated.
2.0.0-preview1 release notes
Overview
Version 2.0-preview1 brings major enhancements, including OpenAPI 3.1 support, improved performance, and bug fixes to enhance user experience. These changes introduce some breaking changes, so migrating to this new version may require updates in existing implementations.
Upgrade Steps
- Bump up Microsoft.OpenApi and Microsoft.OpenApi.Readers packages to 2.0.0-preview1 from NuGet.
Breaking Changes
1. Update namespaces
Since most of the loading code has moved to the core library, you will be required to update the namespaces in your classes to reflect the change.
Example:
If you're using an instance of our OpenApiReaderSettings
, you'll need to update the namespace from Microsoft.OpenApi.Readers
to Microsoft.OpenApi.Reader
2. Use Load/LoadAsync/Parse pattern for loading OpenApi documents
We've introduced a simplified static loading pattern for OpenAPI documents, removing the need for a secondary reader.
We have also introduced a registry class that allows users to register different OpenAPI format providers and their implementations for customized scenarios.
Reading from a JSON stream:
var settings = new OpenApiReaderSettings();
var readResult = OpenApiDocument.Load(stream, "json", settings);
var doc = readResult.OpenApiDocument;
To enable YAML parsing, you'll have to register our OpenApiYamlReader with our reader registry for us to take a dependency on the SharpYaml library.
Reading from a YAML stream:
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yaml, new OpenApiYamlReader());
var doc = OpenApiDocument.Load(stream, "yaml", settings).OpenApiDocument;
Reading string input:
var doc = OpenApiDocument.Parse(input, "yaml").OpenApiDocument;
Reading from a file path or URL:
var doc = await OpenApiDocument.LoadAsync(filePath).OpenApiDocument;
3. Migration to JsonNode for examples and extensions
Schema examples and extensions now use JsonNode instead of IOpenApiAny, ensuring JSON Schema compatibility and fixing parsing errors.
You'll be required to import the System.Text.Json.Nodes
namespace to facilitate this.
v1.x example:
Example = new OpenApiObject
{
["name"] = new OpenApiString("Puma"),
["id"] = new OpenApiLong(1)
}
v2.0 example:
Example = new JsonObject
{
["name"] = "Puma",
["id"] = 1
}
v1.x extensions:
Extensions = new Dictionary<string, IOpenApiExtension>
{
{
"x-ms-docs-operation-type", new OpenApiString("function")
}
}
v2.0 extensions:
Extensions = new Dictionary<string, IOpenApiExtension>
{
{
"x-ms-docs-operation-type", new OpenApiAny("function")
}
}
4. JSON schema Type has changed from string to JsonSchemaType enum
In line with JSON Schema, the type
keyword can now define multiple types for a schema with an array. Swap nullable for type arrays.
Schema example in v1.x:
Type = "array",
Items = new() { Type = "string" }
Schema example in v2.0:
Type = JsonSchemaType.Array,
Items = new() { Type = JsonSchemaType.String }
5. Use Proxy Reference object in place of OpenApiReference
in your model
We have optimized the reference resolution step by implementing a proxy pattern where dereferencing happens by lazy loading when one tries to access an object's properties that contains a $ref.
Example
Items = new OpenApiSchema
{
UnresolvedReference = true,
Reference = new OpenApiReference
{
Type = ReferenceType.Schema,
Id = "GeoJSON.position"
}
}
changes to:
Items = new OpenApiSchemaReference("GeoJSON.position", null),
The proxy objects exist within the Microsoft.OpenApi.Models.References
namespace so make sure to add a reference to this in your class.
Note: For the reference to be resolved, make sure to pass a host document instance.
6. Modify validation rules to add CRUD operations
Modifies validation rules to add Create, Read, Update and Delete operations to allow for a configurable experience by clients.
New Features
-
OpenAPI 3.1 support in line with the OpenApi 3.1 specification.These include:
- Webhooks support
- summary property in the info object
- license SPDX identifier
- Add a root property JSON schema dialect
- Allow overloading of summary and description fields alongside $ref for non-JSON schema objects.
-
JSON schema support
- Support the core and validation keywords from the latest JSON schema specification JSON Schema Specification Draft 2020-12.
- Add support for keywords such as $schema, $id, $comment, $vocabulary, $dynamicRef, $dynamicAnchor.
- Swap nullable for type arrays
- Map nullable keyword to null type
- ExclusiveMinimum and ExclusiveMaximum now represent distinct values
- Add support for PatternProperties
- Support for
examples
defined as an array
-
Local and external document dereferencing using a $ref locator to schema identifiers using $id
Enhancements and Perf improvements
1. Proxy Pattern for reference resolution
Simplifies reference resolution using proxy reference objects that implement lazy loading during property access thus eliminating the need for a secondary parse.
2. System.Text.Json for parsing
Replaces older parsers with System.Text.Json to improve efficiency and native integration.
3. Optimized JSON parsing
Completely bypasses the YAML parser to parse JSON documents, significantly improving performance.
4. Avoid buffering JSON data into a new MemoryStream during parsing
This increases efficiency by reducing memory usage and allowing the program to respond faster as JSON data can be read asynchronously, especially in cases with large or streaming data.
Bug Fixes
- Fix validation errors during examples validation resulting into data type mismatches
- Fix example values and extension strings switching type
- Fix property getter that changes model data
- Fix Parsing error when path key exceeds 1023 characters by using STJ
- Fixes consumes in global context not being propagated to request body
- Fixes examples serialization in request/response objects during v2->v3 upcasting and vice versa
- Fix ValidationRuleSet.Rules should be IEnumerable not IList
- Simplify null checks
- Remove validation rule to make both paths and webhooks optional in v2.0
- Writing $ref values that have a $Id as a value are incorrectly prepending #/components/schema/
- Fix concurrency error with reader registry
Other Changes
- Update our commandline tool-hidi to validate and transform 3.1 documents
1.6.22
Changes:
- #1898: Release Hidi
- #1896: Bump up hidi and conversion lib versions
- #1895: chore(deps): bump Verify.Xunit from 27.0.1 to 27.1.0
- #1892: docs: fixes doc comments to align with changes made in #1883
- #1883: fix: emits number for integer formats
- #1886: use nameof for CallerArgumentExpression
- #1885: Release Hidi lib.
- #1884: Bump, Release Hidi
- #1881: chore(deps): bump Microsoft.OData.Edm from 8.0.2 to 8.1.0
- #1882: chore(deps): bump Microsoft.OpenApi.OData from 2.0.0-preview.5 to 2.0.0-preview.6
See More
- #1877: Bump Verify.Xunit from 26.6.0 to 27.0.1
- #1873: Released Hidi
- #1871: Bumps up conversion lib. and hidi versions
- #1870: ci: removes zengin since he doesn't have access to the repo anymore
- #1869: Bump Microsoft.OpenApi.OData from 2.0.0-preview.3 to 2.0.0-preview.4
- #1868: Bump Microsoft.Extensions.Logging.Debug from 8.0.0 to 8.0.1
- #1867: Bump Microsoft.Extensions.Logging.Console from 8.0.0 to 8.0.1
- #1863: Bump Microsoft.Extensions.Logging and Microsoft.Extensions.Logging.Abstractions
- #1862: Bump System.Text.Json from 8.0.4 to 8.0.5
- #1864: Bump Microsoft.Windows.Compatibility from 8.0.8 to 8.0.10
- #1809: Use ConcurrentDictionary For Improving GetEnumFromDisplayName
- #1860: Releases Hidi
- #1859: Bumps up Hidi version
- #1858: Bump Microsoft.OpenApi.OData from 2.0.0-preview.2 to 2.0.0-preview.3
- #1847: Bump docker/build-push-action from 6.7.0 to 6.9.0
- #1848: Bump Microsoft.OData.Edm from 8.0.1 to 8.0.2
This list of changes was auto generated.
1.6.21
1.6.20
Changes:
- #1816: Release libs
- #1815: Disable VisualStudio.Threading analyzers to eliminate build failures downstream
- #1814: Fix: Do not default to an empty list if Security scheme is missing
- #1813: Bump Moq from 4.20.70 to 4.20.71
- #1811: Bump Verify.Xunit from 26.3.0 to 26.3.1
- #1807: ci: upgrades outdated nuget installer task
- #1808: Bump Verify.Xunit from 26.2.0 to 26.3.0
- #1806: fix: directly adds non-vulnerable versions of transitive deps to resolve alerts
- #1805: Investigate: Check whether server info changes during slicing
This list of changes was auto generated.
1.6.19
Changes:
- #1802: Release hidi and libs
- #1803: Copy over references for all IOpenApiReferenceable objects
- #1801: Bump hidi and lib versions
- #1759: Use ConcurrentDictionary For Improving Get Enum Name
- #1800: Fix: Remove minimatch pattern to sign all assemblies
- #1798: chore/tasks linting
This list of changes was auto generated.
1.6.18
Changes:
- #1795: Release libs.
- #1794: Update OData lib and Hidi versions
- #1783: Add server variable substitution logic.
- #1788: Bump Microsoft.NET.Test.Sdk from 17.10.0 to 17.11.0
- #1785: Bump Microsoft.OData.Edm from 8.0.0 to 8.0.1
- #1784: Bump docker/build-push-action from 6.6.1 to 6.7.0
- #1782: Bump Newtonsoft.Json from 13.0.1 to 13.0.3
- #1780: Bump Microsoft.Windows.Compatibility from 8.0.7 to 8.0.8
- #1777: Bump docker/build-push-action from 6.5.0 to 6.6.1
- #1778: Bump Verify.Xunit from 26.1.6 to 26.2.0
See More
- #1779: Bump Microsoft.OData.Edm from 7.21.3 to 8.0.0
- #1776: Master Refresh
- #1775: Upgrade ESRPCodeSigning tasks
- #1774: Fix examples serialization causing NullReferenceException
This list of changes was auto generated.
1.6.17
Changes:
- #1771: Deploy libs
- #1770: Bump lib versions
- #1769: Add support for unserializable annotations on OpenAPI document
- #1768: Fix example value of an empty array disappears after serialization
- #1752: Fix securityScheme/securityRequirement serialization
- #1767: Bump Verify.Xunit from 26.1.5 to 26.1.6
- #1762: Bump Verify.Xunit from 26.1.2 to 26.1.5
This list of changes was auto generated.
1.6.16
Changes:
- #1761: Merges
vnext
intomaster
- #1760: Remove packages potentially causing build to fail in AzDo pipeline
- #1758: Bump Verify.Xunit from 26.1.1 to 26.1.2
- #1755: Update code reviewers
- #1754: Add missing nuget lib refs
- #1751: Releases Hidi
- #1753: Bump Verify.Xunit from 26.0.1 to 26.1.1
- #1750: Bumps up conversion lib version
- #1747: Release libs
- #1746: Bump up lib versions
See More
- #1744: Fix Initialization of StreamReader in OpenApiStreamReader throws an ArgumentNullException
- #1745: Bump Verify.Xunit from 26.0.0 to 26.0.1
- #1743: Bump Verify.Xunit from 25.3.2 to 26.0.0
- #1741: Bump docker/build-push-action from 6.4.0 to 6.5.0
- #1742: Bump docker/login-action from 3.2.0 to 3.3.0
- #1717: Make OpenAPI.NET library trim-compatible
- #1736: Fix copy constructor for arrays and objects
- #1737: add verify settings to editorconfig
- #1739: Remove redundant section from README
- #1734: Fix OpenApiFilterService.CreateFilteredDocument failing when the Components field is missing.
- #1731: Bump Verify.Xunit from 25.3.1 to 25.3.2
- #1728: Bump docker/build-push-action from 6.3.0 to 6.4.0
- #1718: make verified files as lf and utf8
- #1725: Bump Verify.Xunit from 25.3.0 to 25.3.1
- #1724: Bump Microsoft.Windows.Compatibility from 8.0.6 to 8.0.7
- #1722: Bump xunit from 2.8.1 to 2.9.0
- #1721: Bump docker/build-push-action from 6.2.0 to 6.3.0
- #1723: Bump xunit.runner.visualstudio from 2.8.1 to 2.8.2
- #1720: Bump dependabot/fetch-metadata from 2.1.0 to 2.2.0
- #1716: Bump Verify.Xunit from 25.2.0 to 25.3.0
- #1714: Bump Verify.Xunit from 25.0.4 to 25.2.0
- #1713: Bump docker/build-push-action from 6.1.0 to 6.2.0
- #1703: Releases Hidi
- #1708: Resolve merge in #1703
- #1690: Release Hidi and libs
- #1704: Resolve merge conflicts
- #1685: Bump Verify.Xunit from 24.2.0 to 25.0.1
- #1683: Bump docker/login-action from 3.1.0 to 3.2.0
- #1689: Updates conversion lib. version
- #1702: Bumps up conversion library version
- #1698: Fixes null extension bug
- #1697: Fix invalid reference bug
- #1701: Bump Verify.Xunit from 25.0.3 to 25.0.4
- #1700: Bump docker/build-push-action from 6.0.0 to 6.1.0
- #1696: Bump docker/build-push-action from 5.4.0 to 6.0.0
- #1694: Bump Verify.Xunit from 25.0.2 to 25.0.3
- #1692: Bump Verify.Xunit from 25.0.1 to 25.0.2
- #1691: Bump lib versions
- #1688: Bump docker/build-push-action from 5.3.0 to 5.4.0
- #1686: Return -1 exit code when the document is not valid
- #1687: Change to relative path in
Launch Hidi
task - #1684: Bump Microsoft.OData.Edm from 7.21.2 to 7.21.3
- #1682: Bump Microsoft.Windows.Compatibility from 8.0.5 to 8.0.6
This list of changes was auto generated.
1.6.15
Changes:
- #1703: Releases Hidi
- #1708: Resolve merge in #1703
- #1690: Release Hidi and libs
- #1704: Resolve merge conflicts
- #1685: Bump Verify.Xunit from 24.2.0 to 25.0.1
- #1683: Bump docker/login-action from 3.1.0 to 3.2.0
- #1689: Updates conversion lib. version
- #1702: Bumps up conversion library version
- #1698: Fixes null extension bug
- #1697: Fix invalid reference bug
See More
- #1701: Bump Verify.Xunit from 25.0.3 to 25.0.4
- #1700: Bump docker/build-push-action from 6.0.0 to 6.1.0
- #1696: Bump docker/build-push-action from 5.4.0 to 6.0.0
- #1694: Bump Verify.Xunit from 25.0.2 to 25.0.3
- #1692: Bump Verify.Xunit from 25.0.1 to 25.0.2
- #1691: Bump lib versions
- #1688: Bump docker/build-push-action from 5.3.0 to 5.4.0
- #1686: Return -1 exit code when the document is not valid
- #1687: Change to relative path in
Launch Hidi
task - #1684: Bump Microsoft.OData.Edm from 7.21.2 to 7.21.3
- #1682: Bump Microsoft.Windows.Compatibility from 8.0.5 to 8.0.6
This list of changes was auto generated.