-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Describe the bug
When retrieving the type name via the ApodiniTypeInformation framework of a type which is e.g. declared in a function, the OpenAPI doesn't support those as the type name includes characters which are disallowed in OpenAPI schema references.
To Reproduce
Given the example of (assuming this lies in a target name ExampleTarget):
struct OuterTest {
static func test() {
struct Test {}
print(String(reflecting: Test.self))
}
}
OuterTest.test()it will print the string ExampleTarget.OuterTest.(unknown context at $109f9c144).(unknown context at $109f9c14c).Test.
ApodiniTypeInformation will create a TypeName which the type Test, target name ExampleTarget and the nested type (unknowncontextat$109f9c144) and (unknowncontextat$109f9c14c).
OpenAPI will just use the concatenation of those when creating a schema entry. This is problematic when trying to reference it, as the type name contains the illegal character (, ) and $.
Expected behavior
It is not entirely clear what the best solution is. One might simple replace those illegal characters, but then we still have an unstable type name (the hex digits change for every compilation step). If we just remove those unknown context entries, it might result in a name collision with a type with the same name defined on the level without those "context" levels or with a type name placed in another function.