Skip to content

Conversation

@czechboy0
Copy link
Contributor

@czechboy0 czechboy0 commented Apr 2, 2024

Motivation

Fixes apple/swift-openapi-generator#525.

Turns out that the mere act of creating a decoding container is meaningful and we skipped it as an optimization, causing JSONDecoder to fail for empty dictionaries when used in additional properties.

Modifications

Remove the extra guards that skipped creating a container, even when we already know there are no elements.

Result

No more failures when encoding empty dictionaries in additionalProperties.

Test Plan

Tested manually as this requirement seems to be coming out of JSONDecoder.

@czechboy0 czechboy0 merged commit 634b7eb into apple:main Apr 3, 2024
@czechboy0 czechboy0 deleted the hd-fix-empty-additional-props-dictionary-encoding branch April 3, 2024 08:43
@czechboy0 czechboy0 added the 🔨 semver/patch No public API change. label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty Dictionary fails to encode

2 participants