-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Runtime errors when testing #14
Comments
🕵️♂️ Investigation in processFor the The three errors go to the same places first here @inlinable
public func unapply(_ output: Root) throws -> Value {
guard let value = self.extract(from: output)
else {
throw ConvertingError(
"""
case: Failed to extract \(Value.self) from \(output).
"""
)
}
return value
} then in the else here guard
MemoryLayout<Struct>.alignment == MemoryLayout<Values>.alignment,
MemoryLayout<Struct>.size == MemoryLayout<Values>.size
else {
throw ConvertingError(
"""
memberwise: Can't convert \(Values.self) type \(Struct.self) as their memory layouts \
differ. This conversion should only be used with a memberwise initializer matching the \
memory layout of the struct. The "memberwise" initializer is the internal, \
compiler-generated initializer that specifies its arguments in the same order as the \
struct specifies its properties.
"""
)
} with this values Value.self: BitriseClient.AllBuildsRoute.Type public enum BitriseRoute: Equatable {
case user(UserRoute = .fetch)
case allBuilds(AllBuildsRoute = .fetch())
case apps(AppsRoute = .fetch())
}
public let bitriseRouter = OneOf {
Route(.case(BitriseRoute.user)) {
Path { "me" }
userRouter
}
Route(.case(BitriseRoute.apps)) {
Path { "apps" }
appsRouter
}
Route(.case(BitriseRoute.allBuilds)) {
Path { "builds" }
allBuildsRouter
}
} Value.self: (Swift.String, BitriseClient.AppRoute).Type public enum AppsRoute: Equatable {
/// Output is AppsFetchResponse
case fetch(SearchOptions = .init())
case app(String, AppRoute = .fetch)
public struct SearchOptions: Codable, Equatable {
let sortBy: SortBy?
let next: String?
let limit: Int?
public init(sortBy: SearchOptions.SortBy? = nil, next: String? = nil, limit: Int? = nil) {
self.sortBy = sortBy
self.next = next
self.limit = limit
}
public enum SortBy: String, CaseIterable, Codable {
case lastBuildAt = "last_build_at"
case createdAt = "created_at"
}
}
}
public let appsRouter = OneOf {
Route(.case(AppsRoute.fetch)) {
Parse(.memberwise(AppsRoute.SearchOptions.init)) { // pas error
Query {
Field("sort_by", default: nil) { AppsRoute.SearchOptions.SortBy.parser() }
Field("next", .string, default: nil)
Field("limit", default: nil) { Digits() }
}
}
}
Route(.case(AppsRoute.app)) {
Path { Parse(.string) }
appRouter
}
} Value.self: BitriseClient.UserRoute.Type related code public enum UserRoute: Equatable {
/// Ouput is UserResponse
case fetch
}
let userRouter = OneOf {
Route(.case(UserRoute.fetch))
} In the code base I do use the |
Haha found it ! |
The issues was due to the lack of |
After having fixing this issue, I think having a way to display the expected request and the one that was parsed could have help. If I have knew that the Field wasn't parsed has optional I would I have fix it sonner. Having a way to print all the possible request for a router could have help. |
Hi,
I did have these runtime errors when trying to do some testing.
I will try to find a fix them and update this later.
Error raise:
caught error: "L’opération n’a pas pu s’achever. (URLRouting.URLRoutingDecodingError erreur 1.)"
Error raise:
caught error: "L’opération n’a pas pu s’achever. (Parsing.PrintingError erreur 1.)"
Rest of the library code (tap to open)
The text was updated successfully, but these errors were encountered: