diff --git a/src/Microsoft.OpenApi.OData.Reader/Microsoft.OpenAPI.OData.Reader.csproj b/src/Microsoft.OpenApi.OData.Reader/Microsoft.OpenAPI.OData.Reader.csproj
index 7caef75b2..54ba66e63 100644
--- a/src/Microsoft.OpenApi.OData.Reader/Microsoft.OpenAPI.OData.Reader.csproj
+++ b/src/Microsoft.OpenApi.OData.Reader/Microsoft.OpenAPI.OData.Reader.csproj
@@ -32,7 +32,7 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiSchemaGeneratorTests.cs b/test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiSchemaGeneratorTests.cs
index 8c1e550f7..162592951 100644
--- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiSchemaGeneratorTests.cs
+++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Generator/OpenApiSchemaGeneratorTests.cs
@@ -391,6 +391,9 @@ public async Task CreateStructuredTypePropertiesSchemaWithCustomAttributeReturns
""$ref"": ""#/components/schemas/microsoft.graph.userInsightsSettings""
},
{
+ ""enum"": [
+ null
+ ],
""nullable"": true
}
],
@@ -403,6 +406,9 @@ public async Task CreateStructuredTypePropertiesSchemaWithCustomAttributeReturns
""$ref"": ""#/components/schemas/microsoft.graph.contactMergeSuggestions""
},
{
+ ""enum"": [
+ null
+ ],
""nullable"": true
}
],
@@ -415,6 +421,9 @@ public async Task CreateStructuredTypePropertiesSchemaWithCustomAttributeReturns
""$ref"": ""#/components/schemas/microsoft.graph.regionalAndLanguageSettings""
},
{
+ ""enum"": [
+ null
+ ],
""nullable"": true
}
],
@@ -427,6 +436,9 @@ public async Task CreateStructuredTypePropertiesSchemaWithCustomAttributeReturns
""$ref"": ""#/components/schemas/microsoft.graph.shiftPreferences""
},
{
+ ""enum"": [
+ null
+ ],
""nullable"": true
}
],
@@ -907,7 +919,8 @@ public async Task CreatePropertySchemaForNullableEnumPropertyReturnSchema(OpenAp
string json = await schema.SerializeAsJsonAsync(specVersion);
_output.WriteLine(json);
- var expected = JsonNode.Parse(specVersion switch {
+ var expected = JsonNode.Parse(specVersion switch
+ {
OpenApiSpecVersion.OpenApi2_0 =>
"""
{
@@ -922,6 +935,9 @@ public async Task CreatePropertySchemaForNullableEnumPropertyReturnSchema(OpenAp
"$ref": "#/components/schemas/DefaultNs.Color"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
],
diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.json b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.json
index f2476ce60..4f9050a49 100644
--- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.json
+++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.json
@@ -5016,6 +5016,9 @@
"$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
],
@@ -5364,6 +5367,9 @@
"$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.Library"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
],
@@ -5375,6 +5381,9 @@
"$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.DocumentFile.DocumentFile"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
],
@@ -5386,6 +5395,9 @@
"$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
],
@@ -5535,6 +5547,9 @@
"$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
],
@@ -5605,6 +5620,9 @@
"$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
],
@@ -5616,6 +5634,9 @@
"$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Tags.Tag"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
],
@@ -5864,6 +5885,9 @@
"$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.Library"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
],
@@ -5875,6 +5899,9 @@
"$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.LibraryType"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
],
@@ -5886,6 +5913,9 @@
"$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.Library"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
],
@@ -6064,6 +6094,9 @@
"$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.LibraryType"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
],
@@ -6075,6 +6108,9 @@
"$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.LibraryType"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
],
@@ -6590,6 +6626,9 @@
"$ref": "#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
],
diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.yaml b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.yaml
index 969f839b1..1f32eb541 100644
--- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.yaml
+++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/Multiple.Schema.OpenApi.yaml
@@ -3528,7 +3528,9 @@ components:
Document:
anyOf:
- $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
x-ms-navigationProperty: true
example:
Id: 0
@@ -3805,17 +3807,23 @@ components:
Library:
anyOf:
- $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.Library'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
x-ms-navigationProperty: true
LastRevisionFile:
anyOf:
- $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.DocumentFile.DocumentFile'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
x-ms-navigationProperty: true
SourceDocument:
anyOf:
- $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
x-ms-navigationProperty: true
SourceDocumentChildren:
type: array
@@ -3928,7 +3936,9 @@ components:
Document:
anyOf:
- $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
x-ms-navigationProperty: true
example:
ClassInstance: 0
@@ -3981,12 +3991,16 @@ components:
Document:
anyOf:
- $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
x-ms-navigationProperty: true
Tag:
anyOf:
- $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Tags.Tag'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
x-ms-navigationProperty: true
example:
DocumentId: 0
@@ -4186,17 +4200,23 @@ components:
LibraryParent:
anyOf:
- $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.Library'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
x-ms-navigationProperty: true
Type:
anyOf:
- $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.LibraryType'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
x-ms-navigationProperty: true
SourceFolder:
anyOf:
- $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.Library'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
x-ms-navigationProperty: true
Documents:
type: array
@@ -4333,12 +4353,16 @@ components:
MasterLibraryType:
anyOf:
- $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.LibraryType'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
x-ms-navigationProperty: true
ParentLibraryTypes:
anyOf:
- $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Library.LibraryType'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
x-ms-navigationProperty: true
MasterLibraryTypeChildren:
type: array
@@ -4725,7 +4749,9 @@ components:
Document:
anyOf:
- $ref: '#/components/schemas/Siterra.Documents.BusinessLogic.Entities.Document.Document'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
x-ms-navigationProperty: true
example:
Id: 0
diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.json b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.json
index 3cf1de2bd..4342cfec9 100644
--- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.json
+++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.json
@@ -1418,6 +1418,9 @@
"$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airport"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
]
@@ -1452,6 +1455,9 @@
"$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
]
@@ -11687,6 +11693,9 @@
"$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
]
@@ -16963,6 +16972,9 @@
"$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
]
@@ -30713,6 +30725,9 @@
"$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
]
@@ -33731,6 +33746,9 @@
"$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Location"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
]
@@ -33763,6 +33781,9 @@
"$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
],
@@ -33813,6 +33834,9 @@
"$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.AirportLocation"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
]
@@ -33833,6 +33857,9 @@
"$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.City"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
]
@@ -33875,6 +33902,9 @@
"$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
],
@@ -34018,6 +34048,9 @@
"$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.EventLocation"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
]
@@ -34066,6 +34099,9 @@
"$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airline"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
],
@@ -34077,6 +34113,9 @@
"$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airport"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
],
@@ -34088,6 +34127,9 @@
"$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airport"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
],
@@ -34158,6 +34200,9 @@
"$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Location"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
]
@@ -34501,6 +34546,9 @@
"$ref": "#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airline"
},
{
+ "enum": [
+ null
+ ],
"nullable": true
}
]
diff --git a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.yaml b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.yaml
index 330379ecf..61a79ba03 100644
--- a/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.yaml
+++ b/test/Microsoft.OpenAPI.OData.Reader.Tests/Resources/TripService.OpenApi.yaml
@@ -912,7 +912,9 @@ paths:
schema:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airport'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: functionImport
@@ -932,7 +934,9 @@ paths:
schema:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: functionImport
@@ -7778,7 +7782,9 @@ paths:
hire:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
responses:
'204':
description: Success
@@ -11287,7 +11293,9 @@ paths:
hire:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
responses:
'204':
description: Success
@@ -20524,7 +20532,9 @@ paths:
hire:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
responses:
'204':
description: Success
@@ -22558,7 +22568,9 @@ components:
HomeAddress:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Location'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
FavoriteFeature:
$ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Feature'
Features:
@@ -22578,7 +22590,9 @@ components:
BestFriend:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
description: The best friend.
x-ms-navigationProperty: true
Trips:
@@ -22611,7 +22625,9 @@ components:
Location:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.AirportLocation'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
Microsoft.OData.Service.Sample.TrippinInMemory.Models.Location:
title: Location
type: object
@@ -22622,7 +22638,9 @@ components:
City:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.City'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
Microsoft.OData.Service.Sample.TrippinInMemory.Models.City:
title: City
type: object
@@ -22647,7 +22665,9 @@ components:
EmergencyAuthority:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
description: The person to contact in case of a crisis at this location.
x-ms-navigationProperty: true
Microsoft.OData.Service.Sample.TrippinInMemory.Models.EventLocation:
@@ -22741,7 +22761,9 @@ components:
OccursAt:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.EventLocation'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
Description:
type: string
nullable: true
@@ -22766,17 +22788,23 @@ components:
Airline:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airline'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
x-ms-navigationProperty: true
From:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airport'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
x-ms-navigationProperty: true
To:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airport'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
x-ms-navigationProperty: true
Microsoft.OData.Service.Sample.TrippinInMemory.Models.Employee:
allOf:
@@ -22812,7 +22840,9 @@ components:
BossOffice:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Location'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
DirectReports:
type: array
items:
@@ -23029,7 +23059,9 @@ components:
schema:
anyOf:
- $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airline'
- - nullable: true
+ - enum:
+ - null
+ nullable: true
GetFriendsTripsResponse:
description: Success
content: