replicate / replicate-swift

Swift client for Replicate
https://replicate.com
Apache License 2.0
157 stars 33 forks source link

Make description optional #11

Closed ryango closed 1 year ago

ryango commented 1 year ago

Hit a model that was missing a description, causing model loading to fail Also, fix Xcode warning about whitespace in swift tools line in Package.swift

mattt commented 1 year ago

Thanks so much for your contribution, @ryango! I'll merge this and cut a new release as soon as CI is ✅.

mattt commented 1 year ago

@ryango Looks like a few places need updating to add nil-coalescing for model.description? accessors. I tried pushing those changes to your fork, but got remote rejected. Can you either update your repo to allow pushes from upstream, or apply this patch yourself with git apply?

Git Patch ```patch From e027ff807494fa618ff9c4d185cf243268cb1ff4 Mon Sep 17 00:00:00 2001 From: Mattt Date: Mon, 19 Dec 2022 10:07:00 -0800 Subject: [PATCH 1/1] Add nil coalescing operators for access to model.description Signed-off-by: Mattt --- Sources/generate-replicate-model/Command.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/generate-replicate-model/Command.swift b/Sources/generate-replicate-model/Command.swift index 89ff9bc..3a4f801 100644 --- a/Sources/generate-replicate-model/Command.swift +++ b/Sources/generate-replicate-model/Command.swift @@ -67,7 +67,7 @@ struct GenerateModelCommand: AsyncParsableCommand { }, modifiersBuilder: { TokenSyntax.public - .withLeadingTrivia(model.description.isEmpty ? .zero : .docLineComment("/// \(model.description)")) + .withLeadingTrivia(model.description?.isEmpty ? .zero : .docLineComment("/// \(model?.description)")) }, membersBuilder: { -- 2.37.2 ```
mattt commented 1 year ago

Closing in favor of #13