Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement custom Json Marshaller for AssessmentReport struct #2205

Closed
wants to merge 2 commits into from

Conversation

sanyamsinghal
Copy link
Collaborator

@sanyamsinghal sanyamsinghal commented Jan 17, 2025

Describe the changes in this pull request

  • using this we can achieve different content in json output for assessment report vs ybd payload

Assessment Report struct

type AssessmentReport struct {
	VoyagerVersion                 string                                `json:"VoyagerVersion"`
	TargetDBVersion                *ybversion.YBVersion                  `json:"TargetDBVersion"`
	MigrationComplexity            string                                `json:"MigrationComplexity"`
	MigrationComplexityExplanation string                                `json:"MigrationComplexityExplanation"`
	SchemaSummary                  utils.SchemaSummary                   `json:"SchemaSummary"`
	Sizing                         *migassessment.SizingAssessmentReport `json:"Sizing"`
	Issues                         []AssessmentIssue                     `json:"-"` // disabled in reports till corresponding UI changes are done(json and html reports)
	TableIndexStats                *[]migassessment.TableIndexStats      `json:"TableIndexStats"`
	Notes                          []string                              `json:"Notes"`
	SerializationMode              string                                `json:"-"` // field to control serialization of json

	// fields going to be deprecated
	UnsupportedDataTypes       []utils.TableColumnsDataTypes     `json:"UnsupportedDataTypes"`
	UnsupportedDataTypesDesc   string                            `json:"UnsupportedDataTypesDesc"`
	UnsupportedFeatures        []UnsupportedFeature              `json:"UnsupportedFeatures"`
	UnsupportedFeaturesDesc    string                            `json:"UnsupportedFeaturesDesc"`
	UnsupportedQueryConstructs []utils.UnsupportedQueryConstruct `json:"UnsupportedQueryConstructs"`
	UnsupportedPlPgSqlObjects  []UnsupportedFeature              `json:"UnsupportedPlPgSqlObjects"`
	MigrationCaveats           []UnsupportedFeature              `json:"MigrationCaveats"`
}

For ybd we need all the fields.
For Assessment report json we only need the fields before the comment - // fields going to be deprecated

Have to add a extra field SerializationMode just for the purpose of marshalling, this won't be transmitted further(only in memory).

Describe if there are any user-facing changes

NA

How was this pull request tested?

Existing test enough.

Does your PR have changes that can cause upgrade issues?

Component Breaking changes?
MetaDB No
Name registry json No
Data File Descriptor Json No
Export Snapshot Status Json No
Import Data State No
Export Status Json No
Data .sql files of tables No
Export and import data queue No
Schema Dump No
AssessmentDB No
Sizing DB No
Migration Assessment Report Json No (not json actually, but struct has changed which shouldn't impact upgradability)
Callhome Json No
YugabyteD Tables No
TargetDB Metadata Tables No

- using this we can achieve different content in json output for assessment report vs ybd payload
@sanyamsinghal sanyamsinghal self-assigned this Jan 17, 2025
@sanyamsinghal sanyamsinghal marked this pull request as ready for review January 17, 2025 13:57
@sanyamsinghal sanyamsinghal requested review from makalaaneesh and priyanshi-yb and removed request for makalaaneesh January 17, 2025 13:58
@sanyamsinghal
Copy link
Collaborator Author

closing this, as already covered in - #2237

@sanyamsinghal sanyamsinghal deleted the sanyam/custom-marshaller branch January 23, 2025 11:04
@sanyamsinghal sanyamsinghal restored the sanyam/custom-marshaller branch January 23, 2025 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants