Skip to content

Commit d95a83f

Browse files
authored
Fix documentation and add infrastructure for CI-ing it (#31)
1 parent 2e4ee75 commit d95a83f

File tree

10 files changed

+53
-7
lines changed

10 files changed

+53
-7
lines changed

Sources/RawStructuredFieldValues/Docs.docc/index.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ A Swift implementation of the HTTP Structured Header Field Value specification.
44

55
Provides parsing and serialization facilities for structured header field values.
66

7-
## About Structured Header Field Values
7+
## Overview
8+
9+
### About Structured Header Field Values
810

911
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.
1012

11-
## Swift HTTP Structured Header Field Values
13+
### Swift HTTP Structured Header Field Values
1214

1315
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.
1416

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

2325
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.
2426

25-
## Working with Structured Header Field Values
27+
### Working with Structured Header Field Values
2628

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

Sources/StructuredFieldValues/Docs.docc/index.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ A Swift implementation of the HTTP Structured Header Field Value specification.
44

55
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.
66

7-
## About Structured Header Field Values
7+
## Overview
8+
9+
### About Structured Header Field Values
810

911
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.
1012

11-
## Swift HTTP Structured Header Field Values
13+
### Swift HTTP Structured Header Field Values
1214

1315
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.
1416

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

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

21-
## Working with Structured Header Field Values
23+
### Working with Structured Header Field Values
2224

2325
`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:
2426

docker/docker-compose.2004.55.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ services:
1212
unit-tests:
1313
image: swift-http-structured-headers:20.04-5.5
1414

15+
documentation-check:
16+
image: swift-http-structured-headers:20.04-5.5
17+
1518
test:
1619
image: swift-http-structured-headers:20.04-5.5
1720

docker/docker-compose.2004.56.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ services:
1212
unit-tests:
1313
image: swift-http-structured-headers:20.04-5.6
1414

15+
documentation-check:
16+
image: swift-http-structured-headers:20.04-5.6
17+
1518
test:
1619
image: swift-http-structured-headers:20.04-5.6
1720

docker/docker-compose.2204.57.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ services:
1212
unit-tests:
1313
image: swift-http-structured-headers:22.04-5.7
1414

15+
documentation-check:
16+
image: swift-http-structured-headers:22.04-5.7
17+
1518
test:
1619
image: swift-http-structured-headers:22.04-5.7
1720

docker/docker-compose.2204.58.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ services:
1212
unit-tests:
1313
image: swift-http-structured-headers:22.04-5.8
1414

15+
documentation-check:
16+
image: swift-http-structured-headers:22.04-5.8
17+
1518
test:
1619
image: swift-http-structured-headers:22.04-5.8
1720
environment:

docker/docker-compose.2204.main.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ services:
1212
unit-tests:
1313
image: swift-http-structured-headers:22.04-main
1414

15+
documentation-check:
16+
image: swift-http-structured-headers:22.04-main
17+
1518
test:
1619
image: swift-http-structured-headers:22.04-main
1720
environment:

docker/docker-compose.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ services:
3030
<<: *common
3131
command: /bin/bash -xcl "swift test --enable-test-discovery -Xswiftc -warnings-as-errors"
3232

33+
documentation-check:
34+
<<: *common
35+
command: /bin/bash -xcl "./scripts/check-docs.sh"
36+
3337
test:
3438
<<: *common
3539
command: /bin/bash -xcl "swift test --enable-test-discovery -Xswiftc -warnings-as-errors $${SANITIZER_ARG-} $${IMPORT_CHECK_ARG-}"

scripts/check-docs.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
##===----------------------------------------------------------------------===##
3+
##
4+
## This source file is part of the SwiftNIO open source project
5+
##
6+
## Copyright (c) 2023 Apple Inc. and the SwiftNIO project authors
7+
## Licensed under Apache License v2.0
8+
##
9+
## See LICENSE.txt for license information
10+
## See CONTRIBUTORS.txt for the list of SwiftNIO project authors
11+
##
12+
## SPDX-License-Identifier: Apache-2.0
13+
##
14+
##===----------------------------------------------------------------------===##
15+
16+
set -eu
17+
18+
raw_targets=$(sed -E -n -e 's/^.* - documentation_targets: \[(.*)\].*$/\1/p' .spi.yml)
19+
targets=(${raw_targets//,/ })
20+
21+
for target in "${targets[@]}"; do
22+
swift package plugin generate-documentation --target "$target" --warnings-as-errors --analyze --level detailed
23+
done

scripts/soundness.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ set -eu
1717
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1818
function replace_acceptable_years() {
1919
# this needs to replace all acceptable forms with 'YEARS'
20-
sed -e 's/202[01]-202[012]/YEARS/' -e 's/202[012]/YEARS/'
20+
sed -e 's/202[0123]-202[0123]/YEARS/' -e 's/202[0123]/YEARS/'
2121
}
2222

2323

0 commit comments

Comments
 (0)