Skip to content

Conversation

@freeznet
Copy link
Member

@freeznet freeznet commented Dec 2, 2025

(If this PR fixes a github issue, please add Fixes #<xyz>.)

Fixes #175

(or if this PR is one task of a github issue, please add Master Issue: #<xyz> to link to the master issue.)

Master Issue: #

Motivation

Explain here the context, and why you're making that change. What is the problem you're trying to solve.

Modifications

Describe the modifications you've done.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Documentation

Check the box below.

Need to update docs?

  • doc-required

    (If you need help on updating docs, create a doc issue)

  • no-need-doc

    (Please explain why)

  • doc

    (If this PR contains doc changes)

@freeznet freeznet self-assigned this Dec 2, 2025
@github-actions
Copy link

github-actions bot commented Dec 2, 2025

@freeznet:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

@github-actions github-actions bot added the doc-info-missing This pr needs to mark a document option in description label Dec 2, 2025
@freeznet freeznet marked this pull request as ready for review December 2, 2025 13:21
@freeznet freeznet requested a review from a team as a code owner December 2, 2025 13:21
@freeznet freeznet requested a review from Copilot December 2, 2025 15:16
Copy link
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 issue #175 by implementing JSON normalization for schema data to prevent Terraform from detecting drift when only whitespace formatting differs between the configuration and stored state. The solution adds a DiffSuppressFunc that normalizes JSON schemas before comparison and updates the Read function to store normalized schema data in state.

Key Changes:

  • Added JSON normalization logic that canonicalizes JSON strings while preserving non-JSON schemas
  • Implemented DiffSuppressFunc for the schema_data field to suppress whitespace-only differences
  • Added comprehensive test coverage for the whitespace drift scenario

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pulsar/resource_pulsar_schema.go Adds normalizeSchemaData function for JSON canonicalization, implements DiffSuppressFunc for schema_data field, and updates Read function to normalize retrieved schema data
pulsar/resource_pulsar_schema_test.go Adds TestPulsarSchemaWhitespaceDiff test with compact and pretty-printed JSON configurations to verify whitespace drift is properly suppressed

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

maxsxu
maxsxu previously approved these changes Dec 4, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@freeznet freeznet merged commit 60163a3 into master Dec 4, 2025
4 checks passed
@freeznet freeznet deleted the freeznet/fix-schema-drifty branch December 4, 2025 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-info-missing This pr needs to mark a document option in description

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Schema resource causes persistent whitespace-only diffs

3 participants