-
Notifications
You must be signed in to change notification settings - Fork 30
[RFC 9651] Add support for Date type to RawStructuredFieldValues #41
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
[RFC 9651] Add support for Date type to RawStructuredFieldValues #41
Conversation
Motivation: [RFC 9651](https://www.ietf.org/rfc/rfc9651.html) added the Date Structured Type. Modifications: - Implement the parser and serializer for Date in the RawStructuredFieldValues module. Result: The RawStructuredFieldValues module will support the Date type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One or two notes here but otherwise this looks really good!
default: | ||
throw StructuredHeaderError.invalidItem | ||
} | ||
} | ||
|
||
private mutating func _parseAnIntegerOrDecimal() throws -> RFC9651BareItem { | ||
private mutating func _parseAnIntegerOrDecimal(isDate: Bool = false) throws -> RFC9651BareItem { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be defaulted: we'd rather see the explicit false
everywhere I think.
|
||
// Then, serialize as integer. | ||
guard let wideInt = Int64(exactly: date), validIntegerRange.contains(wideInt) else { | ||
throw StructuredHeaderError.invalidIntegerOrDecimal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably better to throw invalidDate
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one, thanks!
…alues (apple#41) Motivation: [RFC 9651](https://www.ietf.org/rfc/rfc9651.html) added the Display String Structured Type. Modifications: - Implement the parser and serializer for Display String in the RawStructuredFieldValues module. Result: The RawStructuredFieldValues module will support the Display String type.
…alues (apple#41) Motivation: [RFC 9651](https://www.ietf.org/rfc/rfc9651.html) added the Display String Structured Type. Modifications: - Implement the parser and serializer for Display String in the RawStructuredFieldValues module. Result: The RawStructuredFieldValues module will support the Display String type.
…alues (apple#41) Motivation: [RFC 9651](https://www.ietf.org/rfc/rfc9651.html) added the Display String Structured Type. Modifications: - Implement the parser and serializer for Display String in the RawStructuredFieldValues module. Result: The RawStructuredFieldValues module will support the Display String type.
Motivation:
RFC 9651 added the Date Structured Type.
Modifications:
Result:
The RawStructuredFieldValues module will support the Date type.