Skip to content

Commit 60f1c75

Browse files
committed
Merge branch 'main' into hd-mime-type-params
2 parents d6af31e + e971af5 commit 60f1c75

File tree

49 files changed

+1753
-249
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1753
-249
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = lf
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true

.github/workflows/main.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches: [main]
6+
schedule:
7+
- cron: "0 8,20 * * *"
8+
9+
jobs:
10+
unit-tests:
11+
name: Unit tests
12+
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
13+
with:
14+
linux_5_9_arguments_override: "--explicit-target-dependency-import-check error"
15+
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error"
16+
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error"
17+
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
18+
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
19+
20+
integration-test:
21+
name: Integration test
22+
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
23+
with:
24+
name: "Integration test"
25+
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"
26+
27+
example-packages:
28+
name: Example packages
29+
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
30+
with:
31+
name: "Example packages"
32+
matrix_linux_command: "./scripts/test-examples.sh"

.github/workflows/pull_request.yml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,19 @@ on:
77
jobs:
88
soundness:
99
name: Soundness
10-
uses: apple/swift-nio/.github/workflows/soundness.yml@main
10+
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
1111
with:
12-
api_breakage_check_enabled: true
13-
broken_symlink_check_enabled: true
14-
docs_check_enabled: true
15-
format_check_enabled: true
16-
license_header_check_enabled: true
12+
api_breakage_check_enabled: false
1713
license_header_check_project_name: "SwiftOpenAPIGenerator"
18-
shell_check_enabled: true
19-
unacceptable_language_check_enabled: true
14+
yamllint_check_enabled: false
2015

2116
unit-tests:
2217
name: Unit tests
2318
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
2419
with:
25-
linux_5_8_enabled: false
2620
linux_5_9_arguments_override: "--explicit-target-dependency-import-check error"
2721
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error"
22+
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error"
2823
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
2924
linux_nightly_main_enabled: false
3025

@@ -34,7 +29,6 @@ jobs:
3429
with:
3530
name: "Integration test"
3631
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"
37-
matrix_linux_5_8_enabled: false
3832
matrix_linux_nightly_main_enabled: false
3933

4034
compatibility-test:
@@ -62,10 +56,4 @@ jobs:
6256
with:
6357
name: "Example packages"
6458
matrix_linux_command: "./scripts/test-examples.sh"
65-
matrix_linux_5_8_enabled: false
6659
matrix_linux_nightly_main_enabled: false
67-
68-
swift-6-language-mode:
69-
name: Swift 6 Language Mode
70-
uses: apple/swift-nio/.github/workflows/swift_6_language_mode.yml@main
71-
if: false # Disabled for now.

.github/workflows/scheduled.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.licenseignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ Examples/HelloWorldiOSClientAppExample/HelloWorldiOSClientApp/Assets.xcassets/*
3838
Examples/HelloWorldiOSClientAppExample/HelloWorldiOSClientApp/Preview*
3939
Examples/**/Generated*
4040
**/Makefile
41-
**/*.html
41+
**/*.html
42+
.editorconfig

Package.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ let package = Package(
4949

5050
// General algorithms
5151
.package(url: "https://github.com/apple/swift-algorithms", from: "1.2.0"),
52+
.package(url: "https://github.com/apple/swift-collections", from: "1.1.4"),
5253

5354
// Read OpenAPI documents
54-
.package(url: "https://github.com/mattpolzin/OpenAPIKit", from: "3.1.2"),
55+
.package(url: "https://github.com/mattpolzin/OpenAPIKit", from: "3.3.0"),
5556
.package(url: "https://github.com/jpsim/Yams", "4.0.0"..<"6.0.0"),
5657

5758
// CLI Tool
@@ -72,7 +73,9 @@ let package = Package(
7273
.product(name: "OpenAPIKit", package: "OpenAPIKit"),
7374
.product(name: "OpenAPIKit30", package: "OpenAPIKit"),
7475
.product(name: "OpenAPIKitCompat", package: "OpenAPIKit"),
75-
.product(name: "Algorithms", package: "swift-algorithms"), .product(name: "Yams", package: "Yams"),
76+
.product(name: "Algorithms", package: "swift-algorithms"),
77+
.product(name: "OrderedCollections", package: "swift-collections"),
78+
.product(name: "Yams", package: "Yams"),
7679
],
7780
swiftSettings: swiftSettings
7881
),

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ platforms, listed below.
109109
| Generator plugin and CLI | ✅ 10.15+ || ✖️ | ✖️ | ✖️ | ✖️ |
110110
| Generated code and runtime library | ✅ 10.15+ || ✅ 13+ | ✅ 13+ | ✅ 6+ | ✅ 1+ |
111111

112+
> [!NOTE]
113+
> When using Visual Studio Code or other editors that rely on [SourceKit-LSP](https://github.com/swiftlang/sourcekit-lsp), the editor may not correctly recognize generated code within the same module. As a workaround, consider creating a separate target for code generation and then importing it into your main module. For more details, see the discussion in [swiftlang/sourcekit-lsp#665](https://github.com/swiftlang/sourcekit-lsp/issues/665#issuecomment-2093169169).
114+
112115
## Documentation and example projects
113116

114117
To get started, check out the [documentation][docs-generator], which contains

Sources/_OpenAPIGeneratorCore/Diagnostics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ public struct StdErrPrintingDiagnosticCollector: DiagnosticCollector, Sendable {
322322
/// Emits a diagnostic message to standard error.
323323
///
324324
/// - Parameter diagnostic: The diagnostic message to emit.
325-
public func emit(_ diagnostic: Diagnostic) { stdErrHandle.write(diagnostic.description) }
325+
public func emit(_ diagnostic: Diagnostic) { stdErrHandle.write(diagnostic.description + "\n") }
326326
}
327327

328328
/// A no-op collector, silently ignores all diagnostics.

Sources/_OpenAPIGeneratorCore/Hooks/FilteredDocument.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ private extension FilteredDocumentBuilder {
313313
guard predicate(endpoint) else { continue }
314314
if requiredEndpoints[path] == nil { requiredEndpoints[path] = Set() }
315315
if requiredEndpoints[path]!.insert(endpoint.method).inserted {
316+
for parameter in originalPathItem.parameters { try includeParameter(parameter) }
316317
try includeComponentsReferencedBy(endpoint.operation)
317318
}
318319
}

Sources/_OpenAPIGeneratorCore/Layers/StructuredSwiftRepresentation.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,9 +1628,15 @@ extension KeywordKind {
16281628
}
16291629

16301630
extension Declaration {
1631+
/// Returns a new deprecated variant of the declaration if the provided `description` is not `nil`.
1632+
func deprecate(if description: DeprecationDescription?) -> Self {
1633+
if let description { return .deprecated(description, self) }
1634+
return self
1635+
}
1636+
16311637
/// Returns a new deprecated variant of the declaration if `shouldDeprecate` is true.
1632-
func deprecate(if shouldDeprecate: Bool) -> Self {
1633-
if shouldDeprecate { return .deprecated(.init(), self) }
1638+
func deprecate(if shouldDeprecate: Bool, description: @autoclosure () -> DeprecationDescription = .init()) -> Self {
1639+
if shouldDeprecate { return .deprecated(description(), self) }
16341640
return self
16351641
}
16361642

0 commit comments

Comments
 (0)