From 6926655aeae9e5fb58085b4dd2e496565cf5813b Mon Sep 17 00:00:00 2001 From: dankinsoid <30962149+dankinsoid@users.noreply.github.com> Date: Fri, 1 Dec 2023 13:54:07 +0400 Subject: [PATCH] 4.4.2 --- Example/Package.swift | 2 +- .../App/Controllers/PetController.swift | 36 ++++--------------- .../App/Controllers/UserController.swift | 4 +-- Example/Sources/App/Models/Address.swift | 2 +- Example/Sources/App/Models/ApiResponse.swift | 2 +- Example/Sources/App/Models/Category.swift | 2 +- Example/Sources/App/Models/Customer.swift | 2 +- Example/Sources/App/Models/LoginQuery.swift | 2 +- Example/Sources/App/Models/Order.swift | 2 +- .../Sources/App/Models/UpdatePetQuery.swift | 2 +- .../Sources/App/Models/UploadImageQuery.swift | 2 +- Example/Sources/App/Models/User.swift | 2 +- README.md | 2 +- 13 files changed, 19 insertions(+), 43 deletions(-) diff --git a/Example/Package.swift b/Example/Package.swift index ddc6f6fc..e6767a9a 100644 --- a/Example/Package.swift +++ b/Example/Package.swift @@ -12,7 +12,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/vapor/vapor.git", from: "4.70.0"), - .package(url: "https://github.com/dankinsoid/VaporToOpenAPI.git", from: "4.4.0"), + .package(url: "https://github.com/dankinsoid/VaporToOpenAPI.git", from: "4.4.1"), ], targets: [ .target( diff --git a/Example/Sources/App/Controllers/PetController.swift b/Example/Sources/App/Controllers/PetController.swift index cb476a98..447a20d4 100644 --- a/Example/Sources/App/Controllers/PetController.swift +++ b/Example/Sources/App/Controllers/PetController.swift @@ -28,11 +28,7 @@ struct PetController: RouteCollection { body: .type(Pet.self), contentType: .application(.json), .application(.xml), .application(.urlEncoded), response: .type(Pet.self), - responseContentType: .application(.json), .application(.xml), - links: [ - Link(\Pet.id, in: .response): Link.PetID.self, - Link(\Pet.id, in: .request): Link.PetID.self, - ] + responseContentType: .application(.json), .application(.xml) ) .response(statusCode: 400, description: "Invalid ID supplied") .response(statusCode: 404, description: "Pet not found") @@ -47,11 +43,7 @@ struct PetController: RouteCollection { body: .type(Pet.self), contentType: .application(.json), .application(.xml), .application(.urlEncoded), response: .type(Pet.self), - responseContentType: .application(.json), .application(.xml), - links: [ - Link(\Pet.id, in: .response): Link.PetID.self, - Link(\Pet.id, in: .request): Link.PetID.self, - ] + responseContentType: .application(.json), .application(.xml) ) .response(statusCode: 405, description: "Invalid input") @@ -63,10 +55,7 @@ struct PetController: RouteCollection { description: "Multiple status values can be provided with comma separated strings", query: .type(FindPetByStatusQuery.self), response: .type([Pet].self), - responseContentType: .application(.json), .application(.xml), - links: [ - Link(\Pet.id, in: .response): Link.PetID.self, - ] + responseContentType: .application(.json), .application(.xml) ) .response(statusCode: .badRequest, description: "Invalid status value") @@ -78,10 +67,7 @@ struct PetController: RouteCollection { description: "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", query: ["tags": .array(of: .string)], response: .type([Pet].self), - responseContentType: .application(.json), .application(.xml), - links: [ - Link(\Pet.id, in: .response): Link.PetID.self, - ] + responseContentType: .application(.json), .application(.xml) ) .response(statusCode: .badRequest, description: "Invalid tag value") @@ -93,10 +79,6 @@ struct PetController: RouteCollection { description: "Returns a single pet", response: .type(Pet.self), responseContentType: .application(.json), .application(.xml), - links: [ - Link(\Pet.id, in: .path): Link.PetID.self, - Link(\Pet.id, in: .response): Link.PetID.self, - ], auth: .petstoreApiKey ) .response(statusCode: .badRequest, description: "Invalid ID supplied") @@ -107,10 +89,7 @@ struct PetController: RouteCollection { } .openAPI( summary: "Updates a pet in the store with form data", - query: .type(UpdatePetQuery.self), - links: [ - Link(\Pet.id, in: .path): Link.PetID.self, - ] + query: .type(UpdatePetQuery.self) ) .response(statusCode: 405, description: "Invalid input") @@ -118,10 +97,7 @@ struct PetController: RouteCollection { "Success delete" } .openAPI( - summary: "Deletes a pet", - links: [ - Link(\Pet.id, in: .path): Link.PetID.self, - ] + summary: "Deletes a pet" ) .response(statusCode: 400, description: "Invalid pet value") diff --git a/Example/Sources/App/Controllers/UserController.swift b/Example/Sources/App/Controllers/UserController.swift index fe75c0a8..2676bbd9 100644 --- a/Example/Sources/App/Controllers/UserController.swift +++ b/Example/Sources/App/Controllers/UserController.swift @@ -48,9 +48,9 @@ struct UserController: RouteCollection { "Success" } .openAPI( - summary: "Logs out current logged in user session", - response: "successful operation" + summary: "Logs out current logged in user session" ) + .response(description: "successful operation") routes.group(":username") { routes in routes.get { _ in diff --git a/Example/Sources/App/Models/Address.swift b/Example/Sources/App/Models/Address.swift index 36e23e40..a9ba4384 100644 --- a/Example/Sources/App/Models/Address.swift +++ b/Example/Sources/App/Models/Address.swift @@ -4,7 +4,7 @@ import VaporToOpenAPI /// Address @OpenAPIAutoDescriptable -public struct Address: Codable, WithExample, OpenAPIDescriptable { +public struct Address: Codable, WithExample { /// Street address public var street: String? diff --git a/Example/Sources/App/Models/ApiResponse.swift b/Example/Sources/App/Models/ApiResponse.swift index 0ef270da..48d4769a 100644 --- a/Example/Sources/App/Models/ApiResponse.swift +++ b/Example/Sources/App/Models/ApiResponse.swift @@ -5,7 +5,7 @@ import VaporToOpenAPI /// Api response body @OpenAPIAutoDescriptable -public struct ApiResponse: Codable, Content, WithExample, OpenAPIDescriptable { +public struct ApiResponse: Codable, Content, WithExample { /// Response code public var code: Int32? diff --git a/Example/Sources/App/Models/Category.swift b/Example/Sources/App/Models/Category.swift index ca632907..68bd85e9 100644 --- a/Example/Sources/App/Models/Category.swift +++ b/Example/Sources/App/Models/Category.swift @@ -4,7 +4,7 @@ import VaporToOpenAPI @OpenAPIAutoDescriptable /// Category -public struct Category: Codable, Identifiable, WithExample, OpenAPIDescriptable { +public struct Category: Codable, Identifiable, WithExample { /// Unique identifier for the category public var id: Int diff --git a/Example/Sources/App/Models/Customer.swift b/Example/Sources/App/Models/Customer.swift index bbec4ac8..ebe4ce95 100644 --- a/Example/Sources/App/Models/Customer.swift +++ b/Example/Sources/App/Models/Customer.swift @@ -4,7 +4,7 @@ import VaporToOpenAPI @OpenAPIAutoDescriptable /// Customer -public struct Customer: Codable, Identifiable, WithExample, OpenAPIDescriptable { +public struct Customer: Codable, Identifiable, WithExample { /// Customer identifier public var id: Int diff --git a/Example/Sources/App/Models/LoginQuery.swift b/Example/Sources/App/Models/LoginQuery.swift index d63475b2..0690a052 100644 --- a/Example/Sources/App/Models/LoginQuery.swift +++ b/Example/Sources/App/Models/LoginQuery.swift @@ -4,7 +4,7 @@ import VaporToOpenAPI @OpenAPIAutoDescriptable /// Login query -public struct LoginQuery: Codable, WithExample, OpenAPIDescriptable { +public struct LoginQuery: Codable, WithExample { /// Username public var username: String? diff --git a/Example/Sources/App/Models/Order.swift b/Example/Sources/App/Models/Order.swift index 16305ede..c8acd412 100644 --- a/Example/Sources/App/Models/Order.swift +++ b/Example/Sources/App/Models/Order.swift @@ -5,7 +5,7 @@ import VaporToOpenAPI @OpenAPIAutoDescriptable /// Order -public struct Order: Codable, Equatable, Content, WithExample, OpenAPIDescriptable { +public struct Order: Codable, Equatable, Content, WithExample { /// Unique identifier for the order public var id: Int diff --git a/Example/Sources/App/Models/UpdatePetQuery.swift b/Example/Sources/App/Models/UpdatePetQuery.swift index 01bc14db..d4d5158b 100644 --- a/Example/Sources/App/Models/UpdatePetQuery.swift +++ b/Example/Sources/App/Models/UpdatePetQuery.swift @@ -3,7 +3,7 @@ import SwiftOpenAPI import VaporToOpenAPI @OpenAPIAutoDescriptable -public struct UpdatePetQuery: Codable, Equatable, WithExample, OpenAPIDescriptable { +public struct UpdatePetQuery: Codable, Equatable, WithExample { /// Updated name of the pet public var name: String? diff --git a/Example/Sources/App/Models/UploadImageQuery.swift b/Example/Sources/App/Models/UploadImageQuery.swift index cd38b82b..66df3274 100644 --- a/Example/Sources/App/Models/UploadImageQuery.swift +++ b/Example/Sources/App/Models/UploadImageQuery.swift @@ -3,7 +3,7 @@ import SwiftOpenAPI import VaporToOpenAPI @OpenAPIAutoDescriptable -public struct UploadImageQuery: Codable, Equatable, WithExample, OpenAPIDescriptable { +public struct UploadImageQuery: Codable, Equatable, WithExample { /// Additional data to pass to server public var additionalMetadata: String? diff --git a/Example/Sources/App/Models/User.swift b/Example/Sources/App/Models/User.swift index 7ccef901..ce7d74d2 100644 --- a/Example/Sources/App/Models/User.swift +++ b/Example/Sources/App/Models/User.swift @@ -5,7 +5,7 @@ import VaporToOpenAPI @OpenAPIAutoDescriptable /// User model -public struct User: Codable, Content, Identifiable, WithExample, OpenAPIDescriptable { +public struct User: Codable, Content, Identifiable, WithExample { /// Unique identifier for the user public var id: Int diff --git a/README.md b/README.md index 5a11bef7..1251e2a6 100644 --- a/README.md +++ b/README.md @@ -211,7 +211,7 @@ import PackageDescription let package = Package( name: "SomeProject", dependencies: [ - .package(url: "https://github.com/dankinsoid/VaporToOpenAPI.git", from: "4.4.1") + .package(url: "https://github.com/dankinsoid/VaporToOpenAPI.git", from: "4.4.2") ], targets: [ .target(name: "SomeProject", dependencies: ["VaporToOpenAPI"])