Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the ISO8601 date transcoder configurable #94

Merged

Conversation

czechboy0
Copy link
Collaborator

@czechboy0 czechboy0 commented Jan 14, 2024

Motivation

Fixes apple/swift-openapi-generator#389.

Modifications

Add a way to configure the existing ISO8601DateTranscoder.

Result

Adopters can more easily use e.g. fractional seconds-based transcoder.

Test Plan

Added unit tests.

@czechboy0 czechboy0 merged commit 7f86e4a into apple:main Jan 16, 2024
8 checks passed
@czechboy0 czechboy0 deleted the hd-date-transcoder-with-fractional-seconds branch January 16, 2024 15:34
@czechboy0 czechboy0 added the semver/minor Adds new public API. label Jan 16, 2024
@nmtitov
Copy link

nmtitov commented Jan 16, 2024

@czechboy0 how to actually use new transcoder in projects?

@simonjbeaumont
Copy link
Collaborator

simonjbeaumont commented Jan 16, 2024

@czechboy0 how to actually use new transcoder in projects?

You specify the date transcoder when creating your client by providing it as a parameter to the Configuration initializer: https://swiftpackageindex.com/apple/swift-openapi-runtime/1.3.0/documentation/openapiruntime/configuration/init(datetranscoder:multipartboundarygenerator:)

The default is .iso8601 but you can now use .iso8601WithFractionalSeconds or pass in your own format options for use with the ISO8601DateFormatter.

@nmtitov
Copy link

nmtitov commented Jan 17, 2024

@simonjbeaumont thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support different options in ISO8601DateTranscoder
3 participants