Visitar URL original
fix/boolean schemas to v2 by baywet · Pull Request #2840 · microsoft/OpenAPI.NET · GitHub
Skip to content
Merged
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>
(cherry picked from commit b9b9b75)
  • Loading branch information
baywet and Copilot committed Apr 27, 2026
commit 542bde5daa8e1848635f73d7407cd08520ebfeda
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);
}
}
}