Skip to content

Commit 1afe195

Browse files
committed
Update the schema registry reference URI and public API
1 parent e8ecc1a commit 1afe195

File tree

7 files changed

+10
-9
lines changed

7 files changed

+10
-9
lines changed

src/Microsoft.OpenApi.Readers/V2/OpenApiDocumentDeserializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ private static void RegisterComponentsSchemasInGlobalRegistry(IDictionary<string
321321

322322
foreach (var schema in schemas)
323323
{
324-
var refUri = new Uri(OpenApiConstants.v2ReferenceUri + schema.Key);
324+
var refUri = new Uri(OpenApiConstants.V2ReferenceUri + schema.Key);
325325
SchemaRegistry.Global.Register(refUri, schema.Value);
326326
}
327327
}

src/Microsoft.OpenApi.Readers/V3/OpenApiComponentsDeserializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static OpenApiComponents LoadComponents(ParseNode node)
4747

4848
foreach (var schema in components.Schemas)
4949
{
50-
var refUri = new Uri(OpenApiConstants.v3ReferenceUri + schema.Key);
50+
var refUri = new Uri(OpenApiConstants.V3ReferenceUri + schema.Key);
5151
SchemaRegistry.Global.Register(refUri, schema.Value);
5252
}
5353

src/Microsoft.OpenApi.Readers/V31/OpenApiComponentsDeserializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static OpenApiComponents LoadComponents(ParseNode node)
4444

4545
foreach (var schema in components.Schemas)
4646
{
47-
var refUri = new Uri(OpenApiConstants.v3ReferenceUri + schema.Key);
47+
var refUri = new Uri(OpenApiConstants.V3ReferenceUri + schema.Key);
4848
SchemaRegistry.Global.Register(refUri, schema.Value);
4949
}
5050

src/Microsoft.OpenApi/Models/OpenApiConstants.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,12 +598,12 @@ public static class OpenApiConstants
598598
/// <summary>
599599
/// Field: V3 JsonSchema Reference Uri
600600
/// </summary>
601-
public const string v3ReferenceUri = "https://everything.json/components/schemas/";
601+
public const string V3ReferenceUri = "https://registry/components/schemas/";
602602

603603
/// <summary>
604604
/// Field: V2 JsonSchema Reference Uri
605605
/// </summary>
606-
public const string v2ReferenceUri = "https://everything.json/definitions/";
606+
public const string V2ReferenceUri = "https://registry/definitions/";
607607

608608
#region V2.0
609609

src/Microsoft.OpenApi/Services/OpenApiReferenceResolver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ private Dictionary<string, JsonSchema> ResolveJsonSchemas(IDictionary<string, Js
249249
/// <returns></returns>
250250
public JsonSchema ResolveJsonSchemaReference(Uri reference, string description = null, string summary = null)
251251
{
252-
var refUri = $"https://everything.json{reference.OriginalString.Split('#').LastOrDefault()}";
252+
var refUri = $"https://registry{reference.OriginalString.Split('#').LastOrDefault()}";
253253
var resolvedSchema = (JsonSchema)SchemaRegistry.Global.Get(new Uri(refUri));
254254

255255
if (resolvedSchema != null)

src/Microsoft.OpenApi/Services/OpenApiWorkspace.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public JsonSchema ResolveJsonSchemaReference(Uri reference)
160160
{
161161
foreach (var jsonSchema in doc.Components.Schemas)
162162
{
163-
var refUri = new Uri(OpenApiConstants.v3ReferenceUri + jsonSchema.Key);
163+
var refUri = new Uri(OpenApiConstants.V3ReferenceUri + jsonSchema.Key);
164164
SchemaRegistry.Global.Register(refUri, jsonSchema.Value);
165165
}
166166

test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,15 +453,15 @@ namespace Microsoft.OpenApi.Models
453453
public const string Type = "type";
454454
public const string UniqueItems = "uniqueItems";
455455
public const string Url = "url";
456+
public const string V2ReferenceUri = "https://registry/definitions/";
457+
public const string V3ReferenceUri = "https://registry/components/schemas/";
456458
public const string Value = "value";
457459
public const string Variables = "variables";
458460
public const string Version = "version";
459461
public const string Webhooks = "webhooks";
460462
public const string Wrapped = "wrapped";
461463
public const string WriteOnly = "writeOnly";
462464
public const string Xml = "xml";
463-
public const string v2ReferenceUri = "https://everything.json/definitions/";
464-
public const string v3ReferenceUri = "https://everything.json/components/schemas/";
465465
public static readonly System.Uri defaultUrl;
466466
public static readonly System.Version version2_0;
467467
public static readonly System.Version version3_0_0;
@@ -1490,6 +1490,7 @@ namespace Microsoft.OpenApi.Writers
14901490
}
14911491
public static class OpenApiWriterExtensions
14921492
{
1493+
public static void WriteOptionalCollection(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.IEnumerable<string> elements, System.Action<Microsoft.OpenApi.Writers.IOpenApiWriter, string> action) { }
14931494
public static void WriteOptionalCollection<T>(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.IEnumerable<T> elements, System.Action<Microsoft.OpenApi.Writers.IOpenApiWriter, T> action) { }
14941495
public static void WriteOptionalMap(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary<string, Json.Schema.JsonSchema> elements, System.Action<Microsoft.OpenApi.Writers.IOpenApiWriter, string, Json.Schema.JsonSchema> action) { }
14951496
public static void WriteOptionalMap(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary<string, string> elements, System.Action<Microsoft.OpenApi.Writers.IOpenApiWriter, string> action) { }

0 commit comments

Comments
 (0)