Skip to content

Fix schema settings serialization during export#9744

Merged
tobias-tengler merged 1 commit into
mainfrom
tte/fix-settings-serializer
May 20, 2026
Merged

Fix schema settings serialization during export#9744
tobias-tengler merged 1 commit into
mainfrom
tte/fix-settings-serializer

Conversation

@tobias-tengler
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings May 20, 2026 07:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the JSON serialization behavior of the schema *-settings.json file during schema export, ensuring certain characters (e.g., </>) are preserved in their unescaped form when rewriting an existing settings file.

Changes:

  • Introduce shared JsonWriterOptions for settings file writing with JavaScriptEncoder.UnsafeRelaxedJsonEscaping.
  • Use the shared writer options in both “update existing settings file” and “create new settings file” code paths.
  • Add a regression test ensuring angle brackets remain unescaped after updating an existing settings file.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/HotChocolate/Core/src/Types/Execution/Internal/SchemaFileExporter.cs Reuses a shared Utf8JsonWriter configuration to preserve unescaped characters when writing settings JSON.
src/HotChocolate/AspNetCore/test/AspNetCore.CommandLine.Tests/SchemaExportCommandTests.cs Adds a regression test verifying angle brackets are preserved when an existing settings file is updated.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants