Title: OpenAPI 3.2: `oauth2MetadataUrl` Missing from `Microsoft.OpenApi.OpenApiSecurityScheme` · Issue #2694 · microsoft/OpenAPI.NET · GitHub
Open Graph Title: OpenAPI 3.2: `oauth2MetadataUrl` Missing from `Microsoft.OpenApi.OpenApiSecurityScheme` · Issue #2694 · microsoft/OpenAPI.NET
X Title: OpenAPI 3.2: `oauth2MetadataUrl` Missing from `Microsoft.OpenApi.OpenApiSecurityScheme` · Issue #2694 · microsoft/OpenAPI.NET
Description: Summary Microsoft.OpenApi can serialize OpenAPI 3.2 documents, but the Security Scheme Object is missing support for the OpenAPI 3.2 field: oauth2MetadataUrl (type: string, format: uri, applies to type: oauth2) This prevents consumers fr...
Open Graph Description: Summary Microsoft.OpenApi can serialize OpenAPI 3.2 documents, but the Security Scheme Object is missing support for the OpenAPI 3.2 field: oauth2MetadataUrl (type: string, format: uri, applies to ...
X Description: Summary Microsoft.OpenApi can serialize OpenAPI 3.2 documents, but the Security Scheme Object is missing support for the OpenAPI 3.2 field: oauth2MetadataUrl (type: string, format: uri, applies to ...
Opengraph URL: https://github.com/microsoft/OpenAPI.NET/issues/2694
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"OpenAPI 3.2: `oauth2MetadataUrl` Missing from `Microsoft.OpenApi.OpenApiSecurityScheme`","articleBody":"## Summary\n\n`Microsoft.OpenApi` can serialize OpenAPI **3.2** documents, but the **Security Scheme Object** is missing support for the OpenAPI 3.2 field:\n\n- `oauth2MetadataUrl` (type: `string`, format: `uri`, applies to `type: oauth2`)\n\nThis prevents consumers from producing spec-complete OpenAPI 3.2 documents when describing OAuth2 servers using RFC 8414 metadata.\n\n## Spec Reference\n\nOpenAPI 3.2.0 adds `oauth2MetadataUrl` to the Security Scheme Object. citeturn0search0turn0search10\nThe field is defined as a URL to the OAuth2 authorization server metadata (RFC 8414). citeturn0search5turn0search2\n\n## Current Behavior\n\n`OpenApiSecurityScheme` does not expose a property for `oauth2MetadataUrl`, and the serializer does not emit it for OpenAPI 3.2 output.\n\nEven when using `SerializeAsV32`, the switch over `SecuritySchemeType` only handles:\n\n- `apiKey`: `name`, `in`\n- `http`: `scheme`, `bearerFormat`\n- `oauth2`: `flows`\n- `openIdConnect`: `openIdConnectUrl`\n\nThere is no native way to model and serialize `oauth2MetadataUrl` other than vendor extensions.\n\n## Expected Behavior\n\nWhen `Type == SecuritySchemeType.OAuth2` and the target spec version is **OpenAPI 3.2+**, the library should allow setting and serializing:\n\n```yaml\ncomponents:\n securitySchemes:\n oauth:\n type: oauth2\n oauth2MetadataUrl: https://idp.example.com/.well-known/oauth-authorization-server\n flows:\n clientCredentials:\n tokenUrl: https://idp.example.com/oauth/token\n scopes: {}\n```\n\n## Proposed API Change\n\nAdd a nullable `Uri` property to `OpenApiSecurityScheme`:\n\n```csharp\npublic Uri? OAuth2MetadataUrl { get; set; }\n```\n\n### Serialization (OpenAPI 3.2+ only)\n\nIn `SerializeInternal(...)`, under `case SecuritySchemeType.OAuth2:` write the property **before/after** flows:\n\n```csharp\nif (version \u003e= OpenApiSpecVersion.OpenApi3_2)\n{\n writer.WriteProperty(\"oauth2MetadataUrl\", OAuth2MetadataUrl?.ToString());\n}\nwriter.WriteOptionalObject(OpenApiConstants.Flows, Flows, callback);\n```\n\n### Parsing / Reading\n\nIf the library includes readers/deserializers for security schemes, they should also recognize `oauth2MetadataUrl` when parsing OpenAPI 3.2 documents into `OpenApiSecurityScheme`.\n\n## Why This Matters\n\nOAuth2 Authorization Server Metadata (RFC 8414) is widely used to publish endpoints and capabilities. OpenAPI 3.2 explicitly supports linking to that metadata; without this field, OpenAPI 3.2 documents generated with `Microsoft.OpenApi` cannot fully represent the spec-defined OAuth2 security scheme information. citeturn0search5turn0search7\n\n## Workarounds Today\n\n- Use `Extensions[\"x-oauth2MetadataUrl\"] = ...` (non-standard)\n- Put the URL in `description` (lossy / not machine-readable)\n\n## Request\n\nPlease add first-class support for `oauth2MetadataUrl` to `OpenApiSecurityScheme` and include it in OpenAPI 3.2 serialization/parsing for OAuth2 security schemes.\n\nThank you!\n","author":{"url":"https://github.com/mdaneri","@type":"Person","name":"mdaneri"},"datePublished":"2026-01-20T21:12:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/2694/OpenAPI.NET/issues/2694"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0a69f1b4-f291-2a73-2d57-1fd056ad2181 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 862E:25FBBC:1991E9B:21640B2:69817914 |
| html-safe-nonce | dcc824af9ef835d0a07acd966fdfc3a4fd222dab4d2c315917e2b8c36ce5fb6e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NjJFOjI1RkJCQzoxOTkxRTlCOjIxNjQwQjI6Njk4MTc5MTQiLCJ2aXNpdG9yX2lkIjoiMzc2NDU3MzUyMjg2OTk3NTMxNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 108f705b6c21aca5a2f3767ea8e99e46f7cdb3acc8f76fdd996c6ec4dc74bc64 |
| hovercard-subject-tag | issue:3835484202 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/OpenAPI.NET/2694/issue_layout |
| twitter:image | https://opengraph.githubassets.com/777f43a4145bd9e2bdc72559fc0ac1418bbd99d1b255afd2c1331cd8251c1993/microsoft/OpenAPI.NET/issues/2694 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/777f43a4145bd9e2bdc72559fc0ac1418bbd99d1b255afd2c1331cd8251c1993/microsoft/OpenAPI.NET/issues/2694 |
| og:image:alt | Summary Microsoft.OpenApi can serialize OpenAPI 3.2 documents, but the Security Scheme Object is missing support for the OpenAPI 3.2 field: oauth2MetadataUrl (type: string, format: uri, applies to ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mdaneri |
| hostname | github.com |
| expected-hostname | github.com |
| None | e137814e266030874fd2c86863529d0622b13889eeda04148c57654b6ea84ad6 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/OpenAPI.NET git https://github.com/microsoft/OpenAPI.NET.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 97175798 |
| octolytics-dimension-repository_nwo | microsoft/OpenAPI.NET |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 97175798 |
| octolytics-dimension-repository_network_root_nwo | microsoft/OpenAPI.NET |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | dd58d68a7813bbec9c91422c8c35f4af33832d70 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width