Skip to content

Commit d3df545

Browse files
authored
Fixes json formatting when creating repository data (#58)
1 parent 9662690 commit d3df545

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/core/handler.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,16 @@ func (c *CoreHandler) createRepositoryData(account model.Account, gitService IGi
268268
return nil, err
269269
}
270270

271-
return gitService.PushChanges(account.Environment, snapshotJsonFromApi, fmt.Sprintf("created %s.json", account.Environment))
271+
// Convert API JSON to model.Snapshot
272+
snapshotApi := c.apiService.NewDataFromJson([]byte(snapshotJsonFromApi))
273+
snapshot := snapshotApi.Snapshot
274+
275+
// Remove version from domain
276+
snapshotContent := snapshot
277+
snapshotContent.Domain.Version = 0
278+
279+
return gitService.PushChanges(account.Environment, utils.ToJsonFromObject(snapshotContent),
280+
fmt.Sprintf("created %s.json", account.Environment))
272281
}
273282

274283
func (c *CoreHandler) isOutSync(account model.Account, lastCommit string, snapshotVersionPayload string) bool {

0 commit comments

Comments
 (0)