feat: fixes improper json when creating a project using a repository

This commit is contained in:
2024-12-12 18:01:32 -05:00
parent a480e942bc
commit bd56660683
2 changed files with 14 additions and 6 deletions

View File

@@ -70,11 +70,15 @@ private struct TemplateRepo: Encodable {
let template: Template let template: Template
init(repo: String, version: String?) { init(repo: String, version: String?) {
self.template = .init(repo: repo, version: version ?? "main") self.template = .init(repo: .init(url: repo, version: version ?? "main"))
} }
struct Template: Encodable { struct Template: Encodable {
let repo: String let repo: Repo
}
struct Repo: Encodable {
let url: String
let version: String let version: String
} }
} }

View File

@@ -233,10 +233,12 @@ struct CliClientTests: TestCase {
expectation: .success(""" expectation: .success("""
{ {
"template" : { "template" : {
"repo" : "https://git.example.com/template.git", "repo" : {
"url" : "https://git.example.com/template.git",
"version" : "main" "version" : "main"
} }
} }
}
""") """)
), ),
GenerateJsonTestOption( GenerateJsonTestOption(
@@ -250,10 +252,12 @@ struct CliClientTests: TestCase {
expectation: .success(""" expectation: .success("""
{ {
"template" : { "template" : {
"repo" : "https://git.example.com/template.git", "repo" : {
"url" : "https://git.example.com/template.git",
"version" : "v0.1.0" "version" : "v0.1.0"
} }
} }
}
""") """)
) )
] ]