From 89d49d2f2b7e669b37fdf6f262f457e43fd04639 Mon Sep 17 00:00:00 2001 From: Si Beaumont Date: Wed, 2 Oct 2024 11:28:48 +0100 Subject: [PATCH 1/2] ci: Add missing environment variable to integration-test (#641) ### Motivation When we migrated the CI to Github Actions we lost an important configuration for the integration test that makes sure we're using the copy of this repo from the PR, rather than cloning from upstream. This can be seen in the logs of recent PR jobs: ``` ** Cloning https://github.com/apple/swift-openapi-generator to /tmp/run-integration-test.sh.SUVBe45RMQ/swift-openapi-generator Cloning into '/tmp/run-integration-test.sh.SUVBe45RMQ/swift-openapi-generator'... ** Extracting name for Swift package: /__w/swift-openapi-generator/swift-openapi-generator ** Overriding dependency in /tmp/run-integration-test.sh.SUVBe45RMQ/swift-openapi-generator/IntegrationTest on swift-openapi-generator to use /__w/swift-openapi-generator/swift-openapi-generator ``` This used to be specified in the Docker Compose file as an environment variable but dropped off during migration. ### Modifications Add the environment variable back to use `file://${GITHUB_WORKSPACE}` for the clone. Note that one cannot use the `env:` map when making use of a reusable GitHub workflow with `uses:` so it's been added in the command passed to the matrix job, itself. ### Result The integration test CI will use this repo for the test itself so we can make sure we're testing the right thing. ### Test Plan The logs on _this_ PR job show that we're now cloning from the GitHub workspace: ``` ** Cloning file:///__w/swift-openapi-generator/swift-openapi-generator to /tmp/run-integration-test.sh.OWgemDungm/swift-openapi-generator Cloning into '/tmp/run-integration-test.sh.OWgemDungm/swift-openapi-generator'... Note: switching to '9664e9cb2170a5fa8a1bad3266891d4b4248e6ba'. ... ** Extracting name for Swift package: /__w/swift-openapi-generator/swift-openapi-generator ** Overriding dependency in /tmp/run-integration-test.sh.OWgemDungm/swift-openapi-generator/IntegrationTest on swift-openapi-generator to use /__w/swift-openapi-generator/swift-openapi-generator ``` --- .github/workflows/pull_request.yml | 2 +- .github/workflows/scheduled.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 76f71961..8c598a5a 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -33,7 +33,7 @@ jobs: uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main with: name: "Integration test" - matrix_linux_command: "apt-get update -yq && apt-get install -yq jq && ./scripts/run-integration-test.sh" + matrix_linux_command: "apt-get update -yq && apt-get install -yq jq && SWIFT_OPENAPI_GENERATOR_REPO_URL=file://${GITHUB_WORKSPACE} ./scripts/run-integration-test.sh" matrix_linux_5_8_enabled: false matrix_linux_nightly_main_enabled: false diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml index cb5f46df..6c367b83 100644 --- a/.github/workflows/scheduled.yml +++ b/.github/workflows/scheduled.yml @@ -20,7 +20,7 @@ jobs: uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main with: name: "Integration test" - matrix_linux_command: "apt-get update -yq && apt-get install -yq jq && ./scripts/run-integration-test.sh" + matrix_linux_command: "apt-get update -yq && apt-get install -yq jq && SWIFT_OPENAPI_GENERATOR_REPO_URL=file://${GITHUB_WORKSPACE} ./scripts/run-integration-test.sh" matrix_linux_5_8_enabled: false example-packages: From de51f3d9fd470464f8b44c84518a451b540aed2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Heidekr=C3=BCger?= Date: Thu, 3 Oct 2024 10:59:28 -0700 Subject: [PATCH 2/2] Docs: Reference Handling of Custom Terminating Byte Sequences (#625) ### Motivation See: https://github.com/apple/swift-openapi-runtime/pull/115 ### Modifications This PR references the changes introduced by TODO in the documentation. ### Result Users planning to generate code for OpenAPI specs with custom terminating byte sequences will hopefully find it easier to make the necessary changes in their code. Please let me know if there are other places where these changes could be mentioned. ### Test Plan . --------- Co-authored-by: Honza Dvorsky --- .../Documentation.docc/Articles/Useful-OpenAPI-patterns.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/swift-openapi-generator/Documentation.docc/Articles/Useful-OpenAPI-patterns.md b/Sources/swift-openapi-generator/Documentation.docc/Articles/Useful-OpenAPI-patterns.md index 7c6140ab..258848f3 100644 --- a/Sources/swift-openapi-generator/Documentation.docc/Articles/Useful-OpenAPI-patterns.md +++ b/Sources/swift-openapi-generator/Documentation.docc/Articles/Useful-OpenAPI-patterns.md @@ -113,8 +113,9 @@ The returned binary body contains the raw events, and the stream can be split up - encode: `AsyncSequence.asEncodedJSONSequence(encoder:)` - Server-sent Events - decode (if data is JSON): `AsyncSequence>.asDecodedServerSentEventsWithJSONData(of:decoder:)` + - decode (if data is JSON with a non-JSON terminating byte sequence): `AsyncSequence>.asDecodedServerSentEventsWithJSONData(of:decoder:while:)` - encode (if data is JSON): `AsyncSequence.asEncodedServerSentEventsWithJSONData(encoder:)` - - decode (for other data): `AsyncSequence>.asDecodedServerSentEvents()` + - decode (for other data): `AsyncSequence>.asDecodedServerSentEvents(while:)` - encode (for other data): `AsyncSequence.asEncodedServerSentEvents()` See the `event-streams-*` client and server examples in to learn how to produce and consume these sequences.