Repository navigation
fix(turbosign): send required:false for optional signer fields - #85
Merged
Merged
Conversation
added 2 commits
October 4, 2026 11:18
TurboSign fields accept `required` (default true). Setting it to false makes the field optional for the signer. Go and PHP could not send false: - go-sdk: Field.Required is now *bool with omitempty. nil omits the key (required), BoolPtr(false) sends false. Source-breaking for callers that wrote `Required: true`; use `Required: turbodocx.BoolPtr(true)`. - php-sdk: Field::$required is now ?bool (default null) and is sent whenever it is not null, so an explicit false reaches the API. JS, Python, Java and Ruby already passed false through; each gets a request payload test plus doc updates. Signature and initial fields are always required (the API rejects required:false on them with a 400).
Adds OptionalNotSupported, InvalidFieldRequired and NoEditableFieldsForRecipient to each SDK's error-code table, and a cross-SDK parity rule for the field `required` flag: keep unset, true and false apart and never send it on a truthiness check. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #86
Summary
TurboSign fields accept a
requiredboolean. It defaults totrue;required: falsemakes the field optional for the signer. This PR makes sure every SDK can sendrequired: falseand that it reaches the request body.Go and PHP could not send it before:
Field.Requiredwas a plainboolwithomitempty, sofalsewas always dropped. It is now*boolwithomitempty:nilomits the key (required),turbodocx.BoolPtr(false)sendsfalse, using the existingBoolPtrhelper.Required: true. Change it toRequired: turbodocx.BoolPtr(true), or drop it, since omitted already means required. In-repo examples andcmd/manualare updated.Field::$requiredwasbool $required = falseand only sent whentrue. It is now?bool $required = nulland is sent whenever it is not null.required: falseused to be silently dropped and is now sent. On asignatureorinitialfield, that now returns a 400 from the API instead of being ignored.JS, Python, Java and Ruby already passed
falsethrough. Each of them gets a payload test in this PR, plus doc updates.API rules
requiredmeans the field is required.required: falseon asignatureorinitialfield is rejected with 400OptionalNotSupported. This rule is documented on the field in each SDK.requiredis rejected with 400InvalidFieldRequired.NoEditableFieldsForRecipient.The SDKs do not validate these rules client-side. A rejection is surfaced as a 400
ValidationError.Tests
Every SDK has a new test with three fields (
required: true,required: false, and norequired) that checks the serializedfieldspart:true,false, and the key absent. JS, Python, Go, Java and Ruby check the request captured by their mocked HTTP layer. PHP has no HTTP-mocked TurboSign test, so its test checksfieldsencoded the same wayTurboSignbuilds it (json_encodeof eachField::toArray()).npm run build && npx jest*boolvsbool)go test ./...,go vet -tags manual ./cmd/manual/requiredkey missing)composer test,composer phpstan,composer cs-fix -- --dry-runBoolean.FALSE, drops null)mvn test -Bpytestbundle exec rspecNote:
go-sdk/examples/turbosign_advanced.go(//go:build ignore) already failsgo vetonmainbecause of an unrelatedrecipient.Statusreference. This PR does not touch that line.No version bump; this follows the repo convention of bumping in a separate lockstep release. Because of the Go change, that release should be a minor bump.
🤖 Generated with Claude Code