Skip to content

Commit 9da59c5

Browse files
Update schema name for ref POST and PUT
1 parent 919efb6 commit 9da59c5

21 files changed

+54
-54
lines changed

src/Microsoft.OpenApi.OData.Reader/Common/Constants.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ internal static class Constants
108108
/// <summary>
109109
/// Name used for reference update.
110110
/// </summary>
111-
public static string ReferenceUpdateSchemaName = "ReferenceUpdateSchema";
111+
public static string ReferenceUpdateSchemaName = "ReferenceUpdate";
112112

113113

114114
/// <summary>
115115
/// Name used for reference update.
116116
/// </summary>
117-
public static string ReferencePostSchemaName = "ReferencePostSchema";
117+
public static string ReferenceCreateSchemaName = "ReferenceCreate";
118118

119119
/// <summary>
120120
/// Name used for reference request POST body.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ private static OpenApiRequestBody CreateRefPostRequestBody()
120120
Reference = new OpenApiReference
121121
{
122122
Type = ReferenceType.Schema,
123-
Id = Constants.ReferencePostSchemaName
123+
Id = Constants.ReferenceCreateSchemaName
124124
}
125125
};
126126
return new OpenApiRequestBody

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public static IDictionary<string, OpenApiSchema> CreateSchemas(this ODataContext
108108
}
109109
};
110110

111-
schemas[Constants.ReferencePostSchemaName] = new()
111+
schemas[Constants.ReferenceCreateSchemaName] = new()
112112
{
113113
Type = "object",
114114
Properties = new Dictionary<string, OpenApiSchema>

test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiRequestBodyGeneratorTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public void CreateRefRequestBodies()
164164
// Assert
165165
Assert.NotNull(refPostBody);
166166
Assert.Equal("New navigation property ref value", refPostBody.Description);
167-
Assert.Equal(Common.Constants.ReferencePostSchemaName, refPostBody.Content.First().Value.Schema.Reference.Id);
167+
Assert.Equal(Common.Constants.ReferenceCreateSchemaName, refPostBody.Content.First().Value.Schema.Reference.Id);
168168
}
169169
}
170170
}

test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiSchemaGeneratorTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void CreatesRefRequestBodySchema()
7474
// Act & Assert
7575
var schemas = context.CreateSchemas();
7676

77-
schemas.TryGetValue(Constants.ReferencePostSchemaName, out OpenApiSchema refRequestBody);
77+
schemas.TryGetValue(Constants.ReferenceCreateSchemaName, out OpenApiSchema refRequestBody);
7878

7979
Assert.NotNull(refRequestBody);
8080
Assert.Equal("object", refRequestBody.Type);

test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Basic.OpenApi.V2.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@
10911091
}
10921092
}
10931093
},
1094-
"ReferenceUpdateSchema": {
1094+
"ReferenceUpdate": {
10951095
"type": "object",
10961096
"properties": {
10971097
"@odata.id": {
@@ -1102,7 +1102,7 @@
11021102
}
11031103
}
11041104
},
1105-
"ReferencePostSchema": {
1105+
"ReferenceCreate": {
11061106
"type": "object",
11071107
"properties": {
11081108
"@odata.id": {

test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Basic.OpenApi.V2.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,14 +722,14 @@ definitions:
722722
type: array
723723
items:
724724
$ref: '#/definitions/DefaultNs.Address'
725-
ReferenceUpdateSchema:
725+
ReferenceUpdate:
726726
type: object
727727
properties:
728728
'@odata.id':
729729
type: string
730730
'@odata.type':
731731
type: string
732-
ReferencePostSchema:
732+
ReferenceCreate:
733733
type: object
734734
properties:
735735
'@odata.id':

test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Basic.OpenApi.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@
11961196
}
11971197
}
11981198
},
1199-
"ReferenceUpdateSchema": {
1199+
"ReferenceUpdate": {
12001200
"type": "object",
12011201
"properties": {
12021202
"@odata.id": {
@@ -1208,7 +1208,7 @@
12081208
}
12091209
}
12101210
},
1211-
"ReferencePostSchema": {
1211+
"ReferenceCreate": {
12121212
"type": "object",
12131213
"properties": {
12141214
"@odata.id": {
@@ -1376,7 +1376,7 @@
13761376
"content": {
13771377
"application/json": {
13781378
"schema": {
1379-
"$ref": "#/components/schemas/ReferencePostSchema"
1379+
"$ref": "#/components/schemas/ReferenceCreate"
13801380
}
13811381
}
13821382
},
@@ -1387,7 +1387,7 @@
13871387
"content": {
13881388
"application/json": {
13891389
"schema": {
1390-
"$ref": "#/components/schemas/ReferenceUpdateSchema"
1390+
"$ref": "#/components/schemas/ReferenceUpdate"
13911391
}
13921392
}
13931393
},

test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Basic.OpenApi.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -793,15 +793,15 @@ components:
793793
type: array
794794
items:
795795
$ref: '#/components/schemas/DefaultNs.Address'
796-
ReferenceUpdateSchema:
796+
ReferenceUpdate:
797797
type: object
798798
properties:
799799
'@odata.id':
800800
type: string
801801
'@odata.type':
802802
type: string
803803
nullable: true
804-
ReferencePostSchema:
804+
ReferenceCreate:
805805
type: object
806806
properties:
807807
'@odata.id':
@@ -910,14 +910,14 @@ components:
910910
content:
911911
application/json:
912912
schema:
913-
$ref: '#/components/schemas/ReferencePostSchema'
913+
$ref: '#/components/schemas/ReferenceCreate'
914914
required: true
915915
refPutBody:
916916
description: New navigation property ref values
917917
content:
918918
application/json:
919919
schema:
920-
$ref: '#/components/schemas/ReferenceUpdateSchema'
920+
$ref: '#/components/schemas/ReferenceUpdate'
921921
required: true
922922
tags:
923923
- name: City.City

test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Empty.OpenApi.V2.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"format": "int32",
7676
"type": "integer"
7777
},
78-
"ReferenceUpdateSchema": {
78+
"ReferenceUpdate": {
7979
"type": "object",
8080
"properties": {
8181
"@odata.id": {
@@ -86,7 +86,7 @@
8686
}
8787
}
8888
},
89-
"ReferencePostSchema": {
89+
"ReferenceCreate": {
9090
"type": "object",
9191
"properties": {
9292
"@odata.id": {

0 commit comments

Comments
 (0)