Skip to content

feat: tolerate unknown enum values, update source files and branches API - #419

Merged
andrii-bodnar merged 2 commits into
masterfrom
feature/core-enums-source-files
Oct 19, 2026
Merged

andrii-bodnar merged 2 commits into
masterfrom
feature/core-enums-source-files

Conversation

@katerina20

Copy link
Copy Markdown
Collaborator

First part of updating the SDK to the current Crowdin API docs. It covers core enum handling, source files and branches.

Changes

fix(core): unknown enum values become null

Before, an enum value the SDK didn't know (for example one added to the API after a release) made the whole response fail with an IllegalArgumentException. EnumDeserializer now returns null for it, and the rest of the response is still usable.

feat(source-files): source files and branches

  • Import options:
    • Added the missing fields to Docx (28), Spreadsheet, Xml, Html and HtmlWithFrontMatter.
    • New import options classes: WebXml, Vsdx, Idml, Md, MdxV2, StringCatalog, Adoc and Vdf.
  • Export options: new classes for Md, MdxV1, MdxV2 and Docx, with the markdown settings as enums.
  • Reading options from responses:
    • Import and export options are now picked by the file type; distinctive keys are the fallback when there is no type.
    • Html, Md, Mdx and similar files get their specific options classes instead of always OtherFileImportOptions/GeneralFileExportOptions.
  • Enterprise custom fields: added fields to AddFileRequest and FileInfo/File.
  • Branches:
    • Added isProtected (string-based projects) to Branch, AddBranchRequest, CloneBranchRequest and ClonedBranch.
    • Added dryRun to BranchMergeStatus attributes and acceptSourceChanges to BranchMergeSummary.
  • Deprecated: FileRevision.info and its classes, which are no longer in the API.
  • Javadoc: checkMergeBranchStatus now links api.projects.branches.merges.get instead of clones.get, and the clone and merge methods now have Enterprise links.

Backward compatibility

  • Signatures: no public method, field or class was removed, renamed or retyped. Everything else is additive.
  • Class hierarchy: HtmlFileImportOptions, HtmlWithFrontMatterFileImportOptions and MdxV1FileImportOptions now extend OtherFileImportOptions. Their contentSegmentation/srxStorageId accessors are inherited with identical signatures, so this stays binary compatible.
  • Behaviour changes:
    • Unknown enum values now read as null instead of throwing. A switch on such a value would throw a NullPointerException.
    • File options in responses now come back as the more specific subclasses. instanceof OtherFileImportOptions/GeneralFileExportOptions still holds, but code comparing getClass() exactly will see a different class.
    • equals/hashCode/toString include the new fields.

Testing

  • ./gradlew build: 617 tests, 0 failures, on both JDK 17 and JDK 8.
  • ./gradlew javadoc on JDK 8, as the docs workflow runs it: no errors.
  • New and updated tests:
    • FileOptionsDeserializationTest round-trips every options class and covers the fallback without a type.
    • The file and branch mock tests and fixtures cover the new request and response fields.
    • EnumSerializationTest covers unknown enum values.

🤖 Generated with Claude Code

katerina20 and others added 2 commits October 18, 2026 21:12
Enum values the SDK does not know yet (for example ones added to the
API after a release) used to make the whole response fail with an
IllegalArgumentException. They are now deserialized as null so the
rest of the response is still usable.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…t docs

Source files:
- add missing import options fields (Docx, Spreadsheet, Xml, Html,
  HtmlWithFrontMatter) and new import options classes for WebXml, Vsdx,
  Idml, Md, MdxV2, StringCatalog, Adoc and Vdf files
- add export options classes for Md, MdxV1, MdxV2 and Docx files
- add Enterprise custom `fields` to AddFileRequest and FileInfo/File
- resolve import/export options by the file type, so Html, Md, Mdx and
  other richer options are returned instead of the generic classes;
  new classes extend OtherFileImportOptions/GeneralFileExportOptions so
  existing casts keep working
- deprecate FileRevision.info, which is no longer part of the API

Branches:
- add isProtected to Branch, AddBranchRequest, CloneBranchRequest and
  ClonedBranch (string-based projects)
- add dryRun to BranchMergeStatus attributes and acceptSourceChanges to
  BranchMergeSummary
- fix the checkMergeBranchStatus Javadoc link and add Enterprise links

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@andrii-bodnar
andrii-bodnar merged commit 6ac1b70 into master Oct 19, 2026
2 checks passed
@andrii-bodnar
andrii-bodnar deleted the feature/core-enums-source-files branch October 19, 2026 06:22
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