Hi i’m trying to generate a swift client with x swift
i’m getting multiple errors on missing interfaces.
I’m on xcode 12 beta 6.
For example i get this generated
public class UpdateAuditBase<Table : JsonSerializable, TResponse : JsonSerializable> : IUpdateDb<Table>
{
required public init(){}
}
It’s complaining on IUpdateDb which dosen’t exist.
Also i get an error that IAudit is redundant because is already present on AuditBase
public class ChangeSet : AuditBase, IAudit
I get multiple of the above errors.
Edit: Also i noticed that i get errors when it generate the dto for AuthenticateResponse it cant find IHasSessionId, IHasBearerToken.
The same services generate fine on typescript
There is a way for example to exclude IUpdateDb and ICreateDb to be generated or to include it i have tried using the settings on top of the file without any luck.
var typesConfig = GetPlugin<NativeTypesFeature>().MetadataTypesConfig;
typesConfig.ExportTypes.Remove(typeof(ICreateDb<>));
typesConfig.ExportTypes.Remove(typeof(IUpdateDb<>));
typesConfig.ExportTypes.Remove(typeof(IPatchDb<>));
typesConfig.ExportTypes.Remove(typeof(IUpdateDb<>));
typesConfig.ExportTypes.Remove(typeof(ISaveDb<>));
But as Swift doesn’t supports C# generic marker interfaces in generic protocols I’ve removed them by default for Swift. This change is available from v5.9.3 that’s now available on MyGet.
Otherwise especially for IAudit it would generate a dto with IAudit added while is also on the base class, and swift will complain that is declared twice.
for my case should be ok not having this interface at all.
ok cool, I’ve changed it so it only generates the Type’s direct interfaces which should avoid this duplicate interface issue. This change is available on the latest v5.9.3 that’s now on MyGet.
After updating the next version of the Swift library it should resolve the outstanding issues.
Upgraded on both sides and those issues are resolved.
One thing i don’t understand when trying to do a postAsync i get this error
let rq = QueryLooks<Look>()
client.postAsync(rq)
.then { r in
return r
}
Instance method 'then(on:flags:_:)' requires that 'QueryLooks<Look>.Return' (aka 'QueryResponse<Look>') conform to 'Thenable'
Is something i’m missing? this is my first time with promisekit
The error says then can only return a Thenable, i.e. a Promise. You already have the completed Response DTO in the then callback so you should handle the response there and not return anything.
Yeah sorry i got confused by some old example which didn’t need to return anything, but as of now to compile it need to return another promise.
Instead i managed to use .done as it dosen’t need to return anything.