Skip to content

[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

Merged
merged 2 commits into from
Oct 28, 2024

Conversation

clintonpi
Copy link
Contributor

Motivation:

RFC 9651 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.

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.
@Lukasa Lukasa added the 🆕 semver/minor Adds new public API. label Oct 25, 2024
Copy link
Contributor

@Lukasa Lukasa left a 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 {
Copy link
Contributor

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
Copy link
Contributor

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.

@clintonpi clintonpi requested a review from Lukasa October 25, 2024 15:41
Copy link
Contributor

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one, thanks!

@Lukasa Lukasa merged commit b0bf94f into apple:main Oct 28, 2024
5 of 6 checks passed
@clintonpi clintonpi deleted the rfc-9651/raw-support-for-date-type branch October 28, 2024 14:02
clintonpi added a commit to clintonpi/swift-http-structured-headers that referenced this pull request Nov 14, 2024
…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.
clintonpi added a commit to clintonpi/swift-http-structured-headers that referenced this pull request Nov 14, 2024
…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.
clintonpi added a commit to clintonpi/swift-http-structured-headers that referenced this pull request Nov 14, 2024
…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.
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.

2 participants