Visitar URL original
fix: null reference exception for boolean component schemas by baywet · Pull Request #2839 · microsoft/OpenAPI.NET · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test(schema): add deserialization tests for empty and boolean schemas
Add theory tests across OpenAPI 3.1 and 3.2 to validate deserialization of:
- Empty schema object ({})
- Boolean schema value (true)

These tests ensure that non-standard but valid schema forms are parsed
without errors and produce valid OpenApiSchema objects.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Loading branch information
baywet and Copilot committed Apr 27, 2026
commit b9b9b7584a2dba829935c27f24df0b7fe5acd96b
Original file line number Diff line number Diff line change
Expand Up @@ -844,5 +844,17 @@ public void ParseSchemaWithoutUnevaluatedPropertiesDefaultsToTrue()
Assert.Equivalent(expected, actual);
Assert.True(actual.UnevaluatedProperties); // Explicitly verify the default
}

[Theory]
[InlineData("{}")]
[InlineData("true")]
public void DeserializeBasicSchemaWorks(string schemaSource)
{
// Arrange & Act
var schema = OpenApiModelFactory.Parse<OpenApiSchema>(schemaSource, OpenApiSpecVersion.OpenApi3_1, new(), out _);

// Assert - schema should deserialize without error
Assert.NotNull(schema);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,18 @@ public void ParseSchemaWithUnevaluatedPropertiesComplexSchema()
// Assert
Assert.Equivalent(expected, actual);
}

[Theory]
[InlineData("{}")]
[InlineData("true")]
public void DeserializeBasicSchemaWorks(string schemaSource)
{
// Arrange & Act
var schema = OpenApiModelFactory.Parse<OpenApiSchema>(schemaSource, OpenApiSpecVersion.OpenApi3_2, new(), out _);

// Assert - schema should deserialize without error
Assert.NotNull(schema);
}
}
}