Saw that a few new releases were recently made, so I updated my app from 0.27.
I'm glad errorResponses was added!
However after updating, many of my routes have disappeared from the generated OpenAPI.
Examples:
let groups = authenticated.grouped("groups")
// ❌ Does not appear in openAPI
groups.get(use: groupController.list)
.openAPI(
summary: "List \(Group.self)s",
description: "List all the \(Group.self)s of the current \(Account.self)",
response: [GroupDTO].self
)
// ✅ Properly appears in openAPI
groups.get("blublublu", use: groupController.list)
.openAPI(
summary: "List \(Group.self)s",
description: "List all the \(Group.self)s of the current \(Account.self)",
response: [GroupDTO].self
)
// ❌ Does not appear in openAPI
groups.get(":id", use: groupController.get)
.openAPI(
summary: "Get a \(Group.self) details",
description: "Get details for a specific \(Group.self)s in the current \(Account.self)",
response: GroupDTO.self,
errorResponses: [
404: NuwErrorMiddleware.ErrorResponse.init(error: true, reason: "Not found")
]
)
// ✅ Properly appears in openAPI
groups.post(use: groupController.create)
.openAPI(
summary: "Create a \(Group.self)",
description: "Create a new users \(Group.self) in the current \(Account.self)",
body: CreateGroup.self,
response: GroupDTO.self,
errorResponses: [
422: NuwErrorMiddleware.ErrorResponse.init(error: true, reason: "Error details"),
409: NuwErrorMiddleware.ErrorResponse.init(error: true, reason: "Already exists")
]
)
// ❌ Does not appear in openAPI
groups.put(":id", use: groupController.update)
.openAPI(
summary: "Update a \(Group.self)",
description: "Update a \(Group.self) in the current \(Account.self)",
body: CreateGroup.self,
response: GroupDTO.self
//responses: []
)
Saw that a few new releases were recently made, so I updated my app from 0.27. I'm glad
errorResponses
was added!However after updating, many of my routes have disappeared from the generated OpenAPI. Examples: