Repository navigation
feat(ir): mark optional file properties in the dynamic IR - #18378
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
There was a problem hiding this comment.
Adds an optional isOptional flag to dynamic IR file-upload properties, bumps the IR version, regenerates the ir-sdk types/serializers, and refreshes snapshots. The visible diff is almost entirely generated JSON snapshots plus new test definitions; the core converter and schema changes weren't included in the truncated portion I could see. No actionable issues found in the available diff.
Review Scope
- Mode: Full pull request
- Range:
Full pull request through e49dfad7a76434206ae25c1a011e37caa95478b5 - Current range coverage: Incomplete
- Cumulative pull request coverage: Incomplete
- Limitations: diff size limit, one or more patches unavailable
- Cumulative limitations: diff size limit, one or more patches unavailable
Review finished for the available portion of this range. Coverage is incomplete, so unreviewed changes may remain.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Review: dynamic IR isOptional on file properties
Verdict: the core change looks right and isn't breaking. One scope issue should be fixed before merge: 10 unrelated snapshot files.
What I checked
DynamicSnippetsConvertercopiesFilePropertySingle.isOptional/FilePropertyArray.isOptionalfrom the full IR, and both the Fern-definition path (parseRawFileType) and the OpenAPI v3 path (RequestBodyConverter) set it. The snapshots look right:file/file_listarefalse,maybe_file/maybe_file_listaretrue, in bothir-generator-testsandv3-importer-tests.- Wire compatibility: the field is
optional<boolean>and nothing else in the union's shape changes. Generators pinned to v66 get it removed during migration (IntermediateRepresentationMigratorparses withunrecognizedObjectKeys: "strip"). Thegenerators/*/dynamic-snippetsFilePropertyMappers only readwireValue/name, and fern-platformpackages/snippetsimports@fern-api/dynamic-ir-sdkas types only (no runtime schema parse). So an older consumer just ignores the field. - Versioning: additive minor 67.33.0 -> 67.34.0 with an IR changelog entry, no migration needed (per
packages/ir-sdk/CLAUDE.md), and a CLIfeatchangelog. The regeneratedir-sdktypes and serializers match the YAML.
Requested change
- Remove the 10 unrelated snapshot files (see inline). They make up about 9.7k of the 9.9k added lines.
Nits (optional)
- Add guidance to the
isOptionaldocs on how consumers should treat an unset value (see inline). - The IR changelog date.
CI: test, test-ete and lint were still pending when I reviewed.
…hangelog date Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Docs Generation Benchmark ResultsComparing PR branch against median of 5 nightly run(s) on
Docs generation runs |
SDK Generation Benchmark ResultsComparing PR branch against median of 5 nightly run(s) on Full benchmark table (click to expand)
main (generator): generator-only time via --skip-scripts (includes Docker image build, container startup, IR parsing, and code generation — this is the same Docker-based flow customers use via |
Description
Linear ticket: Refs N/A
The dynamic IR doesn't say whether a file-upload property is required, so dynamic snippet generators can't tell a required file (which needs a placeholder) from an optional one (which should be left out). The full IR already has this as
FilePropertySingle.isOptional/FilePropertyArray.isOptional; this passes it through to the dynamic IR.Changes Made
dynamic.FileUploadRequestBodyFileProperty(extendsNameAndWireValue, addsisOptional: optional<boolean>), used by thefileandfileArrayvariants ofdynamic.FileUploadRequestBodyProperty. The field is optional and the wire shape is otherwise the same, so older consumers ignore it.DynamicSnippetsConverterfills it from the full IR file property.packages/ir-sdkand updated dynamic IR snapshots (ir-generator-tests,v3-importer-tests): the only change is the newisOptionalfield on file properties.Follow-ups: the TypeScript (#18323) and Ruby (#18325) dynamic snippet PRs will use this to add placeholders only for required files, once
@fern-api/dynamic-ir-sdk67.34.0 is published.Testing
ir-generator-tests597 passed; snapshots showisOptional: falsefor requiredfile/file_listandtrueformaybe_filein thefile-uploadfixture)Link to Devin session: https://app.devin.ai/sessions/e71a3ab9f283405cb547310ce6dac721
Open in Devin Desktop: https://app.devin.ai/desktop/session/e71a3ab9f283405cb547310ce6dac721?variant=devin
Requested by: @willkendall01