diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..c439b5a --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,30 @@ +name: Pull request + +on: + pull_request: + branches: + - main + +jobs: + + soundness: + name: Soundness + uses: swiftlang/github-workflows/.github/workflows/soundness.yml@0.0.15 + with: + format_check_enabled : true + broken_symlink_check_enabled : true + unacceptable_language_check_enabled : true + shell_check_enabled : true + docs_check_enabled : false + api_breakage_check_enabled : false + license_header_check_enabled: false + yamllint_check_enabled : false + python_lint_check_enabled : false + + tests: + name: Tests + uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@0.0.15 + with: + enable_windows_checks : false + linux_build_command: "swift test --parallel --enable-code-coverage" + linux_swift_versions: '["6.3", "6.4"]' diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml deleted file mode 100644 index 218fd2f..0000000 --- a/.github/workflows/testing.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Testing - -on: - pull_request: - branches: - - main - -jobs: - - api_breakage: - name: Check API breakage - uses: BinaryBirds/github-workflows/.github/workflows/api_breakage.yml@main - - swiftlang_checks: - name: Swiftlang Checks - uses: swiftlang/github-workflows/.github/workflows/soundness.yml@0.0.7 - with: - license_header_check_project_name: "project" - format_check_enabled : true - broken_symlink_check_enabled : true - unacceptable_language_check_enabled : true - shell_check_enabled : false - docs_check_enabled : false - api_breakage_check_enabled : false - license_header_check_enabled : false - yamllint_check_enabled : false - python_lint_check_enabled : false - - bb_checks: - name: BB Checks - uses: BinaryBirds/github-workflows/.github/workflows/extra_soundness.yml@main - with: - local_swift_dependencies_check_enabled : true - headers_check_enabled : false - docc_warnings_check_enabled : true - - swiftlang_tests: - name: Swiftlang Tests - uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main - with: - enable_windows_checks : false - linux_build_command: "swift test --parallel --enable-code-coverage" - linux_exclude_swift_versions: "[{\"swift_version\": \"5.8\"}, {\"swift_version\": \"5.9\"}, {\"swift_version\": \"5.10\"}, {\"swift_version\": \"nightly\"}, {\"swift_version\": \"nightly-main\"}, {\"swift_version\": \"6.0\"}, {\"swift_version\": \"nightly-6.0\"}, {\"swift_version\": \"nightly-6.1\"}, {\"swift_version\": \"nightly-6.3\"}]" \ No newline at end of file diff --git a/.unacceptablelanguageignore b/.unacceptablelanguageignore index 48821ec..78a6c0b 100644 --- a/.unacceptablelanguageignore +++ b/.unacceptablelanguageignore @@ -1,3 +1,2 @@ -Tests/FeatherOpenAPITests/Petstore/Petstore.swift Petstore/openapi@3.0.yaml -Petstore/openapi@3.1.yaml +Tests/FeatherOpenAPITests/Petstore/Petstore.swift diff --git a/Package.resolved b/Package.resolved index 336e804..96e9721 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,13 +1,13 @@ { - "originHash" : "72f8ba09f8e688d42521f46e515d551133ce026caec7c1aab7162e00039ee29c", + "originHash" : "ec497c0829e98ade686d1071453ff94055f1530203c4d3eaa1b6e31c17f9b15c", "pins" : [ { "identity" : "openapikit", "kind" : "remoteSourceControl", "location" : "https://github.com/mattpolzin/OpenAPIKit", "state" : { - "revision" : "f23fdf4223fcd780588e19c7ad823749c08bd2bf", - "version" : "5.0.0" + "revision" : "2cabbac1d08b25c5d22960cc9554f7960a3824cf", + "version" : "7.0.0" } }, { @@ -15,8 +15,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/jpsim/Yams", "state" : { - "revision" : "deaf82e867fa2cbd3cd865978b079bfcf384ac28", - "version" : "6.2.1" + "revision" : "a27b21e0c81c5bf42049b897a62aaf387e80f279", + "version" : "6.2.2" } } ], diff --git a/Package.swift b/Package.swift index 31be3d7..19fbb7c 100644 --- a/Package.swift +++ b/Package.swift @@ -1,28 +1,25 @@ -// swift-tools-version:6.1 +// swift-tools-version:6.3 import PackageDescription -// NOTE: https://github.com/swift-server/swift-http-server/blob/main/Package.swift -var defaultSwiftSettings: [SwiftSetting] = -[ - // https://github.com/swiftlang/swift-evolution/blob/main/proposals/0441-formalize-language-mode-terminology.md +let swiftSettings: [SwiftSetting] = [ .swiftLanguageMode(.v6), - // https://github.com/swiftlang/swift-evolution/blob/main/proposals/0444-member-import-visibility.md + .strictMemorySafety(), + .treatAllWarnings(as: .error), + .enableUpcomingFeature("InternalImportsByDefault"), + .enableUpcomingFeature("ExistentialAny"), .enableUpcomingFeature("MemberImportVisibility"), - // https://forums.swift.org/t/experimental-support-for-lifetime-dependencies-in-swift-6-2-and-beyond/78638 + .enableUpcomingFeature("InferIsolatedConformances"), + .enableUpcomingFeature("NonisolatedNonsendingByDefault"), + .enableUpcomingFeature("ImmutableWeakCaptures"), + .enableExperimentalFeature("SuppressedAssociatedTypes"), + .enableExperimentalFeature("LifetimeDependence"), .enableExperimentalFeature("Lifetimes"), - // https://github.com/swiftlang/swift/pull/65218 - .enableExperimentalFeature("AvailabilityMacro=featherOpenAPI 1.0:macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0"), + .enableUpcomingFeature("LifetimeDependence"), + .enableUpcomingFeature("StrictConcurrency"), ] -#if compiler(>=6.2) -defaultSwiftSettings.append( - // https://github.com/swiftlang/swift-evolution/blob/main/proposals/0461-async-function-isolation.md - .enableUpcomingFeature("NonisolatedNonsendingByDefault") -) -#endif - let package = Package( - name: "feather-openapi", + name: "application", platforms: [ .macOS(.v15), .iOS(.v18), @@ -34,9 +31,8 @@ let package = Package( .library(name: "FeatherOpenAPI", targets: ["FeatherOpenAPI"]), ], dependencies: [ - .package(url: "https://github.com/mattpolzin/OpenAPIKit", from: "5.0.0"), - .package(url: "https://github.com/jpsim/Yams", from: "6.2.0"), - // [docc-plugin-placeholder] + .package(url: "https://github.com/mattpolzin/OpenAPIKit", from: "7.0.0"), + .package(url: "https://github.com/jpsim/Yams", from: "6.2.0"), ], targets: [ .target( @@ -44,7 +40,7 @@ let package = Package( dependencies: [ .product(name: "OpenAPIKit30", package: "OpenAPIKit"), ], - swiftSettings: defaultSwiftSettings + swiftSettings: swiftSettings ), .testTarget( name: "FeatherOpenAPITests", @@ -54,7 +50,7 @@ let package = Package( .product(name: "OpenAPIKitCompat", package: "OpenAPIKit"), .target(name: "FeatherOpenAPI"), ], - swiftSettings: defaultSwiftSettings, + swiftSettings: swiftSettings, ), ] ) diff --git a/README.md b/README.md index 8af5896..5740b87 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ The FeatherOpenAPI library makes it easy to define OpenAPI specifications using Swift in a type-safe way. [ - ![Release: 1.0.0-beta.7](https://img.shields.io/badge/Release-1%2E0%2E0--beta%2E7-F05138) + ![Release: 1.0.0-rc.1](https://img.shields.io/badge/Release-1%2E0%2E0--rc%2E1-F05138) ]( - https://github.com/feather-framework/feather-openapi/releases/tag/1.0.0-beta.7 + https://github.com/feather-framework/feather-openapi/releases/tag/1.0.0-rc.1 ) ## Features @@ -17,10 +17,11 @@ The FeatherOpenAPI library makes it easy to define OpenAPI specifications using ## Requirements -![Swift 6.1+](https://img.shields.io/badge/Swift-6%2E1%2B-F05138) +![Swift 6.3+](https://img.shields.io/badge/Swift-6%2E3%2B-F05138) ![Platforms: Linux, macOS, iOS, tvOS, watchOS, visionOS](https://img.shields.io/badge/Platforms-Linux_%7C_macOS_%7C_iOS_%7C_tvOS_%7C_watchOS_%7C_visionOS-F05138) -- Swift 6.1+ +- Swift 6.3+ + - Platforms: - Linux - macOS 15+ @@ -34,7 +35,7 @@ The FeatherOpenAPI library makes it easy to define OpenAPI specifications using Use Swift Package Manager; add the dependency to your `Package.swift` file: ```swift -.package(url: "https://github.com/feather-framework/feather-openapi", exact: "1.0.0-beta.7"), +.package(url: "https://github.com/feather-framework/feather-openapi", exact: "1.0.0-rc.1"), ``` Then add `FeatherOpenAPI` to your target dependencies: diff --git a/Sources/FeatherOpenAPI/Components/Components.swift b/Sources/FeatherOpenAPI/Components/Components.swift index 6178acb..ccc2144 100644 --- a/Sources/FeatherOpenAPI/Components/Components.swift +++ b/Sources/FeatherOpenAPI/Components/Components.swift @@ -5,31 +5,33 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Concrete container for reusable OpenAPI components. public struct Components: ComponentsRepresentable { /// Schema component map. - public var schemas: OrderedDictionary + public var schemas: + OrderedDictionary /// Parameter component map. public var parameters: - OrderedDictionary + OrderedDictionary /// Example component map. public var examples: - OrderedDictionary + OrderedDictionary /// Response component map. public var responses: - OrderedDictionary + OrderedDictionary /// Request body component map. public var requestBodies: - OrderedDictionary + OrderedDictionary /// Header component map. - public var headers: OrderedDictionary + public var headers: + OrderedDictionary /// Security requirement list used by components. - public var securityRequirements: [SecurityRequirementRepresentable] + public var securityRequirements: [any SecurityRequirementRepresentable] /// Link component map. - public var links: OrderedDictionary + public var links: OrderedDictionary /// Creates a components container. /// - Parameters: @@ -42,20 +44,26 @@ public struct Components: ComponentsRepresentable { /// - securityRequirements: Security requirements. /// - links: Link component map. public init( - schemas: OrderedDictionary = [:], + schemas: OrderedDictionary = + [:], parameters: OrderedDictionary< - ParameterID, OpenAPIParameterRepresentable + ParameterID, any OpenAPIParameterRepresentable > = [:], - examples: OrderedDictionary = + examples: OrderedDictionary< + ExampleID, any OpenAPIExampleRepresentable + > = [:], - responses: OrderedDictionary = + responses: OrderedDictionary< + ResponseID, any OpenAPIResponseRepresentable + > = [:], requestBodies: OrderedDictionary< - RequestBodyID, OpenAPIRequestBodyRepresentable + RequestBodyID, any OpenAPIRequestBodyRepresentable > = [:], - headers: OrderedDictionary = [:], - securityRequirements: [SecurityRequirementRepresentable] = [], - links: OrderedDictionary = [:], + headers: OrderedDictionary = + [:], + securityRequirements: [any SecurityRequirementRepresentable] = [], + links: OrderedDictionary = [:], ) { self.schemas = schemas self.parameters = parameters diff --git a/Sources/FeatherOpenAPI/Components/ComponentsRepresentable.swift b/Sources/FeatherOpenAPI/Components/ComponentsRepresentable.swift index e13dd99..4ac3fa2 100644 --- a/Sources/FeatherOpenAPI/Components/ComponentsRepresentable.swift +++ b/Sources/FeatherOpenAPI/Components/ComponentsRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can describe reusable OpenAPI components. public protocol ComponentsRepresentable: @@ -13,29 +13,36 @@ public protocol ComponentsRepresentable: VendorExtensionsProperty { /// Schema component map. - var schemas: OrderedDictionary { get } + var schemas: OrderedDictionary { + get + } /// Parameter component map. var parameters: - OrderedDictionary + OrderedDictionary { get } /// Example component map. - var examples: OrderedDictionary { + var examples: OrderedDictionary + { get } /// Response component map. - var responses: OrderedDictionary { + var responses: + OrderedDictionary + { get } /// Request body component map. var requestBodies: - OrderedDictionary + OrderedDictionary { get } /// Header component map. - var headers: OrderedDictionary { get } + var headers: OrderedDictionary { + get + } /// Security requirements used by the document. - var securityRequirements: [SecurityRequirementRepresentable] { get } + var securityRequirements: [any SecurityRequirementRepresentable] { get } /// Link component map. - var links: OrderedDictionary { get } + var links: OrderedDictionary { get } // public var callbacks: OrderedDictionary /// Produces the OpenAPI schema components. diff --git a/Sources/FeatherOpenAPI/Components/OpenAPIComponentsRepresentable.swift b/Sources/FeatherOpenAPI/Components/OpenAPIComponentsRepresentable.swift index 1d67d1c..b133a91 100644 --- a/Sources/FeatherOpenAPI/Components/OpenAPIComponentsRepresentable.swift +++ b/Sources/FeatherOpenAPI/Components/OpenAPIComponentsRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce OpenAPI components. public protocol OpenAPIComponentsRepresentable { diff --git a/Sources/FeatherOpenAPI/Contact/ContactRepresentable.swift b/Sources/FeatherOpenAPI/Contact/ContactRepresentable.swift index b27c368..32e8215 100644 --- a/Sources/FeatherOpenAPI/Contact/ContactRepresentable.swift +++ b/Sources/FeatherOpenAPI/Contact/ContactRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Describes an OpenAPI contact. public protocol ContactRepresentable: @@ -15,7 +15,7 @@ public protocol ContactRepresentable: /// Contact name. var name: String? { get } /// Contact URL. - var url: LocationRepresentable? { get } + var url: (any LocationRepresentable)? { get } /// Contact email. var email: String? { get } } @@ -25,7 +25,7 @@ extension ContactRepresentable { /// Default name is `nil`. public var name: String? { nil } /// Default URL is `nil`. - public var url: LocationRepresentable? { nil } + public var url: (any LocationRepresentable)? { nil } /// Default email is `nil`. public var email: String? { nil } diff --git a/Sources/FeatherOpenAPI/Contact/OpenAPIContactRepresentable.swift b/Sources/FeatherOpenAPI/Contact/OpenAPIContactRepresentable.swift index e604dcf..44929dc 100644 --- a/Sources/FeatherOpenAPI/Contact/OpenAPIContactRepresentable.swift +++ b/Sources/FeatherOpenAPI/Contact/OpenAPIContactRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce OpenAPI contact information. public protocol OpenAPIContactRepresentable { diff --git a/Sources/FeatherOpenAPI/Content/Content.swift b/Sources/FeatherOpenAPI/Content/Content.swift index 0a33912..291b7da 100644 --- a/Sources/FeatherOpenAPI/Content/Content.swift +++ b/Sources/FeatherOpenAPI/Content/Content.swift @@ -5,8 +5,6 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 - /// Concrete content wrapper around a schema. public struct Content: ContentRepresentable diff --git a/Sources/FeatherOpenAPI/Content/ContentMap.swift b/Sources/FeatherOpenAPI/Content/ContentMap.swift index 56c3c1e..9c89c64 100644 --- a/Sources/FeatherOpenAPI/Content/ContentMap.swift +++ b/Sources/FeatherOpenAPI/Content/ContentMap.swift @@ -5,10 +5,10 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Ordered map of content types to content definitions. public typealias ContentMap = OrderedDictionary< OpenAPI.ContentType, - ContentRepresentable + any ContentRepresentable > diff --git a/Sources/FeatherOpenAPI/Content/ContentRepresentable.swift b/Sources/FeatherOpenAPI/Content/ContentRepresentable.swift index 6732d33..0da0ac8 100644 --- a/Sources/FeatherOpenAPI/Content/ContentRepresentable.swift +++ b/Sources/FeatherOpenAPI/Content/ContentRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Describes OpenAPI content with a schema. public protocol ContentRepresentable: @@ -14,7 +14,7 @@ public protocol ContentRepresentable: VendorExtensionsProperty { /// The schema for the content. - var schema: SchemaRepresentable { get } + var schema: any SchemaRepresentable { get } } extension ContentRepresentable { @@ -32,7 +32,7 @@ extension ContentRepresentable { /// Referenced schemas for this content. public var referencedSchemaMap: - OrderedDictionary + OrderedDictionary { schema.allReferencedSchemaMap() } diff --git a/Sources/FeatherOpenAPI/Content/OpenAPIContentRepresentable.swift b/Sources/FeatherOpenAPI/Content/OpenAPIContentRepresentable.swift index cbefe1e..24262d2 100644 --- a/Sources/FeatherOpenAPI/Content/OpenAPIContentRepresentable.swift +++ b/Sources/FeatherOpenAPI/Content/OpenAPIContentRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce OpenAPI content. public protocol OpenAPIContentRepresentable { diff --git a/Sources/FeatherOpenAPI/Document/DocumentRepresentable.swift b/Sources/FeatherOpenAPI/Document/DocumentRepresentable.swift index a801375..fde5682 100644 --- a/Sources/FeatherOpenAPI/Document/DocumentRepresentable.swift +++ b/Sources/FeatherOpenAPI/Document/DocumentRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Describes a high-level OpenAPI document with standard defaults. public protocol DocumentRepresentable: @@ -15,29 +15,29 @@ public protocol DocumentRepresentable: ReferencedSecuritySchemeMapRepresentable { /// The document information metadata. - var info: OpenAPIInfoRepresentable { get } + var info: any OpenAPIInfoRepresentable { get } /// The list of servers where the API is served. - var servers: [OpenAPIServerRepresentable] { get } + var servers: [any OpenAPIServerRepresentable] { get } /// The map of path items by path. var paths: PathMap { get } /// The reusable component definitions. - var components: OpenAPIComponentsRepresentable { get } + var components: any OpenAPIComponentsRepresentable { get } /// External documentation for this API, if any. - var externalDocs: ExternalDocsRepresentable? { get } + var externalDocs: (any ExternalDocsRepresentable)? { get } } extension DocumentRepresentable { /// Default servers for the document. - public var servers: [OpenAPIServerRepresentable] { [] } + public var servers: [any OpenAPIServerRepresentable] { [] } /// Default empty path map. public var paths: PathMap { [:] } /// Default external docs is `nil`. - public var externalDocs: ExternalDocsRepresentable? { nil } + public var externalDocs: (any ExternalDocsRepresentable)? { nil } /// Collects all tags referenced by the document. - public var referencedTags: [OpenAPITagRepresentable] { + public var referencedTags: [any OpenAPITagRepresentable] { var seen = Set() return paths.values .map { $0.referencedTags } @@ -54,7 +54,7 @@ extension DocumentRepresentable { /// Collects all security requirements referenced by the document. public var referencedSecurityRequirements: - [SecurityRequirementRepresentable] + [any SecurityRequirementRepresentable] { var seen = Set() return paths.values diff --git a/Sources/FeatherOpenAPI/Document/OpenAPIDocumentRepresentable.swift b/Sources/FeatherOpenAPI/Document/OpenAPIDocumentRepresentable.swift index e7fb743..b3da66a 100644 --- a/Sources/FeatherOpenAPI/Document/OpenAPIDocumentRepresentable.swift +++ b/Sources/FeatherOpenAPI/Document/OpenAPIDocumentRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce an OpenAPI document. public protocol OpenAPIDocumentRepresentable { diff --git a/Sources/FeatherOpenAPI/Example/ExampleRepresentable.swift b/Sources/FeatherOpenAPI/Example/ExampleRepresentable.swift index 3e47f3a..b88f3aa 100644 --- a/Sources/FeatherOpenAPI/Example/ExampleRepresentable.swift +++ b/Sources/FeatherOpenAPI/Example/ExampleRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Describes an OpenAPI example with defaults. public protocol ExampleRepresentable: diff --git a/Sources/FeatherOpenAPI/Example/OpenAPIExampleRepresentable.swift b/Sources/FeatherOpenAPI/Example/OpenAPIExampleRepresentable.swift index 978bdc6..0d9def8 100644 --- a/Sources/FeatherOpenAPI/Example/OpenAPIExampleRepresentable.swift +++ b/Sources/FeatherOpenAPI/Example/OpenAPIExampleRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce an OpenAPI example or reference. public protocol OpenAPIExampleRepresentable { diff --git a/Sources/FeatherOpenAPI/ExternalDocs/ExternalDocsRepresentable.swift b/Sources/FeatherOpenAPI/ExternalDocs/ExternalDocsRepresentable.swift index bbd476c..b6936ff 100644 --- a/Sources/FeatherOpenAPI/ExternalDocs/ExternalDocsRepresentable.swift +++ b/Sources/FeatherOpenAPI/ExternalDocs/ExternalDocsRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Describes external documentation for the API. public protocol ExternalDocsRepresentable: @@ -14,7 +14,7 @@ public protocol ExternalDocsRepresentable: VendorExtensionsProperty { /// The external documentation URL. - var url: LocationRepresentable { get } + var url: any LocationRepresentable { get } } extension ExternalDocsRepresentable { diff --git a/Sources/FeatherOpenAPI/ExternalDocs/OpenAPIExternalDocsRepresentable.swift b/Sources/FeatherOpenAPI/ExternalDocs/OpenAPIExternalDocsRepresentable.swift index 7177857..36732c0 100644 --- a/Sources/FeatherOpenAPI/ExternalDocs/OpenAPIExternalDocsRepresentable.swift +++ b/Sources/FeatherOpenAPI/ExternalDocs/OpenAPIExternalDocsRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce OpenAPI external documentation. public protocol OpenAPIExternalDocsRepresentable { diff --git a/Sources/FeatherOpenAPI/Header/HeaderMap.swift b/Sources/FeatherOpenAPI/Header/HeaderMap.swift index 842b9f2..9402015 100644 --- a/Sources/FeatherOpenAPI/Header/HeaderMap.swift +++ b/Sources/FeatherOpenAPI/Header/HeaderMap.swift @@ -5,10 +5,10 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Ordered map of header names to header definitions. public typealias HeaderMap = OrderedDictionary< String, - HeaderRepresentable + any HeaderRepresentable > diff --git a/Sources/FeatherOpenAPI/Header/HeaderRepresentable.swift b/Sources/FeatherOpenAPI/Header/HeaderRepresentable.swift index 4359ff5..eb4405b 100644 --- a/Sources/FeatherOpenAPI/Header/HeaderRepresentable.swift +++ b/Sources/FeatherOpenAPI/Header/HeaderRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Describes an OpenAPI header with defaults. public protocol HeaderRepresentable: @@ -19,7 +19,7 @@ public protocol HeaderRepresentable: ReferencedSchemaMapRepresentable { /// The schema describing the header value. - var schema: OpenAPISchemaRepresentable { get } + var schema: any OpenAPISchemaRepresentable { get } } extension HeaderRepresentable { @@ -48,9 +48,9 @@ extension HeaderRepresentable { /// Referenced schemas used by the header. public var referencedSchemaMap: - OrderedDictionary + OrderedDictionary { - guard let schema = schema as? SchemaRepresentable else { + guard let schema = schema as? any SchemaRepresentable else { return [:] } return schema.allReferencedSchemaMap() diff --git a/Sources/FeatherOpenAPI/Header/OpenAPIHeaderRepresentable.swift b/Sources/FeatherOpenAPI/Header/OpenAPIHeaderRepresentable.swift index 814e8f5..14f4ab2 100644 --- a/Sources/FeatherOpenAPI/Header/OpenAPIHeaderRepresentable.swift +++ b/Sources/FeatherOpenAPI/Header/OpenAPIHeaderRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce an OpenAPI header or reference. public protocol OpenAPIHeaderRepresentable { diff --git a/Sources/FeatherOpenAPI/Info/InfoRepresentable.swift b/Sources/FeatherOpenAPI/Info/InfoRepresentable.swift index 5322071..cf5e5e3 100644 --- a/Sources/FeatherOpenAPI/Info/InfoRepresentable.swift +++ b/Sources/FeatherOpenAPI/Info/InfoRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Describes the OpenAPI document info section. public protocol InfoRepresentable: @@ -16,11 +16,11 @@ public protocol InfoRepresentable: /// Display title of the API. var title: String { get } /// Terms of service URL. - var termsOfService: LocationRepresentable? { get } + var termsOfService: (any LocationRepresentable)? { get } /// Contact information for the API. - var contact: OpenAPIContactRepresentable? { get } + var contact: (any OpenAPIContactRepresentable)? { get } /// License information for the API. - var license: OpenAPILicenseRepresentable? { get } + var license: (any OpenAPILicenseRepresentable)? { get } /// Version string for the API. var version: String { get } } @@ -28,11 +28,11 @@ public protocol InfoRepresentable: extension InfoRepresentable { /// Default terms of service is `nil`. - public var termsOfService: LocationRepresentable? { nil } + public var termsOfService: (any LocationRepresentable)? { nil } /// Default contact is `nil`. - public var contact: OpenAPIContactRepresentable? { nil } + public var contact: (any OpenAPIContactRepresentable)? { nil } /// Default license is `nil`. - public var license: OpenAPILicenseRepresentable? { nil } + public var license: (any OpenAPILicenseRepresentable)? { nil } /// Builds an OpenAPI document info object. /// - Returns: The OpenAPI info. diff --git a/Sources/FeatherOpenAPI/Info/OpenAPIInfoRepresentable.swift b/Sources/FeatherOpenAPI/Info/OpenAPIInfoRepresentable.swift index 7197af7..aa03b86 100644 --- a/Sources/FeatherOpenAPI/Info/OpenAPIInfoRepresentable.swift +++ b/Sources/FeatherOpenAPI/Info/OpenAPIInfoRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce OpenAPI document info. public protocol OpenAPIInfoRepresentable { diff --git a/Sources/FeatherOpenAPI/License/LicenseRepresentable.swift b/Sources/FeatherOpenAPI/License/LicenseRepresentable.swift index 54f7677..0c21fed 100644 --- a/Sources/FeatherOpenAPI/License/LicenseRepresentable.swift +++ b/Sources/FeatherOpenAPI/License/LicenseRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Describes an OpenAPI license. public protocol LicenseRepresentable: @@ -15,7 +15,7 @@ public protocol LicenseRepresentable: /// License name. var name: String { get } /// License URL. - var url: LocationRepresentable? { get } + var url: (any LocationRepresentable)? { get } } extension LicenseRepresentable { diff --git a/Sources/FeatherOpenAPI/License/OpenAPILicenseRepresentable.swift b/Sources/FeatherOpenAPI/License/OpenAPILicenseRepresentable.swift index b50c641..f08cfc0 100644 --- a/Sources/FeatherOpenAPI/License/OpenAPILicenseRepresentable.swift +++ b/Sources/FeatherOpenAPI/License/OpenAPILicenseRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce OpenAPI license information. public protocol OpenAPILicenseRepresentable { diff --git a/Sources/FeatherOpenAPI/Link/OpenAPILinkRepresentable.swift b/Sources/FeatherOpenAPI/Link/OpenAPILinkRepresentable.swift index 6b5792d..f554815 100644 --- a/Sources/FeatherOpenAPI/Link/OpenAPILinkRepresentable.swift +++ b/Sources/FeatherOpenAPI/Link/OpenAPILinkRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce an OpenAPI link. public protocol OpenAPILinkRepresentable { diff --git a/Sources/FeatherOpenAPI/Location/LocationRepresentable.swift b/Sources/FeatherOpenAPI/Location/LocationRepresentable.swift index b931f23..32dffcc 100644 --- a/Sources/FeatherOpenAPI/Location/LocationRepresentable.swift +++ b/Sources/FeatherOpenAPI/Location/LocationRepresentable.swift @@ -6,9 +6,9 @@ // #if canImport(FoundationEssentials) -import FoundationEssentials +public import FoundationEssentials #else -import Foundation +public import Foundation #endif /// A type that can provide a URL location string. diff --git a/Sources/FeatherOpenAPI/Location/OpenAPILocationRepresentable.swift b/Sources/FeatherOpenAPI/Location/OpenAPILocationRepresentable.swift index 141e2c5..1c9d9e2 100644 --- a/Sources/FeatherOpenAPI/Location/OpenAPILocationRepresentable.swift +++ b/Sources/FeatherOpenAPI/Location/OpenAPILocationRepresentable.swift @@ -6,9 +6,9 @@ // #if canImport(FoundationEssentials) -import FoundationEssentials +public import FoundationEssentials #else -import Foundation +public import Foundation #endif /// A type that can produce a URL location. diff --git a/Sources/FeatherOpenAPI/Operation/OpenAPIOperationRepresentable.swift b/Sources/FeatherOpenAPI/Operation/OpenAPIOperationRepresentable.swift index 67266af..a281f9f 100644 --- a/Sources/FeatherOpenAPI/Operation/OpenAPIOperationRepresentable.swift +++ b/Sources/FeatherOpenAPI/Operation/OpenAPIOperationRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce an OpenAPI operation. public protocol OpenAPIOperationRepresentable { diff --git a/Sources/FeatherOpenAPI/Operation/OperationRepresentable.swift b/Sources/FeatherOpenAPI/Operation/OperationRepresentable.swift index 740ea2b..5a94f36 100644 --- a/Sources/FeatherOpenAPI/Operation/OperationRepresentable.swift +++ b/Sources/FeatherOpenAPI/Operation/OperationRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 extension String { @@ -36,29 +36,29 @@ public protocol OperationRepresentable: // associatedtype RequestBodyType: RequestBodyRepresentable /// Tags associated with the operation. - var tags: [TagRepresentable] { get } + var tags: [any TagRepresentable] { get } /// Short summary of the operation. var summary: String? { get } /// Optional explicit operation identifier. var operationId: String? { get } /// Parameters accepted by the operation. - var parameters: [ParameterRepresentable] { get } + var parameters: [any ParameterRepresentable] { get } /// Optional request body. - var requestBody: RequestBodyRepresentable? { get } + var requestBody: (any RequestBodyRepresentable)? { get } /// Response map keyed by status code. var responseMap: ResponseMap { get } /// Optional security requirements. - var security: [SecurityRequirementRepresentable]? { get } + var security: [any SecurityRequirementRepresentable]? { get } /// Optional per-operation servers. - var servers: [ServerRepresentable]? { get } + var servers: [any ServerRepresentable]? { get } } extension OperationRepresentable { /// Default tags are empty. - public var tags: [TagRepresentable] { [] } + public var tags: [any TagRepresentable] { [] } /// Default summary is `nil`. public var summary: String? { nil } @@ -82,14 +82,14 @@ extension OperationRepresentable { return String(typeName).lowercasedFirstLetter() } /// Default parameters are empty. - public var parameters: [ParameterRepresentable] { [] } + public var parameters: [any ParameterRepresentable] { [] } /// Default request body is `nil`. - public var requestBody: RequestBodyRepresentable? { nil } + public var requestBody: (any RequestBodyRepresentable)? { nil } /// Default security requirements are `nil`. - public var security: [SecurityRequirementRepresentable]? { nil } + public var security: [any SecurityRequirementRepresentable]? { nil } /// Default servers list is `nil`. - public var servers: [ServerRepresentable]? { nil } + public var servers: [any ServerRepresentable]? { nil } private var openAPITags: [String]? { tags.isEmpty ? nil : tags.map { $0.name } @@ -143,9 +143,11 @@ extension OperationRepresentable { /// Aggregated referenced schemas from parameters, request body, and responses. public var referencedSchemaMap: - OrderedDictionary + OrderedDictionary { - var results = OrderedDictionary() + var results = OrderedDictionary< + SchemaID, any OpenAPISchemaRepresentable + >() for parameter in parameters { results.merge(parameter.referencedSchemaMap) @@ -176,14 +178,14 @@ extension OperationRepresentable { /// Aggregated referenced parameters used by the operation. public var referencedParameterMap: - OrderedDictionary + OrderedDictionary { var results = OrderedDictionary< - ParameterID, OpenAPIParameterRepresentable + ParameterID, any OpenAPIParameterRepresentable >() for parameter in parameters { - if let ref = parameter as? ParameterReferenceRepresentable { + if let ref = parameter as? any ParameterReferenceRepresentable { if case .b(let parameter) = ref.object.openAPIParameter() { results[ref.id] = parameter } @@ -194,13 +196,13 @@ extension OperationRepresentable { /// Aggregated referenced request bodies used by the operation. public var referencedRequestBodyMap: - OrderedDictionary + OrderedDictionary { var results = OrderedDictionary< - RequestBodyID, OpenAPIRequestBodyRepresentable + RequestBodyID, any OpenAPIRequestBodyRepresentable >() - if let ref = requestBody as? RequestBodyReferenceRepresentable { + if let ref = requestBody as? any RequestBodyReferenceRepresentable { results[ref.id] = ref.object } return results @@ -208,16 +210,18 @@ extension OperationRepresentable { /// Aggregated referenced headers used by responses. public var referencedHeaderMap: - OrderedDictionary + OrderedDictionary { - var results = OrderedDictionary() + var results = OrderedDictionary< + HeaderID, any OpenAPIHeaderRepresentable + >() let headers = responseMap.values .map { $0.headerMap.values } .flatMap { $0 } for header in headers { - if let ref = header as? HeaderReferenceRepresentable { + if let ref = header as? any HeaderReferenceRepresentable { if case .b(let header) = ref.object.openAPIHeader() { results[ref.id] = header } @@ -228,14 +232,14 @@ extension OperationRepresentable { /// Aggregated referenced responses used by the operation. public var referencedResponseMap: - OrderedDictionary + OrderedDictionary { var results = OrderedDictionary< - ResponseID, OpenAPIResponseRepresentable + ResponseID, any OpenAPIResponseRepresentable >() for response in responseMap.values { - if let ref = response as? ResponseReferenceRepresentable { + if let ref = response as? any ResponseReferenceRepresentable { if case .b(let response) = ref.object.openAPIResponse() { results[ref.id] = response } @@ -245,13 +249,13 @@ extension OperationRepresentable { } /// Referenced tags for the operation. - public var referencedTags: [OpenAPITagRepresentable] { + public var referencedTags: [any OpenAPITagRepresentable] { tags } /// Referenced security requirements for the operation. public var referencedSecurityRequirements: - [SecurityRequirementRepresentable] + [any SecurityRequirementRepresentable] { security?.map { $0 } ?? [] } diff --git a/Sources/FeatherOpenAPI/Parameter/Abstraction/OpenAPIParameterRepresentable.swift b/Sources/FeatherOpenAPI/Parameter/Abstraction/OpenAPIParameterRepresentable.swift index e5021bf..35a9bbc 100644 --- a/Sources/FeatherOpenAPI/Parameter/Abstraction/OpenAPIParameterRepresentable.swift +++ b/Sources/FeatherOpenAPI/Parameter/Abstraction/OpenAPIParameterRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce an OpenAPI parameter or reference. public protocol OpenAPIParameterRepresentable { diff --git a/Sources/FeatherOpenAPI/Parameter/Abstraction/ParameterRepresentable.swift b/Sources/FeatherOpenAPI/Parameter/Abstraction/ParameterRepresentable.swift index fad36e8..e287a68 100644 --- a/Sources/FeatherOpenAPI/Parameter/Abstraction/ParameterRepresentable.swift +++ b/Sources/FeatherOpenAPI/Parameter/Abstraction/ParameterRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Describes an OpenAPI parameter with defaults. public protocol ParameterRepresentable: @@ -23,7 +23,7 @@ public protocol ParameterRepresentable: /// The parameter context (path, query, header, cookie). var context: OpenAPI.Parameter.Context { get } /// The schema describing the parameter value. - var schema: OpenAPISchemaRepresentable { get } + var schema: any OpenAPISchemaRepresentable { get } } @@ -54,9 +54,9 @@ extension ParameterRepresentable { /// Referenced schemas used by the parameter. public var referencedSchemaMap: - OrderedDictionary + OrderedDictionary { - guard let schema = schema as? SchemaRepresentable else { + guard let schema = schema as? any SchemaRepresentable else { return [:] } return schema.allReferencedSchemaMap() diff --git a/Sources/FeatherOpenAPI/Parameter/CookieParameterRepresentable.swift b/Sources/FeatherOpenAPI/Parameter/CookieParameterRepresentable.swift index 7319b85..7108cb8 100644 --- a/Sources/FeatherOpenAPI/Parameter/CookieParameterRepresentable.swift +++ b/Sources/FeatherOpenAPI/Parameter/CookieParameterRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Parameter located in a cookie. public protocol CookieParameterRepresentable: diff --git a/Sources/FeatherOpenAPI/Parameter/HeaderParameterRepresentable.swift b/Sources/FeatherOpenAPI/Parameter/HeaderParameterRepresentable.swift index a3ff255..00c5fc1 100644 --- a/Sources/FeatherOpenAPI/Parameter/HeaderParameterRepresentable.swift +++ b/Sources/FeatherOpenAPI/Parameter/HeaderParameterRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Parameter located in a header. public protocol HeaderParameterRepresentable: diff --git a/Sources/FeatherOpenAPI/Parameter/PathParameterRepresentable.swift b/Sources/FeatherOpenAPI/Parameter/PathParameterRepresentable.swift index 5bfcf16..b9cf274 100644 --- a/Sources/FeatherOpenAPI/Parameter/PathParameterRepresentable.swift +++ b/Sources/FeatherOpenAPI/Parameter/PathParameterRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Parameter located in the path. public protocol PathParameterRepresentable: ParameterRepresentable { diff --git a/Sources/FeatherOpenAPI/Parameter/QueryParameterRepresentable.swift b/Sources/FeatherOpenAPI/Parameter/QueryParameterRepresentable.swift index d53d0b4..1b5ea65 100644 --- a/Sources/FeatherOpenAPI/Parameter/QueryParameterRepresentable.swift +++ b/Sources/FeatherOpenAPI/Parameter/QueryParameterRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Parameter located in the query string. public protocol QueryParameterRepresentable: diff --git a/Sources/FeatherOpenAPI/PathCollection/PathCollectionRepresentable.swift b/Sources/FeatherOpenAPI/PathCollection/PathCollectionRepresentable.swift index dc538ed..5202d26 100644 --- a/Sources/FeatherOpenAPI/PathCollection/PathCollectionRepresentable.swift +++ b/Sources/FeatherOpenAPI/PathCollection/PathCollectionRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Describes a collection of paths and their derived components. public protocol PathCollectionRepresentable: @@ -27,9 +27,11 @@ extension PathCollectionRepresentable { /// Aggregated referenced schemas from the path map. public var referencedSchemaMap: - OrderedDictionary + OrderedDictionary { - var results = OrderedDictionary() + var results = OrderedDictionary< + SchemaID, any OpenAPISchemaRepresentable + >() let schemaMaps = pathMap.values .map { $0.referencedSchemaMap } @@ -43,10 +45,10 @@ extension PathCollectionRepresentable { /// Aggregated referenced parameters from the path map. public var referencedParameterMap: - OrderedDictionary + OrderedDictionary { var results = OrderedDictionary< - ParameterID, OpenAPIParameterRepresentable + ParameterID, any OpenAPIParameterRepresentable >() let parameterMaps = pathMap.values @@ -61,10 +63,10 @@ extension PathCollectionRepresentable { /// Aggregated referenced request bodies from the path map. public var referencedRequestBodyMap: - OrderedDictionary + OrderedDictionary { var results = OrderedDictionary< - RequestBodyID, OpenAPIRequestBodyRepresentable + RequestBodyID, any OpenAPIRequestBodyRepresentable >() let requestBodyMaps = pathMap.values @@ -79,9 +81,11 @@ extension PathCollectionRepresentable { /// Aggregated referenced headers from the path map. public var referencedHeaderMap: - OrderedDictionary + OrderedDictionary { - var results = OrderedDictionary() + var results = OrderedDictionary< + HeaderID, any OpenAPIHeaderRepresentable + >() let headerMaps = pathMap.values .map { $0.referencedHeaderMap } @@ -95,10 +99,10 @@ extension PathCollectionRepresentable { /// Aggregated referenced responses from the path map. public var referencedResponseMap: - OrderedDictionary + OrderedDictionary { var results = OrderedDictionary< - ResponseID, OpenAPIResponseRepresentable + ResponseID, any OpenAPIResponseRepresentable >() let responseMaps = pathMap.values @@ -112,13 +116,13 @@ extension PathCollectionRepresentable { } /// Aggregated referenced tags from the path map. - public var referencedTags: [OpenAPITagRepresentable] { + public var referencedTags: [any OpenAPITagRepresentable] { pathMap.values.map { $0.referencedTags }.flatMap { $0 } } /// Aggregated referenced security requirements from the path map. public var referencedSecurityRequirements: - [SecurityRequirementRepresentable] + [any SecurityRequirementRepresentable] { pathMap.values.map { $0.referencedSecurityRequirements }.flatMap { $0 } } diff --git a/Sources/FeatherOpenAPI/PathItem/OpenAPIPathItemRepresentable.swift b/Sources/FeatherOpenAPI/PathItem/OpenAPIPathItemRepresentable.swift index 248ecb2..b9e622b 100644 --- a/Sources/FeatherOpenAPI/PathItem/OpenAPIPathItemRepresentable.swift +++ b/Sources/FeatherOpenAPI/PathItem/OpenAPIPathItemRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce an OpenAPI path item. public protocol OpenAPIPathItemRepresentable { diff --git a/Sources/FeatherOpenAPI/PathItem/PathItemRepresentable.swift b/Sources/FeatherOpenAPI/PathItem/PathItemRepresentable.swift index bcc62af..cb06620 100644 --- a/Sources/FeatherOpenAPI/PathItem/PathItemRepresentable.swift +++ b/Sources/FeatherOpenAPI/PathItem/PathItemRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Describes an OpenAPI path item with HTTP operation bindings. public protocol PathItemRepresentable: @@ -26,23 +26,23 @@ public protocol PathItemRepresentable: var summary: String? { get } /// Optional servers that override document-level servers. - var servers: [OpenAPIServerRepresentable]? { get } + var servers: [any OpenAPIServerRepresentable]? { get } /// GET operation for this path. - var get: OperationRepresentable? { get } + var get: (any OperationRepresentable)? { get } /// PUT operation for this path. - var put: OperationRepresentable? { get } + var put: (any OperationRepresentable)? { get } /// POST operation for this path. - var post: OperationRepresentable? { get } + var post: (any OperationRepresentable)? { get } /// DELETE operation for this path. - var delete: OperationRepresentable? { get } + var delete: (any OperationRepresentable)? { get } /// OPTIONS operation for this path. - var options: OperationRepresentable? { get } + var options: (any OperationRepresentable)? { get } /// HEAD operation for this path. - var head: OperationRepresentable? { get } + var head: (any OperationRepresentable)? { get } /// PATCH operation for this path. - var patch: OperationRepresentable? { get } + var patch: (any OperationRepresentable)? { get } /// TRACE operation for this path. - var trace: OperationRepresentable? { get } + var trace: (any OperationRepresentable)? { get } } extension PathItemRepresentable { @@ -51,23 +51,23 @@ extension PathItemRepresentable { public var summary: String? { nil } /// Default servers list is `nil`. - public var servers: [OpenAPIServerRepresentable]? { nil } + public var servers: [any OpenAPIServerRepresentable]? { nil } /// Default GET operation is `nil`. - public var get: OperationRepresentable? { nil } + public var get: (any OperationRepresentable)? { nil } /// Default PUT operation is `nil`. - public var put: OperationRepresentable? { nil } + public var put: (any OperationRepresentable)? { nil } /// Default POST operation is `nil`. - public var post: OperationRepresentable? { nil } + public var post: (any OperationRepresentable)? { nil } /// Default DELETE operation is `nil`. - public var delete: OperationRepresentable? { nil } + public var delete: (any OperationRepresentable)? { nil } /// Default OPTIONS operation is `nil`. - public var options: OperationRepresentable? { nil } + public var options: (any OperationRepresentable)? { nil } /// Default HEAD operation is `nil`. - public var head: OperationRepresentable? { nil } + public var head: (any OperationRepresentable)? { nil } /// Default PATCH operation is `nil`. - public var patch: OperationRepresentable? { nil } + public var patch: (any OperationRepresentable)? { nil } /// Default TRACE operation is `nil`. - public var trace: OperationRepresentable? { nil } + public var trace: (any OperationRepresentable)? { nil } /// Builds an OpenAPI path item. /// - Returns: The OpenAPI path item. @@ -90,7 +90,7 @@ extension PathItemRepresentable { } /// All non-nil operations declared on the path item. - public var allOperations: [OperationRepresentable] { + public var allOperations: [any OperationRepresentable] { [ get, put, @@ -106,9 +106,11 @@ extension PathItemRepresentable { /// Aggregated referenced schemas from operations. public var referencedSchemaMap: - OrderedDictionary + OrderedDictionary { - var results = OrderedDictionary() + var results = OrderedDictionary< + SchemaID, any OpenAPISchemaRepresentable + >() let maps = allOperations.map { $0.referencedSchemaMap }.flatMap { $0 } @@ -120,10 +122,10 @@ extension PathItemRepresentable { /// Aggregated referenced parameters from operations. public var referencedParameterMap: - OrderedDictionary + OrderedDictionary { var results = OrderedDictionary< - ParameterID, OpenAPIParameterRepresentable + ParameterID, any OpenAPIParameterRepresentable >() let maps = allOperations.map { $0.referencedParameterMap } @@ -137,10 +139,10 @@ extension PathItemRepresentable { /// Aggregated referenced request bodies from operations. public var referencedRequestBodyMap: - OrderedDictionary + OrderedDictionary { var results = OrderedDictionary< - RequestBodyID, OpenAPIRequestBodyRepresentable + RequestBodyID, any OpenAPIRequestBodyRepresentable >() let maps = allOperations.map { $0.referencedRequestBodyMap } @@ -154,9 +156,11 @@ extension PathItemRepresentable { /// Aggregated referenced headers from operations. public var referencedHeaderMap: - OrderedDictionary + OrderedDictionary { - var results = OrderedDictionary() + var results = OrderedDictionary< + HeaderID, any OpenAPIHeaderRepresentable + >() let maps = allOperations.map { $0.referencedHeaderMap }.flatMap { $0 } @@ -168,10 +172,10 @@ extension PathItemRepresentable { /// Aggregated referenced responses from operations. public var referencedResponseMap: - OrderedDictionary + OrderedDictionary { var results = OrderedDictionary< - ResponseID, OpenAPIResponseRepresentable + ResponseID, any OpenAPIResponseRepresentable >() let maps = allOperations.map { $0.referencedResponseMap }.flatMap { $0 } @@ -183,13 +187,13 @@ extension PathItemRepresentable { } /// Aggregated referenced tags from operations. - public var referencedTags: [OpenAPITagRepresentable] { + public var referencedTags: [any OpenAPITagRepresentable] { allOperations.map { $0.referencedTags }.flatMap { $0 } } /// Aggregated referenced security requirements from operations. public var referencedSecurityRequirements: - [SecurityRequirementRepresentable] + [any SecurityRequirementRepresentable] { allOperations.map { $0.referencedSecurityRequirements }.flatMap { $0 } } diff --git a/Sources/FeatherOpenAPI/PathItem/PathMap.swift b/Sources/FeatherOpenAPI/PathItem/PathMap.swift index 1900817..9f8254f 100644 --- a/Sources/FeatherOpenAPI/PathItem/PathMap.swift +++ b/Sources/FeatherOpenAPI/PathItem/PathMap.swift @@ -5,10 +5,10 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Ordered map of OpenAPI paths to path items. public typealias PathMap = OrderedDictionary< OpenAPI.Path, - PathItemRepresentable + any PathItemRepresentable > diff --git a/Sources/FeatherOpenAPI/Reference/ExampleReferenceRepresentable.swift b/Sources/FeatherOpenAPI/Reference/ExampleReferenceRepresentable.swift index 8b6a110..c66d7e7 100644 --- a/Sources/FeatherOpenAPI/Reference/ExampleReferenceRepresentable.swift +++ b/Sources/FeatherOpenAPI/Reference/ExampleReferenceRepresentable.swift @@ -5,14 +5,14 @@ // Created by Tibor Bödecs on 2026. 01. 24. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that exposes a referenced example. public protocol ExampleReferenceRepresentable { /// The identifier for the example reference. var id: ExampleID { get } /// The underlying example object. - var object: ExampleRepresentable { get } + var object: any ExampleRepresentable { get } } /// Wrapper that exposes an example as a reusable reference. @@ -32,7 +32,7 @@ public struct ExampleReference: } /// The underlying example object. - public var object: ExampleRepresentable { + public var object: any ExampleRepresentable { _object } diff --git a/Sources/FeatherOpenAPI/Reference/HeaderReferenceRepresentable.swift b/Sources/FeatherOpenAPI/Reference/HeaderReferenceRepresentable.swift index 6a0ccf6..6025134 100644 --- a/Sources/FeatherOpenAPI/Reference/HeaderReferenceRepresentable.swift +++ b/Sources/FeatherOpenAPI/Reference/HeaderReferenceRepresentable.swift @@ -5,14 +5,14 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that exposes a referenced header. public protocol HeaderReferenceRepresentable { /// The identifier for the header reference. var id: HeaderID { get } /// The underlying header object. - var object: HeaderRepresentable { get } + var object: any HeaderRepresentable { get } } /// Wrapper that exposes a header as a reusable reference. @@ -21,10 +21,10 @@ public struct HeaderReference: HeaderReferenceRepresentable { /// Header schema. - public var schema: OpenAPISchemaRepresentable { object.schema } + public var schema: any OpenAPISchemaRepresentable { object.schema } /// The underlying header object. - public var object: HeaderRepresentable { + public var object: any HeaderRepresentable { _object } diff --git a/Sources/FeatherOpenAPI/Reference/ParameterReferenceRepresentable.swift b/Sources/FeatherOpenAPI/Reference/ParameterReferenceRepresentable.swift index 72b5d0b..935d8cb 100644 --- a/Sources/FeatherOpenAPI/Reference/ParameterReferenceRepresentable.swift +++ b/Sources/FeatherOpenAPI/Reference/ParameterReferenceRepresentable.swift @@ -5,14 +5,14 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that exposes a referenced parameter. public protocol ParameterReferenceRepresentable { /// The identifier for the parameter reference. var id: ParameterID { get } /// The underlying parameter object. - var object: ParameterRepresentable { get } + var object: any ParameterRepresentable { get } } /// Wrapper that exposes a parameter as a reusable reference. @@ -30,7 +30,7 @@ public struct ParameterReference: public var schema: any OpenAPISchemaRepresentable { object.schema } /// The underlying parameter object. - public var object: ParameterRepresentable { + public var object: any ParameterRepresentable { _object } diff --git a/Sources/FeatherOpenAPI/Reference/ReferencedSchemaMapRepresentable.swift b/Sources/FeatherOpenAPI/Reference/ReferencedSchemaMapRepresentable.swift index 3f2e2ec..28be294 100644 --- a/Sources/FeatherOpenAPI/Reference/ReferencedSchemaMapRepresentable.swift +++ b/Sources/FeatherOpenAPI/Reference/ReferencedSchemaMapRepresentable.swift @@ -5,13 +5,13 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Exposes referenced schemas. public protocol ReferencedSchemaMapRepresentable { /// Map of referenced schemas. var referencedSchemaMap: - OrderedDictionary + OrderedDictionary { get } } @@ -19,7 +19,7 @@ public protocol ReferencedSchemaMapRepresentable { public protocol ReferencedParameterMapRepresentable { /// Map of referenced parameters. var referencedParameterMap: - OrderedDictionary + OrderedDictionary { get } } @@ -27,7 +27,7 @@ public protocol ReferencedParameterMapRepresentable { public protocol ReferencedRequestBodyMapRepresentable { /// Map of referenced request bodies. var referencedRequestBodyMap: - OrderedDictionary + OrderedDictionary { get } } @@ -35,7 +35,7 @@ public protocol ReferencedRequestBodyMapRepresentable { public protocol ReferencedHeaderMapRepresentable { /// Map of referenced headers. var referencedHeaderMap: - OrderedDictionary + OrderedDictionary { get } } @@ -43,14 +43,14 @@ public protocol ReferencedHeaderMapRepresentable { public protocol ReferencedResponseMapRepresentable { /// Map of referenced responses. var referencedResponseMap: - OrderedDictionary + OrderedDictionary { get } } /// Exposes referenced security requirements. public protocol ReferencedSecuritySchemeMapRepresentable { /// List of referenced security requirements. - var referencedSecurityRequirements: [SecurityRequirementRepresentable] { + var referencedSecurityRequirements: [any SecurityRequirementRepresentable] { get } } @@ -58,5 +58,5 @@ public protocol ReferencedSecuritySchemeMapRepresentable { /// Exposes referenced tags. public protocol ReferencedTagMapRepresentable { /// List of referenced tags. - var referencedTags: [OpenAPITagRepresentable] { get } + var referencedTags: [any OpenAPITagRepresentable] { get } } diff --git a/Sources/FeatherOpenAPI/Reference/RequestBodyReferenceRepresentable.swift b/Sources/FeatherOpenAPI/Reference/RequestBodyReferenceRepresentable.swift index bdb0e6f..7969775 100644 --- a/Sources/FeatherOpenAPI/Reference/RequestBodyReferenceRepresentable.swift +++ b/Sources/FeatherOpenAPI/Reference/RequestBodyReferenceRepresentable.swift @@ -5,14 +5,14 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that exposes a referenced request body. public protocol RequestBodyReferenceRepresentable { /// The identifier for the request body reference. var id: RequestBodyID { get } /// The underlying request body object. - var object: RequestBodyRepresentable { get } + var object: any RequestBodyRepresentable { get } } /// Wrapper that exposes a request body as a reusable reference. @@ -24,7 +24,7 @@ public struct RequestBodyReference: public var contentMap: ContentMap { object.contentMap } /// The underlying request body object. - public var object: RequestBodyRepresentable { + public var object: any RequestBodyRepresentable { _object } diff --git a/Sources/FeatherOpenAPI/Reference/ResponseReferenceRepresentable.swift b/Sources/FeatherOpenAPI/Reference/ResponseReferenceRepresentable.swift index 2cdd0c7..ec0d34b 100644 --- a/Sources/FeatherOpenAPI/Reference/ResponseReferenceRepresentable.swift +++ b/Sources/FeatherOpenAPI/Reference/ResponseReferenceRepresentable.swift @@ -5,14 +5,14 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that exposes a referenced response. public protocol ResponseReferenceRepresentable { /// The identifier for the response reference. var id: ResponseID { get } /// The underlying response object. - var object: ResponseRepresentable { get } + var object: any ResponseRepresentable { get } } /// Wrapper that exposes a response as a reusable reference. @@ -28,7 +28,7 @@ public struct ResponseReference: public var contentMap: ContentMap { object.contentMap } /// The underlying response object. - public var object: ResponseRepresentable { + public var object: any ResponseRepresentable { _object } diff --git a/Sources/FeatherOpenAPI/Reference/SchemaReference.swift b/Sources/FeatherOpenAPI/Reference/SchemaReference.swift index c371977..12b39e6 100644 --- a/Sources/FeatherOpenAPI/Reference/SchemaReference.swift +++ b/Sources/FeatherOpenAPI/Reference/SchemaReference.swift @@ -5,14 +5,14 @@ // Created by Tibor Bödecs on 2026. 01. 22. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that exposes a referenced schema. public protocol SchemaReferenceRepresentable { /// The identifier for the schema reference. var id: SchemaID { get } /// The underlying schema object. - var object: SchemaRepresentable { get } + var object: any SchemaRepresentable { get } } /// Wrapper that exposes a schema as a reusable reference. @@ -49,7 +49,7 @@ public struct SchemaReference: /// Referenced schema map for this reference. public var referencedSchemaMap: - OrderedDictionary + OrderedDictionary { [id: object] } diff --git a/Sources/FeatherOpenAPI/RequestBody/Abstraction/OpenAPIRequestBodyRepresentable.swift b/Sources/FeatherOpenAPI/RequestBody/Abstraction/OpenAPIRequestBodyRepresentable.swift index 6ebedf2..22c1c93 100644 --- a/Sources/FeatherOpenAPI/RequestBody/Abstraction/OpenAPIRequestBodyRepresentable.swift +++ b/Sources/FeatherOpenAPI/RequestBody/Abstraction/OpenAPIRequestBodyRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce an OpenAPI request body or reference. public protocol OpenAPIRequestBodyRepresentable { diff --git a/Sources/FeatherOpenAPI/RequestBody/Abstraction/RequestBodyRepresentable.swift b/Sources/FeatherOpenAPI/RequestBody/Abstraction/RequestBodyRepresentable.swift index c95e6ec..29c69a4 100644 --- a/Sources/FeatherOpenAPI/RequestBody/Abstraction/RequestBodyRepresentable.swift +++ b/Sources/FeatherOpenAPI/RequestBody/Abstraction/RequestBodyRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 22. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Describes an OpenAPI request body with defaults. public protocol RequestBodyRepresentable: @@ -46,9 +46,11 @@ extension RequestBodyRepresentable { /// Aggregated referenced schemas from the content map. public var referencedSchemaMap: - OrderedDictionary + OrderedDictionary { - var results = OrderedDictionary() + var results = OrderedDictionary< + SchemaID, any OpenAPISchemaRepresentable + >() for content in contentMap.values { results.merge(content.referencedSchemaMap) } diff --git a/Sources/FeatherOpenAPI/RequestBody/BinaryRequestBodyRepresentable.swift b/Sources/FeatherOpenAPI/RequestBody/BinaryRequestBodyRepresentable.swift index 5bee62d..fc37f99 100644 --- a/Sources/FeatherOpenAPI/RequestBody/BinaryRequestBodyRepresentable.swift +++ b/Sources/FeatherOpenAPI/RequestBody/BinaryRequestBodyRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 22. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Request body with binary content. public protocol BinaryRequestBodyRepresentable: RequestBodyRepresentable { diff --git a/Sources/FeatherOpenAPI/RequestBody/FormRequestBodyRepresentable.swift b/Sources/FeatherOpenAPI/RequestBody/FormRequestBodyRepresentable.swift index 3892394..1a8ba4b 100644 --- a/Sources/FeatherOpenAPI/RequestBody/FormRequestBodyRepresentable.swift +++ b/Sources/FeatherOpenAPI/RequestBody/FormRequestBodyRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 22. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Request body with form-encoded content. public protocol FormRequestBodyRepresentable: RequestBodyRepresentable { diff --git a/Sources/FeatherOpenAPI/RequestBody/JSONRequestBodyRepresentable.swift b/Sources/FeatherOpenAPI/RequestBody/JSONRequestBodyRepresentable.swift index 7e8fbd1..f600cf2 100644 --- a/Sources/FeatherOpenAPI/RequestBody/JSONRequestBodyRepresentable.swift +++ b/Sources/FeatherOpenAPI/RequestBody/JSONRequestBodyRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 22. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Request body with JSON content. public protocol JSONRequestBodyRepresentable: RequestBodyRepresentable { diff --git a/Sources/FeatherOpenAPI/Response/Abstraction/OpenAPIResponseRepresentable.swift b/Sources/FeatherOpenAPI/Response/Abstraction/OpenAPIResponseRepresentable.swift index 09c1ddc..27ebb47 100644 --- a/Sources/FeatherOpenAPI/Response/Abstraction/OpenAPIResponseRepresentable.swift +++ b/Sources/FeatherOpenAPI/Response/Abstraction/OpenAPIResponseRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 22. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce an OpenAPI response or reference. public protocol OpenAPIResponseRepresentable { diff --git a/Sources/FeatherOpenAPI/Response/Abstraction/ResponseMap.swift b/Sources/FeatherOpenAPI/Response/Abstraction/ResponseMap.swift index 72e0988..8c3fab4 100644 --- a/Sources/FeatherOpenAPI/Response/Abstraction/ResponseMap.swift +++ b/Sources/FeatherOpenAPI/Response/Abstraction/ResponseMap.swift @@ -5,10 +5,10 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Ordered map of response status codes to response definitions. public typealias ResponseMap = OrderedDictionary< OpenAPI.Response.StatusCode, - ResponseRepresentable + any ResponseRepresentable > diff --git a/Sources/FeatherOpenAPI/Response/Abstraction/ResponseRepresentable.swift b/Sources/FeatherOpenAPI/Response/Abstraction/ResponseRepresentable.swift index 6d4ddb1..42a4818 100644 --- a/Sources/FeatherOpenAPI/Response/Abstraction/ResponseRepresentable.swift +++ b/Sources/FeatherOpenAPI/Response/Abstraction/ResponseRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Describes an OpenAPI response with defaults. public protocol ResponseRepresentable: diff --git a/Sources/FeatherOpenAPI/Response/BinaryResponseRepresentable.swift b/Sources/FeatherOpenAPI/Response/BinaryResponseRepresentable.swift index 2b9244d..041ae67 100644 --- a/Sources/FeatherOpenAPI/Response/BinaryResponseRepresentable.swift +++ b/Sources/FeatherOpenAPI/Response/BinaryResponseRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Response with binary content. public protocol BinaryResponseRepresentable: ResponseRepresentable { diff --git a/Sources/FeatherOpenAPI/Response/FormResponseRepresentable.swift b/Sources/FeatherOpenAPI/Response/FormResponseRepresentable.swift index 37ba760..260ae56 100644 --- a/Sources/FeatherOpenAPI/Response/FormResponseRepresentable.swift +++ b/Sources/FeatherOpenAPI/Response/FormResponseRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Response with form-encoded content. public protocol FormResponseRepresentable: ResponseRepresentable { diff --git a/Sources/FeatherOpenAPI/Response/JSONResponseRepresentable.swift b/Sources/FeatherOpenAPI/Response/JSONResponseRepresentable.swift index b1f46e1..6e933ba 100644 --- a/Sources/FeatherOpenAPI/Response/JSONResponseRepresentable.swift +++ b/Sources/FeatherOpenAPI/Response/JSONResponseRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Response with JSON content. public protocol JSONResponseRepresentable: ResponseRepresentable { diff --git a/Sources/FeatherOpenAPI/Schema/Abstraction/OpenAPISchemaRepresentable.swift b/Sources/FeatherOpenAPI/Schema/Abstraction/OpenAPISchemaRepresentable.swift index 9fa9cec..b6fb9fd 100644 --- a/Sources/FeatherOpenAPI/Schema/Abstraction/OpenAPISchemaRepresentable.swift +++ b/Sources/FeatherOpenAPI/Schema/Abstraction/OpenAPISchemaRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce an OpenAPI JSON schema. public protocol OpenAPISchemaRepresentable { diff --git a/Sources/FeatherOpenAPI/Schema/Abstraction/SchemaMap.swift b/Sources/FeatherOpenAPI/Schema/Abstraction/SchemaMap.swift index d018b05..09939da 100644 --- a/Sources/FeatherOpenAPI/Schema/Abstraction/SchemaMap.swift +++ b/Sources/FeatherOpenAPI/Schema/Abstraction/SchemaMap.swift @@ -5,10 +5,10 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Ordered map of schema names to schema definitions. public typealias SchemaMap = OrderedDictionary< String, - SchemaRepresentable + any SchemaRepresentable > diff --git a/Sources/FeatherOpenAPI/Schema/Abstraction/SchemaRepresentable.swift b/Sources/FeatherOpenAPI/Schema/Abstraction/SchemaRepresentable.swift index 1dd8952..d251e98 100644 --- a/Sources/FeatherOpenAPI/Schema/Abstraction/SchemaRepresentable.swift +++ b/Sources/FeatherOpenAPI/Schema/Abstraction/SchemaRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Describes an OpenAPI schema with common properties. public protocol SchemaRepresentable: @@ -38,7 +38,7 @@ extension SchemaRepresentable { /// Referenced schemas directly used by this schema. public var referencedSchemaMap: - OrderedDictionary + OrderedDictionary { [:] } @@ -46,9 +46,11 @@ extension SchemaRepresentable { /// Collects all referenced schemas transitively. /// - Returns: An ordered dictionary of all referenced schemas. public func allReferencedSchemaMap() -> OrderedDictionary< - SchemaID, OpenAPISchemaRepresentable + SchemaID, any OpenAPISchemaRepresentable > { - var results = OrderedDictionary() + var results = OrderedDictionary< + SchemaID, any OpenAPISchemaRepresentable + >() var visited = Set() collectReferencedSchemaMap(into: &results, visited: &visited) return results @@ -56,13 +58,13 @@ extension SchemaRepresentable { fileprivate func collectReferencedSchemaMap( into results: - inout OrderedDictionary, + inout OrderedDictionary, visited: inout Set ) { for (id, schema) in referencedSchemaMap where visited.insert(id).inserted { results[id] = schema - if let schema = schema as? SchemaRepresentable { + if let schema = schema as? any SchemaRepresentable { schema.collectReferencedSchemaMap( into: &results, visited: &visited diff --git a/Sources/FeatherOpenAPI/Schema/ArraySchemaRepresentable.swift b/Sources/FeatherOpenAPI/Schema/ArraySchemaRepresentable.swift index b3ed01c..2bbd2d6 100644 --- a/Sources/FeatherOpenAPI/Schema/ArraySchemaRepresentable.swift +++ b/Sources/FeatherOpenAPI/Schema/ArraySchemaRepresentable.swift @@ -5,14 +5,14 @@ // Created by Tibor Bödecs on 2026. 01. 22. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Schema representation for arrays. public protocol ArraySchemaRepresentable: SchemaRepresentable { /// The item schema for the array. - var items: SchemaRepresentable? { get } + var items: (any SchemaRepresentable)? { get } } extension ArraySchemaRepresentable { @@ -42,10 +42,11 @@ extension ArraySchemaRepresentable { /// Referenced schemas used by the array items. public var referencedSchemaMap: - OrderedDictionary + OrderedDictionary { - var results: OrderedDictionary = - [:] + var results: + OrderedDictionary = + [:] for (key, value) in items?.referencedSchemaMap ?? [:] { // if let ref = value as? SchemaReferenceRepresentable { diff --git a/Sources/FeatherOpenAPI/Schema/BinarySchema.swift b/Sources/FeatherOpenAPI/Schema/BinarySchema.swift index 738070c..a70960d 100644 --- a/Sources/FeatherOpenAPI/Schema/BinarySchema.swift +++ b/Sources/FeatherOpenAPI/Schema/BinarySchema.swift @@ -16,7 +16,7 @@ struct BinarySchema: SchemaRepresentable { } var referencedSchemaMap: - OrderedDictionary + OrderedDictionary { [:] } diff --git a/Sources/FeatherOpenAPI/Schema/BoolSchemaRepresentable.swift b/Sources/FeatherOpenAPI/Schema/BoolSchemaRepresentable.swift index 5f0f165..61b1f19 100644 --- a/Sources/FeatherOpenAPI/Schema/BoolSchemaRepresentable.swift +++ b/Sources/FeatherOpenAPI/Schema/BoolSchemaRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 22. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Schema representation for boolean values. public protocol BoolSchemaRepresentable: diff --git a/Sources/FeatherOpenAPI/Schema/DoubleSchemaRepresentable.swift b/Sources/FeatherOpenAPI/Schema/DoubleSchemaRepresentable.swift index 09729fb..c53428c 100644 --- a/Sources/FeatherOpenAPI/Schema/DoubleSchemaRepresentable.swift +++ b/Sources/FeatherOpenAPI/Schema/DoubleSchemaRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 22. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Schema representation for double values. public protocol DoubleSchemaRepresentable: diff --git a/Sources/FeatherOpenAPI/Schema/FloatSchemaRepresentable.swift b/Sources/FeatherOpenAPI/Schema/FloatSchemaRepresentable.swift index 724c85c..c239a01 100644 --- a/Sources/FeatherOpenAPI/Schema/FloatSchemaRepresentable.swift +++ b/Sources/FeatherOpenAPI/Schema/FloatSchemaRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 22. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Schema representation for float values. public protocol FloatSchemaRepresentable: diff --git a/Sources/FeatherOpenAPI/Schema/Int32SchemaRepresentable.swift b/Sources/FeatherOpenAPI/Schema/Int32SchemaRepresentable.swift index b303422..c28c047 100644 --- a/Sources/FeatherOpenAPI/Schema/Int32SchemaRepresentable.swift +++ b/Sources/FeatherOpenAPI/Schema/Int32SchemaRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 22. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Schema representation for 32-bit integer values. public protocol Int32SchemaRepresentable: diff --git a/Sources/FeatherOpenAPI/Schema/Int64SchemaRepresentable.swift b/Sources/FeatherOpenAPI/Schema/Int64SchemaRepresentable.swift index 5c02678..f8770b8 100644 --- a/Sources/FeatherOpenAPI/Schema/Int64SchemaRepresentable.swift +++ b/Sources/FeatherOpenAPI/Schema/Int64SchemaRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 22. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Schema representation for 64-bit integer values. public protocol Int64SchemaRepresentable: diff --git a/Sources/FeatherOpenAPI/Schema/IntSchemaRepresentable.swift b/Sources/FeatherOpenAPI/Schema/IntSchemaRepresentable.swift index c1c20ed..2e075d5 100644 --- a/Sources/FeatherOpenAPI/Schema/IntSchemaRepresentable.swift +++ b/Sources/FeatherOpenAPI/Schema/IntSchemaRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 22. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Schema representation for integer values. public protocol IntSchemaRepresentable: diff --git a/Sources/FeatherOpenAPI/Schema/ObjectSchemaRepresentable.swift b/Sources/FeatherOpenAPI/Schema/ObjectSchemaRepresentable.swift index 958a2af..49a17fe 100644 --- a/Sources/FeatherOpenAPI/Schema/ObjectSchemaRepresentable.swift +++ b/Sources/FeatherOpenAPI/Schema/ObjectSchemaRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 22. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Schema representation for objects. public protocol ObjectSchemaRepresentable: @@ -45,9 +45,11 @@ extension ObjectSchemaRepresentable { /// Referenced schemas used by object properties. public var referencedSchemaMap: - OrderedDictionary + OrderedDictionary { - var results = OrderedDictionary() + var results = OrderedDictionary< + SchemaID, any OpenAPISchemaRepresentable + >() for (_, value) in propertyMap { results.merge(value.referencedSchemaMap) } diff --git a/Sources/FeatherOpenAPI/Schema/StringSchemaRepresentable.swift b/Sources/FeatherOpenAPI/Schema/StringSchemaRepresentable.swift index d55dd3e..8f5866e 100644 --- a/Sources/FeatherOpenAPI/Schema/StringSchemaRepresentable.swift +++ b/Sources/FeatherOpenAPI/Schema/StringSchemaRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 22. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Schema representation for string values. public protocol StringSchemaRepresentable: diff --git a/Sources/FeatherOpenAPI/SecurityRequirement/OpenAPISecurityRequirementRepresentable.swift b/Sources/FeatherOpenAPI/SecurityRequirement/OpenAPISecurityRequirementRepresentable.swift index 07d558f..5e4a19e 100644 --- a/Sources/FeatherOpenAPI/SecurityRequirement/OpenAPISecurityRequirementRepresentable.swift +++ b/Sources/FeatherOpenAPI/SecurityRequirement/OpenAPISecurityRequirementRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce an OpenAPI security requirement. public protocol OpenAPISecurityRequirementRepresentable { diff --git a/Sources/FeatherOpenAPI/SecurityRequirement/SecurityRequirementRepresentable.swift b/Sources/FeatherOpenAPI/SecurityRequirement/SecurityRequirementRepresentable.swift index 0812e5e..8ef3411 100644 --- a/Sources/FeatherOpenAPI/SecurityRequirement/SecurityRequirementRepresentable.swift +++ b/Sources/FeatherOpenAPI/SecurityRequirement/SecurityRequirementRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Describes a security requirement for an operation or document. public protocol SecurityRequirementRepresentable: diff --git a/Sources/FeatherOpenAPI/SecurityScheme/OpenAPISecuritySchemeRepresentable.swift b/Sources/FeatherOpenAPI/SecurityScheme/OpenAPISecuritySchemeRepresentable.swift index 545c9f0..9afb7d4 100644 --- a/Sources/FeatherOpenAPI/SecurityScheme/OpenAPISecuritySchemeRepresentable.swift +++ b/Sources/FeatherOpenAPI/SecurityScheme/OpenAPISecuritySchemeRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce an OpenAPI security scheme. public protocol OpenAPISecuritySchemeRepresentable { diff --git a/Sources/FeatherOpenAPI/SecurityScheme/SecuritySchemeRepresentable.swift b/Sources/FeatherOpenAPI/SecurityScheme/SecuritySchemeRepresentable.swift index 5e72bd1..ee2ff2a 100644 --- a/Sources/FeatherOpenAPI/SecurityScheme/SecuritySchemeRepresentable.swift +++ b/Sources/FeatherOpenAPI/SecurityScheme/SecuritySchemeRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Describes an OpenAPI security scheme. public protocol SecuritySchemeRepresentable: diff --git a/Sources/FeatherOpenAPI/Server/OpenAPIServerRepresentable.swift b/Sources/FeatherOpenAPI/Server/OpenAPIServerRepresentable.swift index e6d0c1e..ef01921 100644 --- a/Sources/FeatherOpenAPI/Server/OpenAPIServerRepresentable.swift +++ b/Sources/FeatherOpenAPI/Server/OpenAPIServerRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce an OpenAPI server. public protocol OpenAPIServerRepresentable { diff --git a/Sources/FeatherOpenAPI/Server/ServerRepresentable.swift b/Sources/FeatherOpenAPI/Server/ServerRepresentable.swift index 5ca8447..92fac84 100644 --- a/Sources/FeatherOpenAPI/Server/ServerRepresentable.swift +++ b/Sources/FeatherOpenAPI/Server/ServerRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Describes an OpenAPI server object with defaults. public protocol ServerRepresentable: @@ -15,7 +15,7 @@ public protocol ServerRepresentable: { /// Server URL template. - var url: LocationRepresentable { get } + var url: any LocationRepresentable { get } /// Server variable definitions. var variables: VariableMap { get } diff --git a/Sources/FeatherOpenAPI/Tag/OpenAPITagRepresentable.swift b/Sources/FeatherOpenAPI/Tag/OpenAPITagRepresentable.swift index 23f55e9..69a64db 100644 --- a/Sources/FeatherOpenAPI/Tag/OpenAPITagRepresentable.swift +++ b/Sources/FeatherOpenAPI/Tag/OpenAPITagRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce an OpenAPI tag. public protocol OpenAPITagRepresentable { diff --git a/Sources/FeatherOpenAPI/Tag/TagRepresentable.swift b/Sources/FeatherOpenAPI/Tag/TagRepresentable.swift index ffdf371..03fd1eb 100644 --- a/Sources/FeatherOpenAPI/Tag/TagRepresentable.swift +++ b/Sources/FeatherOpenAPI/Tag/TagRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Describes an OpenAPI tag with defaults. public protocol TagRepresentable: @@ -17,13 +17,13 @@ public protocol TagRepresentable: /// Tag display name. var name: String { get } /// External documentation for the tag. - var externalDocs: ExternalDocsRepresentable? { get } + var externalDocs: (any ExternalDocsRepresentable)? { get } } extension TagRepresentable { /// Default external docs is `nil`. - public var externalDocs: ExternalDocsRepresentable? { nil } + public var externalDocs: (any ExternalDocsRepresentable)? { nil } /// Builds an OpenAPI tag object. /// - Returns: The OpenAPI tag. diff --git a/Sources/FeatherOpenAPI/Variable/OpenAPIVariableRepresentable.swift b/Sources/FeatherOpenAPI/Variable/OpenAPIVariableRepresentable.swift index c7873df..8f0f48d 100644 --- a/Sources/FeatherOpenAPI/Variable/OpenAPIVariableRepresentable.swift +++ b/Sources/FeatherOpenAPI/Variable/OpenAPIVariableRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// A type that can produce an OpenAPI server variable. public protocol OpenAPIVariableRepresentable { diff --git a/Sources/FeatherOpenAPI/Variable/VariableMap.swift b/Sources/FeatherOpenAPI/Variable/VariableMap.swift index b2a4621..8b5f163 100644 --- a/Sources/FeatherOpenAPI/Variable/VariableMap.swift +++ b/Sources/FeatherOpenAPI/Variable/VariableMap.swift @@ -5,10 +5,10 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Ordered map of server variable names to variable definitions. public typealias VariableMap = OrderedDictionary< String, - OpenAPIVariableRepresentable + any OpenAPIVariableRepresentable > diff --git a/Sources/FeatherOpenAPI/Variable/VariableRepresentable.swift b/Sources/FeatherOpenAPI/Variable/VariableRepresentable.swift index 520604f..08830b4 100644 --- a/Sources/FeatherOpenAPI/Variable/VariableRepresentable.swift +++ b/Sources/FeatherOpenAPI/Variable/VariableRepresentable.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Describes an OpenAPI server variable. public protocol VariableRepresentable: diff --git a/Sources/FeatherOpenAPI/_Properties/AllowedValuesProperty.swift b/Sources/FeatherOpenAPI/_Properties/AllowedValuesProperty.swift index aaabc96..67ac12f 100644 --- a/Sources/FeatherOpenAPI/_Properties/AllowedValuesProperty.swift +++ b/Sources/FeatherOpenAPI/_Properties/AllowedValuesProperty.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Provides allowed values for schemas. public protocol AllowedValuesProperty { diff --git a/Sources/FeatherOpenAPI/_Properties/DefaultValueProperty.swift b/Sources/FeatherOpenAPI/_Properties/DefaultValueProperty.swift index af4351d..bd3fbc0 100644 --- a/Sources/FeatherOpenAPI/_Properties/DefaultValueProperty.swift +++ b/Sources/FeatherOpenAPI/_Properties/DefaultValueProperty.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Provides a default value for schemas. public protocol DefaultValueProperty { diff --git a/Sources/FeatherOpenAPI/_Properties/ExampleProperty.swift b/Sources/FeatherOpenAPI/_Properties/ExampleProperty.swift index 9b772c0..0a99df7 100644 --- a/Sources/FeatherOpenAPI/_Properties/ExampleProperty.swift +++ b/Sources/FeatherOpenAPI/_Properties/ExampleProperty.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 22. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Provides an example value for schemas. public protocol ExampleProperty { diff --git a/Sources/FeatherOpenAPI/_Properties/VendorExtensionsProperty.swift b/Sources/FeatherOpenAPI/_Properties/VendorExtensionsProperty.swift index 7cb4b42..65a3364 100644 --- a/Sources/FeatherOpenAPI/_Properties/VendorExtensionsProperty.swift +++ b/Sources/FeatherOpenAPI/_Properties/VendorExtensionsProperty.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 23. // -import OpenAPIKit30 +public import OpenAPIKit30 /// Provides vendor extension storage. public protocol VendorExtensionsProperty { diff --git a/Tests/FeatherOpenAPITests/Example/Components/ExampleDocument.swift b/Tests/FeatherOpenAPITests/Example/Components/ExampleDocument.swift index 653d753..a46c3b4 100644 --- a/Tests/FeatherOpenAPITests/Example/Components/ExampleDocument.swift +++ b/Tests/FeatherOpenAPITests/Example/Components/ExampleDocument.swift @@ -13,7 +13,7 @@ struct ExampleLocation: LocationRepresentable { struct ExampleContact: ContactRepresentable { var name: String? { "Binary Birds" } - var url: LocationRepresentable? { + var url: (any LocationRepresentable)? { ExampleLocation(location: "https://binarybirds.com") } var email: String? { "info@binarybirds.com" } @@ -26,12 +26,12 @@ struct ExampleInfo: InfoRepresentable { Example API description """ } - var contact: OpenAPIContactRepresentable? { ExampleContact() } + var contact: (any OpenAPIContactRepresentable)? { ExampleContact() } var version: String { "1.0.0" } } struct ExampleServer: ServerRepresentable { - var url: LocationRepresentable { + var url: any LocationRepresentable { ExampleLocation(location: "http://localhost:8080") } var description: String? { "dev" } @@ -50,9 +50,9 @@ struct ExampleDocument: DocumentRepresentable { let collection = ExamplePathCollection() - var info: OpenAPIInfoRepresentable { ExampleInfo() } - var servers: [OpenAPIServerRepresentable] { [ExampleServer()] } + var info: any OpenAPIInfoRepresentable { ExampleInfo() } + var servers: [any OpenAPIServerRepresentable] { [ExampleServer()] } var paths: PathMap { collection.pathMap } - var components: OpenAPIComponentsRepresentable { collection.components } + var components: any OpenAPIComponentsRepresentable { collection.components } } diff --git a/Tests/FeatherOpenAPITests/Example/Components/ExampleDuplicatedItemDocument.swift b/Tests/FeatherOpenAPITests/Example/Components/ExampleDuplicatedItemDocument.swift index bb427d2..3fa15dc 100644 --- a/Tests/FeatherOpenAPITests/Example/Components/ExampleDuplicatedItemDocument.swift +++ b/Tests/FeatherOpenAPITests/Example/Components/ExampleDuplicatedItemDocument.swift @@ -14,24 +14,24 @@ struct ExampleDuplicatedItemInfo: InfoRepresentable { Example API description """ } - var contact: OpenAPIContactRepresentable? { ExampleContact() } + var contact: (any OpenAPIContactRepresentable)? { ExampleContact() } var version: String { "1.0.0" } } struct ExampleDuplicatedItemServer: ServerRepresentable { - var url: LocationRepresentable { + var url: any LocationRepresentable { ExampleLocation(location: "http://localhost:8080") } var description: String? { "dev" } } struct ExampleDuplicatedItemDocument: DocumentRepresentable { - var info: OpenAPIInfoRepresentable { ExampleDuplicatedItemInfo() } - var servers: [OpenAPIServerRepresentable] { + var info: any OpenAPIInfoRepresentable { ExampleDuplicatedItemInfo() } + var servers: [any OpenAPIServerRepresentable] { [ExampleDuplicatedItemServer()] } var paths: PathMap { [:] } - var components: OpenAPIComponentsRepresentable { + var components: any OpenAPIComponentsRepresentable { let idSchema = ExampleDuplicatedItem.Model.IdSchema() let keySchema = ExampleDuplicatedItem.Model.KeySchema() let keySecondSchema = ExampleDuplicatedItem.Model.KeySecondSchema() diff --git a/Tests/FeatherOpenAPITests/Example/Components/ExampleMissingParentItemDocument.swift b/Tests/FeatherOpenAPITests/Example/Components/ExampleMissingParentItemDocument.swift index caed9cf..e9c1723 100644 --- a/Tests/FeatherOpenAPITests/Example/Components/ExampleMissingParentItemDocument.swift +++ b/Tests/FeatherOpenAPITests/Example/Components/ExampleMissingParentItemDocument.swift @@ -14,24 +14,24 @@ struct ExampleMissingParentItemInfo: InfoRepresentable { Example API description """ } - var contact: OpenAPIContactRepresentable? { ExampleContact() } + var contact: (any OpenAPIContactRepresentable)? { ExampleContact() } var version: String { "1.0.0" } } struct ExampleMissingParentItemServer: ServerRepresentable { - var url: LocationRepresentable { + var url: any LocationRepresentable { ExampleLocation(location: "http://localhost:8080") } var description: String? { "dev" } } struct ExampleMissingParentItemItemDocument: DocumentRepresentable { - var info: OpenAPIInfoRepresentable { ExampleMissingParentItemInfo() } - var servers: [OpenAPIServerRepresentable] { + var info: any OpenAPIInfoRepresentable { ExampleMissingParentItemInfo() } + var servers: [any OpenAPIServerRepresentable] { [ExampleMissingParentItemServer()] } var paths: PathMap { [:] } - var components: OpenAPIComponentsRepresentable { + var components: any OpenAPIComponentsRepresentable { let idSchema = ExampleMissingParentItem.Model.IdSchema() let keySchema = ExampleMissingParentItem.Model.KeySchema() return Components( diff --git a/Tests/FeatherOpenAPITests/Example/Components/ExampleModel+Operations.swift b/Tests/FeatherOpenAPITests/Example/Components/ExampleModel+Operations.swift index 8510f25..ad792e3 100644 --- a/Tests/FeatherOpenAPITests/Example/Components/ExampleModel+Operations.swift +++ b/Tests/FeatherOpenAPITests/Example/Components/ExampleModel+Operations.swift @@ -10,10 +10,10 @@ import OpenAPIKit30 extension Example.Model { struct GetOperation: OperationRepresentable { - var tags: [TagRepresentable] { [ModelTag()] } + var tags: [any TagRepresentable] { [ModelTag()] } var summary: String? { "Detail example" } var description: String? { "Detail example detail" } - var parameters: [ParameterRepresentable] { + var parameters: [any ParameterRepresentable] { [ IdParameter().reference(), CustomRequestHeaderParameter().reference(), @@ -27,10 +27,10 @@ extension Example.Model { } struct CreateOperation: OperationRepresentable { - var tags: [TagRepresentable] { [ModelTag()] } + var tags: [any TagRepresentable] { [ModelTag()] } var summary: String? { "Create example" } var description: String? { "Create example detail" } - var requestBody: RequestBodyRepresentable? { + var requestBody: (any RequestBodyRepresentable)? { CreateRequestBody().reference() } var responseMap: ResponseMap { diff --git a/Tests/FeatherOpenAPITests/Example/Components/ExampleModel+PathItems.swift b/Tests/FeatherOpenAPITests/Example/Components/ExampleModel+PathItems.swift index b16dabe..bc4dc60 100644 --- a/Tests/FeatherOpenAPITests/Example/Components/ExampleModel+PathItems.swift +++ b/Tests/FeatherOpenAPITests/Example/Components/ExampleModel+PathItems.swift @@ -9,10 +9,10 @@ import FeatherOpenAPI extension Example.Model { struct MainPathItem: PathItemRepresentable { - var post: OperationRepresentable? { CreateOperation() } + var post: (any OperationRepresentable)? { CreateOperation() } } struct IdentifiedPathItem: PathItemRepresentable { - var get: OperationRepresentable? { GetOperation() } + var get: (any OperationRepresentable)? { GetOperation() } } } diff --git a/Tests/FeatherOpenAPITests/Example/Components/ExampleModel+Schemas.swift b/Tests/FeatherOpenAPITests/Example/Components/ExampleModel+Schemas.swift index 209dbd0..dd54209 100644 --- a/Tests/FeatherOpenAPITests/Example/Components/ExampleModel+Schemas.swift +++ b/Tests/FeatherOpenAPITests/Example/Components/ExampleModel+Schemas.swift @@ -63,7 +63,7 @@ extension Example.Model { struct ListSchema: ArraySchemaRepresentable { var description: String? { "Lorem ipsum dolor sit amet" } - var items: SchemaRepresentable? { ListItemSchema() } + var items: (any SchemaRepresentable)? { ListItemSchema() } } struct PatchOverrideSchema: ObjectSchemaRepresentable { diff --git a/Tests/FeatherOpenAPITests/Petstore/Pet/Pet+Operations.swift b/Tests/FeatherOpenAPITests/Petstore/Pet/Pet+Operations.swift index 3c96dc4..4f59d83 100644 --- a/Tests/FeatherOpenAPITests/Petstore/Pet/Pet+Operations.swift +++ b/Tests/FeatherOpenAPITests/Petstore/Pet/Pet+Operations.swift @@ -11,11 +11,11 @@ import OpenAPIKit30 extension Petstore.Pet { struct UpdateOperation: OperationRepresentable { - var tags: [TagRepresentable] { [PetTag()] } + var tags: [any TagRepresentable] { [PetTag()] } var summary: String? { "Update an existing pet." } var description: String? { "Update an existing pet by Id." } var operationId: String? { "updatePet" } - var requestBody: RequestBodyRepresentable? { + var requestBody: (any RequestBodyRepresentable)? { UpdateRequestBody() } var responseMap: ResponseMap { @@ -36,11 +36,11 @@ extension Petstore.Pet { } struct AddOperation: OperationRepresentable { - var tags: [TagRepresentable] { [PetTag()] } + var tags: [any TagRepresentable] { [PetTag()] } var summary: String? { "Add a new pet to the store." } var description: String? { "Add a new pet to the store." } var operationId: String? { "addPet" } - var requestBody: RequestBodyRepresentable? { + var requestBody: (any RequestBodyRepresentable)? { AddRequestBody() } var responseMap: ResponseMap { @@ -60,13 +60,13 @@ extension Petstore.Pet { } struct FindByStatusOperation: OperationRepresentable { - var tags: [TagRepresentable] { [PetTag()] } + var tags: [any TagRepresentable] { [PetTag()] } var summary: String? { "Finds Pets by status." } var description: String? { "Multiple status values can be provided with comma separated strings." } var operationId: String? { "findPetsByStatus" } - var parameters: [ParameterRepresentable] { + var parameters: [any ParameterRepresentable] { [ StatusQueryParameter() ] @@ -87,13 +87,13 @@ extension Petstore.Pet { } struct FindByTagsOperation: OperationRepresentable { - var tags: [TagRepresentable] { [PetTag()] } + var tags: [any TagRepresentable] { [PetTag()] } var summary: String? { "Finds Pets by tags." } var description: String? { "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing." } var operationId: String? { "findPetsByTags" } - var parameters: [ParameterRepresentable] { + var parameters: [any ParameterRepresentable] { [ TagsQueryParameter() ] @@ -114,11 +114,11 @@ extension Petstore.Pet { } struct GetByIdOperation: OperationRepresentable { - var tags: [TagRepresentable] { [PetTag()] } + var tags: [any TagRepresentable] { [PetTag()] } var summary: String? { "Find pet by ID." } var description: String? { "Returns a single pet." } var operationId: String? { "getPetById" } - var parameters: [ParameterRepresentable] { + var parameters: [any ParameterRepresentable] { [ IdParameter() ] @@ -141,7 +141,7 @@ extension Petstore.Pet { } struct UpdateWithFormOperation: OperationRepresentable { - var tags: [TagRepresentable] { [PetTag()] } + var tags: [any TagRepresentable] { [PetTag()] } var summary: String? { "Updates a pet in the store with form data." } @@ -149,7 +149,7 @@ extension Petstore.Pet { "Updates a pet resource based on the form data." } var operationId: String? { "updatePetWithForm" } - var parameters: [ParameterRepresentable] { + var parameters: [any ParameterRepresentable] { [ UpdateIdParameter(), NameQueryParameter(), @@ -172,11 +172,11 @@ extension Petstore.Pet { } struct DeleteOperation: OperationRepresentable { - var tags: [TagRepresentable] { [PetTag()] } + var tags: [any TagRepresentable] { [PetTag()] } var summary: String? { "Deletes a pet." } var description: String? { "Delete a pet." } var operationId: String? { "deletePet" } - var parameters: [ParameterRepresentable] { + var parameters: [any ParameterRepresentable] { [ ApiKeyHeaderParameter(), DeleteIdParameter(), @@ -198,17 +198,17 @@ extension Petstore.Pet { } struct UploadImageOperation: OperationRepresentable { - var tags: [TagRepresentable] { [PetTag()] } + var tags: [any TagRepresentable] { [PetTag()] } var summary: String? { "Uploads an image." } var description: String? { "Upload image of the pet." } var operationId: String? { "uploadFile" } - var parameters: [ParameterRepresentable] { + var parameters: [any ParameterRepresentable] { [ UploadIdParameter(), AdditionalMetadataQueryParameter(), ] } - var requestBody: RequestBodyRepresentable? { + var requestBody: (any RequestBodyRepresentable)? { UploadImageRequestBody() } var responseMap: ResponseMap { diff --git a/Tests/FeatherOpenAPITests/Petstore/Pet/Pet+PathItems.swift b/Tests/FeatherOpenAPITests/Petstore/Pet/Pet+PathItems.swift index 24d3ff7..03c5e52 100644 --- a/Tests/FeatherOpenAPITests/Petstore/Pet/Pet+PathItems.swift +++ b/Tests/FeatherOpenAPITests/Petstore/Pet/Pet+PathItems.swift @@ -10,25 +10,25 @@ import FeatherOpenAPI extension Petstore.Pet { struct MainPathItem: PathItemRepresentable { - var put: OperationRepresentable? { UpdateOperation() } - var post: OperationRepresentable? { AddOperation() } + var put: (any OperationRepresentable)? { UpdateOperation() } + var post: (any OperationRepresentable)? { AddOperation() } } struct FindByStatusPathItem: PathItemRepresentable { - var get: OperationRepresentable? { FindByStatusOperation() } + var get: (any OperationRepresentable)? { FindByStatusOperation() } } struct FindByTagsPathItem: PathItemRepresentable { - var get: OperationRepresentable? { FindByTagsOperation() } + var get: (any OperationRepresentable)? { FindByTagsOperation() } } struct IdentifiedPathItem: PathItemRepresentable { - var get: OperationRepresentable? { GetByIdOperation() } - var post: OperationRepresentable? { UpdateWithFormOperation() } - var delete: OperationRepresentable? { DeleteOperation() } + var get: (any OperationRepresentable)? { GetByIdOperation() } + var post: (any OperationRepresentable)? { UpdateWithFormOperation() } + var delete: (any OperationRepresentable)? { DeleteOperation() } } struct UploadImagePathItem: PathItemRepresentable { - var post: OperationRepresentable? { UploadImageOperation() } + var post: (any OperationRepresentable)? { UploadImageOperation() } } } diff --git a/Tests/FeatherOpenAPITests/Petstore/Pet/Pet+Schemas.swift b/Tests/FeatherOpenAPITests/Petstore/Pet/Pet+Schemas.swift index d5c5234..5dc666b 100644 --- a/Tests/FeatherOpenAPITests/Petstore/Pet/Pet+Schemas.swift +++ b/Tests/FeatherOpenAPITests/Petstore/Pet/Pet+Schemas.swift @@ -23,12 +23,14 @@ extension Petstore.Pet { } struct PhotoUrlsSchema: ArraySchemaRepresentable { - var items: SchemaRepresentable? { PhotoUrlItemSchema() } + var items: (any SchemaRepresentable)? { PhotoUrlItemSchema() } } struct TagsSchema: ArraySchemaRepresentable { var required: Bool { false } - var items: SchemaRepresentable? { Petstore.Tag.TagSchema().reference() } + var items: (any SchemaRepresentable)? { + Petstore.Tag.TagSchema().reference() + } } struct StatusSchema: StringSchemaRepresentable { @@ -59,7 +61,7 @@ extension Petstore.Pet { } struct PetListSchema: ArraySchemaRepresentable { - var items: SchemaRepresentable? { PetSchema().reference() } + var items: (any SchemaRepresentable)? { PetSchema().reference() } } struct StatusQuerySchema: StringSchemaRepresentable { @@ -77,7 +79,7 @@ extension Petstore.Pet { } struct TagsQuerySchema: ArraySchemaRepresentable { - var items: SchemaRepresentable? { TagsQueryItemSchema() } + var items: (any SchemaRepresentable)? { TagsQueryItemSchema() } } struct UpdateNameSchema: StringSchemaRepresentable { diff --git a/Tests/FeatherOpenAPITests/Petstore/Pet/Pet+Tags.swift b/Tests/FeatherOpenAPITests/Petstore/Pet/Pet+Tags.swift index 7a2443c..301a62a 100644 --- a/Tests/FeatherOpenAPITests/Petstore/Pet/Pet+Tags.swift +++ b/Tests/FeatherOpenAPITests/Petstore/Pet/Pet+Tags.swift @@ -12,14 +12,14 @@ extension Petstore.Pet { struct PetTag: TagRepresentable { var name: String { "pet" } var description: String? { "Everything about your Pets" } - var externalDocs: ExternalDocsRepresentable? { + var externalDocs: (any ExternalDocsRepresentable)? { PetTagExternalDocs() } } struct PetTagExternalDocs: ExternalDocsRepresentable { var description: String? { "Find out more" } - var url: LocationRepresentable { + var url: any LocationRepresentable { PetstoreLocation(location: "https://swagger.io") } } diff --git a/Tests/FeatherOpenAPITests/Petstore/Petstore.swift b/Tests/FeatherOpenAPITests/Petstore/Petstore.swift index 3a3e3fe..6ccca77 100644 --- a/Tests/FeatherOpenAPITests/Petstore/Petstore.swift +++ b/Tests/FeatherOpenAPITests/Petstore/Petstore.swift @@ -20,7 +20,7 @@ struct PetstoreContact: ContactRepresentable { struct PetstoreLicense: LicenseRepresentable { var name: String { "Apache 2.0" } - var url: LocationRepresentable? { + var url: (any LocationRepresentable)? { PetstoreLocation( location: "https://www.apache.org/licenses/LICENSE-2.0.html" ) @@ -41,21 +41,21 @@ struct PetstoreInfo: InfoRepresentable { - [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml) """ } - var termsOfService: LocationRepresentable? { + var termsOfService: (any LocationRepresentable)? { PetstoreLocation(location: "https://swagger.io/terms/") } - var contact: OpenAPIContactRepresentable? { PetstoreContact() } - var license: OpenAPILicenseRepresentable? { PetstoreLicense() } + var contact: (any OpenAPIContactRepresentable)? { PetstoreContact() } + var license: (any OpenAPILicenseRepresentable)? { PetstoreLicense() } var version: String { "1.0.27" } } struct PetstoreServer: ServerRepresentable { - var url: LocationRepresentable { PetstoreLocation(location: "/api/v3") } + var url: any LocationRepresentable { PetstoreLocation(location: "/api/v3") } } struct PetstoreExternalDocs: ExternalDocsRepresentable { var description: String? { "Find out more about Swagger" } - var url: LocationRepresentable { + var url: any LocationRepresentable { PetstoreLocation(location: "https://swagger.io") } } @@ -83,27 +83,30 @@ struct PetstorePathCollection: PathCollectionRepresentable { struct PetstoreComponents: ComponentsRepresentable { let base: FeatherOpenAPI.Components - var schemas: OrderedDictionary { + var schemas: OrderedDictionary { base.schemas } var parameters: - OrderedDictionary + OrderedDictionary { base.parameters } - var examples: OrderedDictionary { + var examples: OrderedDictionary + { base.examples } - var responses: OrderedDictionary { + var responses: + OrderedDictionary + { base.responses } var requestBodies: OrderedDictionary< - RequestBodyID, OpenAPIRequestBodyRepresentable + RequestBodyID, any OpenAPIRequestBodyRepresentable > { var results = base.requestBodies @@ -119,15 +122,15 @@ struct PetstoreComponents: ComponentsRepresentable { return results } - var headers: OrderedDictionary { + var headers: OrderedDictionary { base.headers } - var securityRequirements: [SecurityRequirementRepresentable] { + var securityRequirements: [any SecurityRequirementRepresentable] { base.securityRequirements } - var links: OrderedDictionary { + var links: OrderedDictionary { base.links } } @@ -135,17 +138,19 @@ struct PetstoreComponents: ComponentsRepresentable { struct PetstoreDocument: DocumentRepresentable { let collection = PetstorePathCollection() - var info: OpenAPIInfoRepresentable { PetstoreInfo() } - var servers: [OpenAPIServerRepresentable] { [PetstoreServer()] } + var info: any OpenAPIInfoRepresentable { PetstoreInfo() } + var servers: [any OpenAPIServerRepresentable] { [PetstoreServer()] } - var externalDocs: ExternalDocsRepresentable? { PetstoreExternalDocs() } + var externalDocs: (any ExternalDocsRepresentable)? { + PetstoreExternalDocs() + } var paths: PathMap { collection.pathMap } - var components: OpenAPIComponentsRepresentable { + var components: any OpenAPIComponentsRepresentable { PetstoreComponents(base: collection.components) } - var referencedTags: [OpenAPITagRepresentable] { + var referencedTags: [any OpenAPITagRepresentable] { [ Petstore.Pet.PetTag(), Petstore.Store.StoreTag(), @@ -153,7 +158,7 @@ struct PetstoreDocument: DocumentRepresentable { ] } - var referencedSecurityRequirements: [SecurityRequirementRepresentable] { + var referencedSecurityRequirements: [any SecurityRequirementRepresentable] { [] } } diff --git a/Tests/FeatherOpenAPITests/Petstore/Store/Store+Operations.swift b/Tests/FeatherOpenAPITests/Petstore/Store/Store+Operations.swift index 5a888d6..6fae213 100644 --- a/Tests/FeatherOpenAPITests/Petstore/Store/Store+Operations.swift +++ b/Tests/FeatherOpenAPITests/Petstore/Store/Store+Operations.swift @@ -11,7 +11,7 @@ import OpenAPIKit30 extension Petstore.Store { struct InventoryOperation: OperationRepresentable { - var tags: [TagRepresentable] { [StoreTag()] } + var tags: [any TagRepresentable] { [StoreTag()] } var summary: String? { "Returns pet inventories by status." } var description: String? { "Returns a map of status codes to quantities." @@ -32,11 +32,11 @@ extension Petstore.Store { } struct PlaceOrderOperation: OperationRepresentable { - var tags: [TagRepresentable] { [StoreTag()] } + var tags: [any TagRepresentable] { [StoreTag()] } var summary: String? { "Place an order for a pet." } var description: String? { "Place a new order in the store." } var operationId: String? { "placeOrder" } - var requestBody: RequestBodyRepresentable? { + var requestBody: (any RequestBodyRepresentable)? { PlaceOrderRequestBody() } var responseMap: ResponseMap { @@ -51,13 +51,13 @@ extension Petstore.Store { } struct GetOrderOperation: OperationRepresentable { - var tags: [TagRepresentable] { [StoreTag()] } + var tags: [any TagRepresentable] { [StoreTag()] } var summary: String? { "Find purchase order by ID." } var description: String? { "For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions." } var operationId: String? { "getOrderById" } - var parameters: [ParameterRepresentable] { + var parameters: [any ParameterRepresentable] { [ OrderIdParameter() ] @@ -74,13 +74,13 @@ extension Petstore.Store { } struct DeleteOrderOperation: OperationRepresentable { - var tags: [TagRepresentable] { [StoreTag()] } + var tags: [any TagRepresentable] { [StoreTag()] } var summary: String? { "Delete purchase order by identifier." } var description: String? { "For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors." } var operationId: String? { "deleteOrder" } - var parameters: [ParameterRepresentable] { + var parameters: [any ParameterRepresentable] { [ OrderIdDeleteParameter() ] diff --git a/Tests/FeatherOpenAPITests/Petstore/Store/Store+PathItems.swift b/Tests/FeatherOpenAPITests/Petstore/Store/Store+PathItems.swift index 0af16d6..2f16c4e 100644 --- a/Tests/FeatherOpenAPITests/Petstore/Store/Store+PathItems.swift +++ b/Tests/FeatherOpenAPITests/Petstore/Store/Store+PathItems.swift @@ -10,15 +10,15 @@ import FeatherOpenAPI extension Petstore.Store { struct InventoryPathItem: PathItemRepresentable { - var get: OperationRepresentable? { InventoryOperation() } + var get: (any OperationRepresentable)? { InventoryOperation() } } struct OrderPathItem: PathItemRepresentable { - var post: OperationRepresentable? { PlaceOrderOperation() } + var post: (any OperationRepresentable)? { PlaceOrderOperation() } } struct OrderIdentifiedPathItem: PathItemRepresentable { - var get: OperationRepresentable? { GetOrderOperation() } - var delete: OperationRepresentable? { DeleteOrderOperation() } + var get: (any OperationRepresentable)? { GetOrderOperation() } + var delete: (any OperationRepresentable)? { DeleteOrderOperation() } } } diff --git a/Tests/FeatherOpenAPITests/Petstore/Store/Store+Tags.swift b/Tests/FeatherOpenAPITests/Petstore/Store/Store+Tags.swift index 087516a..73ff18d 100644 --- a/Tests/FeatherOpenAPITests/Petstore/Store/Store+Tags.swift +++ b/Tests/FeatherOpenAPITests/Petstore/Store/Store+Tags.swift @@ -12,14 +12,14 @@ extension Petstore.Store { struct StoreTag: TagRepresentable { var name: String { "store" } var description: String? { "Access to Petstore orders" } - var externalDocs: ExternalDocsRepresentable? { + var externalDocs: (any ExternalDocsRepresentable)? { StoreTagExternalDocs() } } struct StoreTagExternalDocs: ExternalDocsRepresentable { var description: String? { "Find out more about our store" } - var url: LocationRepresentable { + var url: any LocationRepresentable { PetstoreLocation(location: "https://swagger.io") } } diff --git a/Tests/FeatherOpenAPITests/Petstore/User/User+Operations.swift b/Tests/FeatherOpenAPITests/Petstore/User/User+Operations.swift index be2a84a..690227b 100644 --- a/Tests/FeatherOpenAPITests/Petstore/User/User+Operations.swift +++ b/Tests/FeatherOpenAPITests/Petstore/User/User+Operations.swift @@ -11,13 +11,13 @@ import OpenAPIKit30 extension Petstore.User { struct CreateOperation: OperationRepresentable { - var tags: [TagRepresentable] { [UserTag()] } + var tags: [any TagRepresentable] { [UserTag()] } var summary: String? { "Create user." } var description: String? { "This can only be done by the logged in user." } var operationId: String? { "createUser" } - var requestBody: RequestBodyRepresentable? { CreateRequestBody() } + var requestBody: (any RequestBodyRepresentable)? { CreateRequestBody() } var responseMap: ResponseMap { [ 200: UserResponse(description: "successful operation"), @@ -28,13 +28,13 @@ extension Petstore.User { } struct CreateWithListOperation: OperationRepresentable { - var tags: [TagRepresentable] { [UserTag()] } + var tags: [any TagRepresentable] { [UserTag()] } var summary: String? { "Creates list of users with given input array." } var description: String? { "Creates list of users with given input array." } var operationId: String? { "createUsersWithListInput" } - var requestBody: RequestBodyRepresentable? { + var requestBody: (any RequestBodyRepresentable)? { CreateWithListRequestBody() } var responseMap: ResponseMap { @@ -47,11 +47,11 @@ extension Petstore.User { } struct LoginOperation: OperationRepresentable { - var tags: [TagRepresentable] { [UserTag()] } + var tags: [any TagRepresentable] { [UserTag()] } var summary: String? { "Logs user into the system." } var description: String? { "Log into the system." } var operationId: String? { "loginUser" } - var parameters: [ParameterRepresentable] { + var parameters: [any ParameterRepresentable] { [ LoginUsernameParameter(), LoginPasswordParameter(), @@ -70,7 +70,7 @@ extension Petstore.User { } struct LogoutOperation: OperationRepresentable { - var tags: [TagRepresentable] { [UserTag()] } + var tags: [any TagRepresentable] { [UserTag()] } var summary: String? { "Logs out current logged in user session." } var description: String? { "Log user out of the system." } var operationId: String? { "logoutUser" } @@ -84,11 +84,11 @@ extension Petstore.User { } struct GetByNameOperation: OperationRepresentable { - var tags: [TagRepresentable] { [UserTag()] } + var tags: [any TagRepresentable] { [UserTag()] } var summary: String? { "Get user by user name." } var description: String? { "Get user detail based on username." } var operationId: String? { "getUserByName" } - var parameters: [ParameterRepresentable] { + var parameters: [any ParameterRepresentable] { [ UsernameParameter() ] @@ -105,18 +105,18 @@ extension Petstore.User { } struct UpdateOperation: OperationRepresentable { - var tags: [TagRepresentable] { [UserTag()] } + var tags: [any TagRepresentable] { [UserTag()] } var summary: String? { "Update user resource." } var description: String? { "This can only be done by the logged in user." } var operationId: String? { "updateUser" } - var parameters: [ParameterRepresentable] { + var parameters: [any ParameterRepresentable] { [ UpdateUsernameParameter() ] } - var requestBody: RequestBodyRepresentable? { UpdateRequestBody() } + var requestBody: (any RequestBodyRepresentable)? { UpdateRequestBody() } var responseMap: ResponseMap { [ 200: EmptyResponse(description: "successful operation"), @@ -129,13 +129,13 @@ extension Petstore.User { } struct DeleteOperation: OperationRepresentable { - var tags: [TagRepresentable] { [UserTag()] } + var tags: [any TagRepresentable] { [UserTag()] } var summary: String? { "Delete user resource." } var description: String? { "This can only be done by the logged in user." } var operationId: String? { "deleteUser" } - var parameters: [ParameterRepresentable] { + var parameters: [any ParameterRepresentable] { [ DeleteUsernameParameter() ] diff --git a/Tests/FeatherOpenAPITests/Petstore/User/User+PathItems.swift b/Tests/FeatherOpenAPITests/Petstore/User/User+PathItems.swift index cf18989..67c0b26 100644 --- a/Tests/FeatherOpenAPITests/Petstore/User/User+PathItems.swift +++ b/Tests/FeatherOpenAPITests/Petstore/User/User+PathItems.swift @@ -10,24 +10,24 @@ import FeatherOpenAPI extension Petstore.User { struct MainPathItem: PathItemRepresentable { - var post: OperationRepresentable? { CreateOperation() } + var post: (any OperationRepresentable)? { CreateOperation() } } struct CreateWithListPathItem: PathItemRepresentable { - var post: OperationRepresentable? { CreateWithListOperation() } + var post: (any OperationRepresentable)? { CreateWithListOperation() } } struct LoginPathItem: PathItemRepresentable { - var get: OperationRepresentable? { LoginOperation() } + var get: (any OperationRepresentable)? { LoginOperation() } } struct LogoutPathItem: PathItemRepresentable { - var get: OperationRepresentable? { LogoutOperation() } + var get: (any OperationRepresentable)? { LogoutOperation() } } struct IdentifiedPathItem: PathItemRepresentable { - var get: OperationRepresentable? { GetByNameOperation() } - var put: OperationRepresentable? { UpdateOperation() } - var delete: OperationRepresentable? { DeleteOperation() } + var get: (any OperationRepresentable)? { GetByNameOperation() } + var put: (any OperationRepresentable)? { UpdateOperation() } + var delete: (any OperationRepresentable)? { DeleteOperation() } } } diff --git a/Tests/FeatherOpenAPITests/Petstore/User/User+Schemas.swift b/Tests/FeatherOpenAPITests/Petstore/User/User+Schemas.swift index 39ae8fe..b15b4c5 100644 --- a/Tests/FeatherOpenAPITests/Petstore/User/User+Schemas.swift +++ b/Tests/FeatherOpenAPITests/Petstore/User/User+Schemas.swift @@ -79,6 +79,6 @@ extension Petstore.User { } struct UserArraySchema: ArraySchemaRepresentable { - var items: SchemaRepresentable? { UserSchema().reference() } + var items: (any SchemaRepresentable)? { UserSchema().reference() } } } diff --git a/Tests/FeatherOpenAPITests/TestObjects.swift b/Tests/FeatherOpenAPITests/TestObjects.swift index cccb2e3..5572630 100644 --- a/Tests/FeatherOpenAPITests/TestObjects.swift +++ b/Tests/FeatherOpenAPITests/TestObjects.swift @@ -5,7 +5,7 @@ // Created by Tibor Bödecs on 2026. 01. 21. // -import FeatherOpenAPI +public import FeatherOpenAPI import OpenAPIKit30 struct MyPathCollection: PathCollectionRepresentable { @@ -25,7 +25,7 @@ struct MyInfo: InfoRepresentable { struct MyDocument: DocumentRepresentable { - var info: OpenAPIInfoRepresentable + var info: any OpenAPIInfoRepresentable var servers: [any OpenAPIServerRepresentable] { [ @@ -34,12 +34,12 @@ struct MyDocument: DocumentRepresentable { } var paths: PathMap - var components: OpenAPIComponentsRepresentable + var components: any OpenAPIComponentsRepresentable init( - info: OpenAPIInfoRepresentable, + info: any OpenAPIInfoRepresentable, paths: PathMap, - components: OpenAPIComponentsRepresentable + components: any OpenAPIComponentsRepresentable ) { self.info = info self.paths = paths @@ -124,19 +124,19 @@ struct TodoTag: TagRepresentable { struct TodoCreateOperation: OperationRepresentable { - var tags: [TagRepresentable] { + var tags: [any TagRepresentable] { [ TodoTag() ] } - var parameters: [ParameterRepresentable] { + var parameters: [any ParameterRepresentable] { [ TodoIdParameter().reference() ] } - var requestBody: RequestBodyRepresentable? { + var requestBody: (any RequestBodyRepresentable)? { TodoCreateRequestBody().reference() } @@ -161,7 +161,7 @@ struct TodoCreateOperation: OperationRepresentable { } struct TodoPathItems: PathItemRepresentable { - var post: OperationRepresentable? = TodoCreateOperation() + var post: (any OperationRepresentable)? = TodoCreateOperation() } struct OAuthSecurityScheme: SecuritySchemeRepresentable { @@ -198,9 +198,9 @@ struct TagDedupInfo: InfoRepresentable { } struct TagDedupDocument: DocumentRepresentable { - var info: OpenAPIInfoRepresentable + var info: any OpenAPIInfoRepresentable var paths: PathMap - var components: OpenAPIComponentsRepresentable + var components: any OpenAPIComponentsRepresentable } struct TagDedupPaths: PathCollectionRepresentable { @@ -212,8 +212,8 @@ struct TagDedupPaths: PathCollectionRepresentable { } struct TagDedupDogPathItem: PathItemRepresentable { - var get: OperationRepresentable? { TagDedupListDogsOperation() } - var post: OperationRepresentable? { TagDedupCreateDogOperation() } + var get: (any OperationRepresentable)? { TagDedupListDogsOperation() } + var post: (any OperationRepresentable)? { TagDedupCreateDogOperation() } } struct TagDedupDogTag: TagRepresentable { @@ -231,7 +231,7 @@ struct TagDedupDogResponse: JSONResponseRepresentable { } struct TagDedupListDogsOperation: OperationRepresentable { - var tags: [TagRepresentable] { [TagDedupDogTag()] } + var tags: [any TagRepresentable] { [TagDedupDogTag()] } var responseMap: ResponseMap { [ 200: TagDedupDogResponse().reference() @@ -240,7 +240,7 @@ struct TagDedupListDogsOperation: OperationRepresentable { } struct TagDedupCreateDogOperation: OperationRepresentable { - var tags: [TagRepresentable] { [TagDedupDogTag()] } + var tags: [any TagRepresentable] { [TagDedupDogTag()] } var responseMap: ResponseMap { [ 200: TagDedupDogResponse().reference() @@ -256,9 +256,9 @@ struct SecurityRequirementDedupInfo: InfoRepresentable { } struct SecurityRequirementDedupDocument: DocumentRepresentable { - var info: OpenAPIInfoRepresentable + var info: any OpenAPIInfoRepresentable var paths: PathMap - var components: OpenAPIComponentsRepresentable + var components: any OpenAPIComponentsRepresentable } struct SecurityRequirementDedupPaths: PathCollectionRepresentable { @@ -270,10 +270,10 @@ struct SecurityRequirementDedupPaths: PathCollectionRepresentable { } struct SecurityRequirementDedupCatPathItem: PathItemRepresentable { - var get: OperationRepresentable? { + var get: (any OperationRepresentable)? { SecurityRequirementDedupListCatsOperation() } - var post: OperationRepresentable? { + var post: (any OperationRepresentable)? { SecurityRequirementDedupCreateCatOperation() } } @@ -305,7 +305,7 @@ struct SecurityRequirementDedupCatResponse: JSONResponseRepresentable { } struct SecurityRequirementDedupListCatsOperation: OperationRepresentable { - var security: [SecurityRequirementRepresentable]? { + var security: [any SecurityRequirementRepresentable]? { [SecurityRequirementDedupBearerTokenRequirement()] } var responseMap: ResponseMap { @@ -316,7 +316,7 @@ struct SecurityRequirementDedupListCatsOperation: OperationRepresentable { } struct SecurityRequirementDedupCreateCatOperation: OperationRepresentable { - var security: [SecurityRequirementRepresentable]? { + var security: [any SecurityRequirementRepresentable]? { [SecurityRequirementDedupBearerTokenRequirement()] } var responseMap: ResponseMap { diff --git a/docker/tests/Dockerfile b/docker/tests/Dockerfile index 73be175..80800a9 100644 --- a/docker/tests/Dockerfile +++ b/docker/tests/Dockerfile @@ -1,4 +1,4 @@ -FROM swift:6.1 +FROM swift:6.3 WORKDIR /app