Skip to content

Commit de8c2fd

Browse files
authored
Merge branch 'main' into patch-1
2 parents c68d7b2 + a99ba2f commit de8c2fd

File tree

74 files changed

+1878
-396
lines changed

Some content is hidden

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

74 files changed

+1878
-396
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
),

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

Sources/_OpenAPIGeneratorCore/Parser/YamsParser.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ public struct YamsParser: ParserProtocol {
7070
do {
7171
let document: OpenAPIKit.OpenAPI.Document
7272
switch openAPIVersion {
73-
case "3.0.0", "3.0.1", "3.0.2", "3.0.3":
73+
case "3.0.0", "3.0.1", "3.0.2", "3.0.3", "3.0.4":
7474
let openAPI30Document = try decoder.decode(OpenAPIKit30.OpenAPI.Document.self, from: input.contents)
7575
document = openAPI30Document.convert(to: .v3_1_0)
76-
case "3.1.0": document = try decoder.decode(OpenAPIKit.OpenAPI.Document.self, from: input.contents)
76+
case "3.1.0", "3.1.1": document = try decoder.decode(OpenAPIKit.OpenAPI.Document.self, from: input.contents)
7777
default:
7878
throw Diagnostic.openAPIVersionError(
7979
versionString: "openapi: \(openAPIVersion)",
@@ -139,7 +139,7 @@ extension Diagnostic {
139139
static func openAPIMissingVersionError(location: Location) -> Diagnostic {
140140
error(
141141
message:
142-
"No openapi key found, please provide a valid OpenAPI document with OpenAPI versions in the 3.0.x or 3.1.x sets.",
142+
"No key named openapi found. Please provide a valid OpenAPI document with OpenAPI versions in the 3.0.x or 3.1.x sets.",
143143
location: location
144144
)
145145
}

0 commit comments

Comments
 (0)