A form is broader than a request
Editor state may include filenames, notes, reviewer IDs, experimental toggles and display-only options. A generic spread makes a new UI field an accidental API parameter. Explicit construction keeps the external contract separate from your application's internal data model.
What to do next
- 01
Define builders per operation
Create separate video, image and text request builders using the currently reviewed schema. Resolve supported defaults deliberately, and reject operation-incompatible controls before they become part of an approved snapshot.
- 02
Test accidental field additions
Add a private application note and an unrelated UI toggle to the form fixture. Assert neither appears in the serialized request, and verify unsupported capabilities such as image editing are not inferred from available upload widgets.
- 03
Review serializer output
Capture the exact outbound JSON in offline tests and compare its keys and values with the approved request snapshot. Keep sensitive real prompts out of snapshots used in a public repository.
A concrete example
Illustrative example: the project form gains an internal reviewerEmail field. The image builder still emits only its supported generation fields, so the address never reaches the API and does not trigger an unsupported-parameter rejection.
Before you call it ready
- Builders emit explicit supported keys.
- Private form fields never leave the app.
- Each operation has its own serializer test.
A locally executed, reproducible check
Copying a parsed special property with Object.assign changes the new object’s prototype in this fixture.
We executed this exact synthetic fixture on November 16, 2026 with Node v24.16.0. It ran locally with no network requests, account data or model generation. The recorded output below is an observation from that environment, not a platform benchmark. Copy the code into a separate CommonJS file to repeat it with the stated dependencies in a suitable local Node environment; compare the mechanism and check your runtime version.
const input=JSON.parse('{"prompt":"synthetic draft","__proto__":{"debug":true}}');
const assigned=Object.assign({},input);
const explicit={prompt:input.prompt};
console.log('assigned inherited debug:',assigned.debug);
console.log('assigned own debug:',Object.hasOwn(assigned,'debug'));
console.log('explicit debug:',String(explicit.debug));
console.log('global prototype affected:',Object.hasOwn(Object.prototype,'debug'));
Recorded output and interpretation
The fixture affects only a newly created local object; it does not alter Object.prototype or exploit a service. Explicit copying is not a substitute for validating each permitted field. Do not assume every object-copy operation has Object.assign’s semantics or forward untrusted object structure wholesale.
A matching local output establishes only the illustrated library or database behavior under these inputs. It does not certify a production integration. Preserve the approved action, authorization boundaries and current AISwapLab request contract when applying the idea.
assigned inherited debug: true
assigned own debug: false
explicit debug: undefined
global prototype affected: false
When to stop or choose another method
Stop using object spread from mutable UI or model-generated state as the outbound generation payload.
