Skip to content

Commit 79ffbbf

Browse files
committed
fix: updates to latest components registrations
Signed-off-by: Vincent Biret <[email protected]>
1 parent c39e108 commit 79ffbbf

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/Microsoft.OpenApi.OData.Reader/Generator/OpenApiSchemaGenerator.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,27 @@ public static void AddSchemasToDocument(this ODataContext context, OpenApiDocume
4242
// append the Edm.Spatial
4343
foreach(var schema in context.CreateSpatialSchemas(document))
4444
{
45-
document.AddComponentSchema(schema.Key, schema.Value);
45+
document.AddComponent(schema.Key, schema.Value);
4646
}
4747

4848
// append the OData errors
4949
foreach(var schema in context.CreateODataErrorSchemas(document))
5050
{
51-
document.AddComponentSchema(schema.Key, schema.Value);
51+
document.AddComponent(schema.Key, schema.Value);
5252
}
5353

5454
if(context.Settings.EnableDollarCountPath)
55-
document.AddComponentSchema(Constants.DollarCountSchemaName, new OpenApiSchema {
55+
document.AddComponent(Constants.DollarCountSchemaName, new OpenApiSchema {
5656
Type = JsonSchemaType.Number,
5757
Format = "int64"
5858
});
5959

6060
if(context.HasAnyNonContainedCollections())
6161
{
62-
document.AddComponentSchema($"String{Constants.CollectionSchemaSuffix}", CreateCollectionSchema(context, new OpenApiSchema { Type = JsonSchemaType.String }, Constants.StringType, document));
62+
document.AddComponent($"String{Constants.CollectionSchemaSuffix}", CreateCollectionSchema(context, new OpenApiSchema { Type = JsonSchemaType.String }, Constants.StringType, document));
6363
}
6464

65-
document.AddComponentSchema(Constants.ReferenceUpdateSchemaName, new()
65+
document.AddComponent(Constants.ReferenceUpdateSchemaName, new OpenApiSchema()
6666
{
6767
Type = JsonSchemaType.Object,
6868
Properties = new Dictionary<string, OpenApiSchema>
@@ -72,7 +72,7 @@ public static void AddSchemasToDocument(this ODataContext context, OpenApiDocume
7272
}
7373
});
7474

75-
document.AddComponentSchema(Constants.ReferenceCreateSchemaName, new()
75+
document.AddComponent(Constants.ReferenceCreateSchemaName, new OpenApiSchema()
7676
{
7777
Type = JsonSchemaType.Object,
7878
Properties = new Dictionary<string, OpenApiSchema>
@@ -82,7 +82,7 @@ public static void AddSchemasToDocument(this ODataContext context, OpenApiDocume
8282
AdditionalProperties = new OpenApiSchema { Type = JsonSchemaType.Object }
8383
});
8484

85-
document.AddComponentSchema(Constants.ReferenceNumericName, new()
85+
document.AddComponent(Constants.ReferenceNumericName, new OpenApiSchema()
8686
{
8787
Type = JsonSchemaType.String,
8888
Nullable = true,
@@ -104,7 +104,7 @@ public static void AddSchemasToDocument(this ODataContext context, OpenApiDocume
104104
Title = "Base collection pagination and count responses",
105105
Type = JsonSchemaType.Object,
106106
};
107-
document.AddComponentSchema(Constants.BaseCollectionPaginationCountResponse, responseSchema);
107+
document.AddComponent(Constants.BaseCollectionPaginationCountResponse, responseSchema);
108108

109109
if (context.Settings.EnableCount)
110110
responseSchema.Properties.Add(ODataConstants.OdataCount);
@@ -115,7 +115,7 @@ public static void AddSchemasToDocument(this ODataContext context, OpenApiDocume
115115
// @odata.nextLink + @odata.deltaLink
116116
if (context.Model.SchemaElements.OfType<IEdmFunction>().Any(static x => x.IsDeltaFunction()))
117117
{
118-
document.AddComponentSchema(Constants.BaseDeltaFunctionResponse, new()
118+
document.AddComponent(Constants.BaseDeltaFunctionResponse, new OpenApiSchema()
119119
{
120120
Title = "Base delta function response",
121121
Type = JsonSchemaType.Object,
@@ -148,7 +148,7 @@ public static void AddSchemasToDocument(this ODataContext context, OpenApiDocume
148148
.Equals(context.Settings.InnerErrorComplexTypeName, StringComparison.Ordinal))
149149
continue;
150150

151-
document.AddComponentSchema(fullTypeName, context.CreateSchemaTypeSchema(reference, document));
151+
document.AddComponent(fullTypeName, context.CreateSchemaTypeSchema(reference, document));
152152
}
153153
break;
154154
}
@@ -164,7 +164,7 @@ public static void AddSchemasToDocument(this ODataContext context, OpenApiDocume
164164
CreateCollectionSchema(context, x, document))))
165165
.ToArray())
166166
{
167-
document.AddComponentSchema(collectionEntry.Key, collectionEntry.Value);
167+
document.AddComponent(collectionEntry.Key, collectionEntry.Value);
168168
}
169169
}
170170
internal static bool HasAnyNonContainedCollections(this ODataContext context)

0 commit comments

Comments
 (0)