fix(swift): emit JSONNull hash(into:) by default#2928
Conversation
Signed-off-by: Aysajan Eziz <aeziz@northset.ai>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7a233c5bc4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| this.emitMultiline(` public func hash(into hasher: inout Hasher) { | ||
| // No-op | ||
| }`); |
There was a problem hiding this comment.
Keep Swift 5 hashing behind the version option
For schemas that need JSONNull and are generated without --swift-5-support (the default, and the language is still exposed as swift4), this now emits hash(into:) and references Hasher unconditionally. Those APIs are not available on older Swift 4 toolchains, so the default Swift 4-compatible output will fail to compile even though the swift-5-support option is false.
Useful? React with 👍 / 👎.
M-019 (glideapps/quicktype#2928) merged upstream; refresh M-011 and M-012 publication envelopes from live PR state. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Description
Emit JSONNull.hash(into:) in default Swift output and add a focused generated-output regression for the Swift 5.9 deprecation warning.
Related Issue
Fixes #2423
Motivation and Context
Default Swift output emitted only the deprecated
hashValueprotocol implementation unless--swift-5-supportwas enabled.Previous Behaviour / Output
Default JSONNull output omitted
hash(into:), which produced the reported Swift 5.9 Hashable deprecation warning.New Behaviour / Output
Default JSONNull output includes
hash(into:)without requiring a renderer option. The Objective-C-support branch is unchanged.How Has This Been Tested?
npm run test:unit -- test/unit/swift-json-null-hashable.test.ts— passed in a network-isolated container.Screenshots (if appropriate)
Not applicable.
AI assistance was used; I reviewed and own this change.
Northset self-run record for commit
7a233c5bc4d1: M-019 receipt.It records the declared checks and published bundle provenance.
Contributor self-run; not maintainer verification.