-
Notifications
You must be signed in to change notification settings - Fork 730
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
Invalid redeclaration of synthesized property '_id' #3376
Comments
I think we might be able to use |
Hmmmm... this is one we haven't seen yet. I don't think @BobaFetters the work you're doing for changing schema type names doesn't apply to changing the names of fields on the types, right? Just the actual type names themselves? |
@AnthonyMDev actually |
The // @generated
// This file was automatically generated and should not be edited.
import ApolloTestSupport
import MySchema
public class MyGeneratedType: MockObject {
public static let objectType: ApolloAPI.Object = MyGeneratedSchema.Objects.MyGeneratedType
public static let _mockFields = MockFields()
public typealias MockValueCollectionType = Array<Mock<MyGeneratedType>>
public struct MockFields {
@Field<MyGeneratedSchema.ID>("aliasedId") public var aliasedId
@Field<MyGeneratedSchema.ID>("id") public var id
}
}
public extension Mock where O == MyGeneratedType {
convenience init(
aliasedId: MyGeneratedSchema.ID? = nil,
id: MyGeneratedSchema.ID? = nil
) {
self.init()
_setScalar(aliasedId, for: \.aliasedId)
_setScalar(id, for: \.id)
}
} |
Ohhh, okay! I was remembering how that worked incorrectly. Great. That is actually the correct solution to this problem then! Thanks for the update. |
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better. |
Summary
I have a rather urgent issue that popped up when trying to use the TestSupport sources. I get the following static compiler error on a
MockObject
type:The reason seems to be that it's a type in our schema that defines both a
_id
and aid
field, and the codegen outputs that, but Swift doesn't like it.Version
1.10.0
Steps to reproduce the behavior
Run codegen while generating mocks for a type with both
_id
andid
fields. Then try to use the generatedMockObject
for that type.Logs
No response
Anything else?
The text was updated successfully, but these errors were encountered: