Skip to content

Commit

Permalink
4.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dankinsoid committed Dec 1, 2023
1 parent a2e457d commit 6926655
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 43 deletions.
2 changes: 1 addition & 1 deletion Example/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
36 changes: 6 additions & 30 deletions Example/Sources/App/Controllers/PetController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")

Expand All @@ -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")

Expand All @@ -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")

Expand All @@ -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")
Expand All @@ -107,21 +89,15 @@ 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")

routes.delete(":petId") { _ in
"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")

Expand Down
4 changes: 2 additions & 2 deletions Example/Sources/App/Controllers/UserController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Example/Sources/App/Models/Address.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion Example/Sources/App/Models/ApiResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion Example/Sources/App/Models/Category.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Example/Sources/App/Models/Customer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Example/Sources/App/Models/LoginQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion Example/Sources/App/Models/Order.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Example/Sources/App/Models/UpdatePetQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion Example/Sources/App/Models/UploadImageQuery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion Example/Sources/App/Models/User.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down

0 comments on commit 6926655

Please sign in to comment.