@@ -6873,6 +6873,84 @@ public void AddReservedPathParameterSymbol()
68736873 Assert . Equal ( "{+baseurl}/users/{+id}/manager" , managerUrlTemplate . DefaultValue . Trim ( '"' ) ) ;
68746874 }
68756875 [ Fact ]
6876+ public void JsonNullSentinelIsNotDefaultValue ( )
6877+ {
6878+ // Given
6879+ var userSchema = new OpenApiSchema
6880+ {
6881+ Type = JsonSchemaType . Object ,
6882+ Properties = new Dictionary < string , IOpenApiSchema > {
6883+ {
6884+ "id" , new OpenApiSchema {
6885+ Type = JsonSchemaType . String
6886+ }
6887+ } ,
6888+ {
6889+ "displayName" , new OpenApiSchema {
6890+ Type = JsonSchemaType . String ,
6891+ Default = JsonNullSentinel . JsonNull
6892+ }
6893+ }
6894+ } ,
6895+ } ;
6896+ var document = new OpenApiDocument
6897+ {
6898+ Paths = new OpenApiPaths
6899+ {
6900+ [ "users/{id}/manager" ] = new OpenApiPathItem
6901+ {
6902+ Parameters = [
6903+ new OpenApiParameter {
6904+ Name = "id" ,
6905+ In = ParameterLocation . Path ,
6906+ Required = true ,
6907+ Schema = new OpenApiSchema {
6908+ Type = JsonSchemaType . String
6909+ } ,
6910+ Extensions = new Dictionary < string , IOpenApiExtension > ( ) {
6911+ [ "x-ms-reserved-parameter" ] = new OpenApiReservedParameterExtension {
6912+ IsReserved = true
6913+ }
6914+ }
6915+ }
6916+ ] ,
6917+ Operations = new ( )
6918+ {
6919+ [ NetHttpMethod . Get ] = new OpenApiOperation
6920+ {
6921+ Responses = new OpenApiResponses
6922+ {
6923+ [ "200" ] = new OpenApiResponse
6924+ {
6925+ Content = new Dictionary < string , OpenApiMediaType > ( )
6926+ {
6927+ [ "application/json" ] = new OpenApiMediaType
6928+ {
6929+ Schema = new OpenApiSchemaReference ( "microsoft.graph.user" )
6930+ }
6931+ }
6932+ }
6933+ }
6934+ }
6935+ }
6936+ } ,
6937+ } ,
6938+ } ;
6939+ document . AddComponent ( "microsoft.graph.user" , userSchema ) ;
6940+ document . SetReferenceHostDocument ( ) ;
6941+ var mockLogger = new CountLogger < KiotaBuilder > ( ) ;
6942+ var builder = new KiotaBuilder ( mockLogger , new GenerationConfiguration { ClientClassName = "Graph" , ApiRootUrl = "https://localhost" } , _httpClient ) ;
6943+ var node = builder . CreateUriSpace ( document ) ;
6944+ var codeModel = builder . CreateSourceModel ( node ) ;
6945+ // When
6946+ var userModel = codeModel . FindChildByName < CodeClass > ( "User" ) ;
6947+ // Then
6948+ Assert . NotNull ( userModel ) ;
6949+ var displayNameProperty = userModel . FindChildByName < CodeProperty > ( "DisplayName" , false ) ;
6950+ Assert . NotNull ( displayNameProperty ) ;
6951+ Assert . Empty ( displayNameProperty ? . DefaultValue ) ;
6952+ }
6953+ [ Fact ]
68766954 public void DoesNotAddReservedPathParameterSymbol ( )
68776955 {
68786956 var userSchema = new OpenApiSchema
0 commit comments