Skip to content

fix(reports): support arbitrary matchType ranges and drop unreleased deprecated fields - #425

Merged
andrii-bodnar merged 2 commits into
masterfrom
fix/reports-matchtype-deprecated-fields
Oct 28, 2026
Merged

andrii-bodnar merged 2 commits into
masterfrom
fix/reports-matchtype-deprecated-fields

Conversation

@katerina20

Copy link
Copy Markdown
Collaborator

Follow-up to #423. It resolves the two review questions left open there, checked against the official Crowdin OpenAPI specs.

1. matchType accepts any documented value

In every netRateSchemes schema (translation-costs-pe, costs-estimation-pe, group-translation-costs-pe, and the settings template plus its form), the API types matchType as a free string: perfect, 100, or any percentage range such as 100-82 or 100-74. Match only had the closed MatchType enum. As a result:

  • range values without a constant were read as null, so the value was silently lost;
  • such ranges could not be sent at all.

Changes in Match:

  • New field: String matchTypeValue (getMatchTypeValue()/setMatchTypeValue(String)) holds the raw value under the JSON key matchType.
  • Existing accessors kept: getMatchType() and setMatchType(MatchType) keep their exact signatures and work on top of the new field.
    • getMatchType() returns the constant for known values, and null only for ranges without a constant. The original value is always in matchTypeValue.
    • setMatchType(null) clears the value.
  • No overload added: there is no setMatchType(String), so existing calls such as setMatchType(null) stay unambiguous.
  • Scope: Match is shared by every netRateSchemes, so the fix covers report generation requests and settings templates (requests and responses).

2. Deprecated fields introduced in #423

Compared with the pre-#423 master (8cbdbfc7), #423 added these fields, all marked deprecated in the official OpenAPI. They are removed here:

Class Removed field Replacement
GenerateGroupReportRequest.GroupPreTranslateAccuracySchema postEditingCategories matchScoreCategories
GenerateGroupReportRequest.GroupTranslatorAccuracySchema postEditingCategories matchScoreCategories
GenerateGroupReportRequest.GroupTranslationCostsPostEditingByTaskSchema excludeApprovalsForEditedTranslations, preTranslatedStringsCategorizationAdjustment —
ReportSettingsTemplate.Config excludeApprovalsForEditedTranslations, preTranslatedStringsCategorizationAdjustment —
  • Kept: pre-existing public fields stay in place with @Deprecated.
    • postEditingCategories in PreTranslateAccuracyGenerateReportRequest and TranslateAccuracyGenerateReportRequest.
    • Both flags in TranslationCostsPostEndingGenerateReportRequest and GenerateGroupReportRequest.GroupTranslationCostsPostEditingSchema.
    • matchScoreCategories and the other non-deprecated replacements stay.
  • Fixtures: the two template response fixtures no longer contain the removed flags.

Backward compatibility

  • Against the last release (1.36.0) and the pre-feat(reports): update reports API to the latest docs #423 master: no public signature was removed or changed. Match keeps its constructor and every original accessor, and gains getMatchTypeValue()/setMatchTypeValue(String).
  • Against current master: the only removed members are the getters/setters of the 7 fields above. They were added by feat(reports): update reports API to the latest docs #423, which is not part of any release yet (latest tag: 1.36.0).
  • Null-ambiguity: no new null-ambiguous overloads.
  • Match equals/hashCode: these now compare the raw matchType string. The result is the same for every predefined value.
  • JSON key order: for Match, matchType is now written after price. Key order has no meaning in JSON.

Remaining risks

  • The enum stays closed: MatchType doesn't list every possible range, so getMatchType() keeps returning null for values without a constant. Callers who need those values must use getMatchTypeValue(). This is documented in the Javadoc.
  • No live API test: the behaviour was checked against the OpenAPI specs and mock tests, not against the live Crowdin API.

Testing

  • Reports tests: 73 passed, 0 failed.
    • New MatchTest (5 tests, using the real JacksonJsonTransformer): round trips for every MatchType constant through the enum accessors, known values parsed into the enum, custom ranges sent and parsed without loss, and enum setter/null behaviour.
    • New addPostEditingReportSettingsTemplateWithCustomMatchTypeRangesTest: a settings template with perfect, 100-82, 100-74 and 99-60 through ReportsApi, checking the request JSON and the response values.
    • The existing tests that use setMatchType(MatchType…) and their fixtures pass unchanged.
  • Full build (./gradlew build): 717 tests, 0 failures, on both JDK 17 and JDK 8.
  • Javadoc on JDK 8: no errors.
  • Schema checks:
    • Request and response fixtures for the settings template and the group and project cost reports were validated against the OpenAPI schemas.
    • The affected classes were compared field by field with the schemas. matchType is type: string with no enum in every context, and no non-deprecated field is missing.

🤖 Generated with Claude Code

katerina20 and others added 2 commits October 27, 2026 20:49
The API documents `matchType` in netRateSchemes as a free string
(`perfect`, `100` or any percentage range such as `100-82`), but Match
only had the closed MatchType enum, so ranges without a constant were
read as null and could not be sent.

Match now stores the raw value in `matchTypeValue` (JSON key
`matchType`). The existing getMatchType()/setMatchType(MatchType)
keep their signatures and work on top of it; getMatchType() returns
null only for values without a predefined constant, while the original
value stays available. No overload was added to setMatchType, so
existing calls stay unambiguous.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Remove fields that were introduced only in #423 and are marked
deprecated in the official API:
- postEditingCategories from GroupPreTranslateAccuracySchema and
  GroupTranslatorAccuracySchema (use matchScoreCategories)
- excludeApprovalsForEditedTranslations and
  preTranslatedStringsCategorizationAdjustment from
  GroupTranslationCostsPostEditingByTaskSchema and
  ReportSettingsTemplate.Config

They were never part of a release. Pre-existing deprecated fields stay
in place with @deprecated.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@andrii-bodnar
andrii-bodnar merged commit e04922e into master Oct 28, 2026
2 checks passed
@andrii-bodnar
andrii-bodnar deleted the fix/reports-matchtype-deprecated-fields branch October 28, 2026 07:36
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