Skip to content

Fix documentation and add infrastructure for CI-ing it #31

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 1 commit into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Sources/RawStructuredFieldValues/Docs.docc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ A Swift implementation of the HTTP Structured Header Field Value specification.

Provides parsing and serialization facilities for structured header field values.

## About Structured Header Field Values
## Overview

### About Structured Header Field Values

HTTP Structured Header Field Values are a HTTP extension recorded in [RFC 8941](https://www.rfc-editor.org/rfc/rfc8941.html). They provide a set of data types and algorithms for handling HTTP header field values in a consistent way, allowing a single parser and serializer to handle a wide range of header field values.

## Swift HTTP Structured Header Field Values
### Swift HTTP Structured Header Field Values

This package provides a parser and serializer that implement RFC 8941. They are entirely complete, able to handle all valid HTTP structured header field values.

Expand All @@ -22,7 +24,7 @@ The upper-level module, `StructuredFieldValues`, brings along the `Encoder` and

In most cases users should prefer to use `StructuredFieldValues` unless they know they need the performance advantages of `RawStructuredFieldValues`. The experience will be much better.

## Working with Structured Header Field Values
### Working with Structured Header Field Values

`RawStructuredFieldValues` has a powerful API for working with structured header field values.

Expand Down
8 changes: 5 additions & 3 deletions Sources/StructuredFieldValues/Docs.docc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ A Swift implementation of the HTTP Structured Header Field Value specification.

Provides parsing and serialization facilities for structured header field values, as well as implementations of `Encoder` and `Decoder` to allow using `Codable` data types as the payloads of HTTP structured header fields.

## About Structured Header Field Values
## Overview

### About Structured Header Field Values

HTTP Structured Header Field Values are a HTTP extension recorded in [RFC 8941](https://www.rfc-editor.org/rfc/rfc8941.html). They provide a set of data types and algorithms for handling HTTP header field values in a consistent way, allowing a single parser and serializer to handle a wide range of header field values.

## Swift HTTP Structured Header Field Values
### Swift HTTP Structured Header Field Values

This package provides a parser and serializer that implement RFC 8941. They are entirely complete, able to handle all valid HTTP structured header field values. This package also provides `Encoder` and `Decoder` objects for working with Codable in Swift. This allows rapid prototyping and experimentation with HTTP structured header field values, as well as interaction with the wider Swift Codable community.

Expand All @@ -18,7 +20,7 @@ This module, `StructuredFieldValues`, use the related module `RawStructuredField

Users who have performance problems with this solution or have specific representational needs should investigate `RawStructuredFieldValues`.

## Working with Structured Header Field Values
### Working with Structured Header Field Values

`StructuredFieldValues` has a simple, easy-to-use high-level API for working with structured header field values. To begin with, let's consider the [HTTP Client Hints specification](https://www.rfc-editor.org/rfc/rfc8942.html). This defines the following new header field:

Expand Down
3 changes: 3 additions & 0 deletions docker/docker-compose.2004.55.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ services:
unit-tests:
image: swift-http-structured-headers:20.04-5.5

documentation-check:
image: swift-http-structured-headers:20.04-5.5

test:
image: swift-http-structured-headers:20.04-5.5

Expand Down
3 changes: 3 additions & 0 deletions docker/docker-compose.2004.56.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ services:
unit-tests:
image: swift-http-structured-headers:20.04-5.6

documentation-check:
image: swift-http-structured-headers:20.04-5.6

test:
image: swift-http-structured-headers:20.04-5.6

Expand Down
3 changes: 3 additions & 0 deletions docker/docker-compose.2204.57.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ services:
unit-tests:
image: swift-http-structured-headers:22.04-5.7

documentation-check:
image: swift-http-structured-headers:22.04-5.7

test:
image: swift-http-structured-headers:22.04-5.7

Expand Down
3 changes: 3 additions & 0 deletions docker/docker-compose.2204.58.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ services:
unit-tests:
image: swift-http-structured-headers:22.04-5.8

documentation-check:
image: swift-http-structured-headers:22.04-5.8

test:
image: swift-http-structured-headers:22.04-5.8
environment:
Expand Down
3 changes: 3 additions & 0 deletions docker/docker-compose.2204.main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ services:
unit-tests:
image: swift-http-structured-headers:22.04-main

documentation-check:
image: swift-http-structured-headers:22.04-main

test:
image: swift-http-structured-headers:22.04-main
environment:
Expand Down
4 changes: 4 additions & 0 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ services:
<<: *common
command: /bin/bash -xcl "swift test --enable-test-discovery -Xswiftc -warnings-as-errors"

documentation-check:
<<: *common
command: /bin/bash -xcl "./scripts/check-docs.sh"

test:
<<: *common
command: /bin/bash -xcl "swift test --enable-test-discovery -Xswiftc -warnings-as-errors $${SANITIZER_ARG-} $${IMPORT_CHECK_ARG-}"
Expand Down
23 changes: 23 additions & 0 deletions scripts/check-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
##===----------------------------------------------------------------------===##
##
## This source file is part of the SwiftNIO open source project
##
## Copyright (c) 2023 Apple Inc. and the SwiftNIO project authors
## Licensed under Apache License v2.0
##
## See LICENSE.txt for license information
## See CONTRIBUTORS.txt for the list of SwiftNIO project authors
##
## SPDX-License-Identifier: Apache-2.0
##
##===----------------------------------------------------------------------===##

set -eu

raw_targets=$(sed -E -n -e 's/^.* - documentation_targets: \[(.*)\].*$/\1/p' .spi.yml)
targets=(${raw_targets//,/ })

for target in "${targets[@]}"; do
swift package plugin generate-documentation --target "$target" --warnings-as-errors --analyze --level detailed
done
2 changes: 1 addition & 1 deletion scripts/soundness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set -eu
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
function replace_acceptable_years() {
# this needs to replace all acceptable forms with 'YEARS'
sed -e 's/202[01]-202[012]/YEARS/' -e 's/202[012]/YEARS/'
sed -e 's/202[0123]-202[0123]/YEARS/' -e 's/202[0123]/YEARS/'
}


Expand Down