Skip to content

Commit

Permalink
fix: Change configID uint64->string in preview mapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Matovidlo committed Dec 18, 2024
1 parent 473080d commit 8144504
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 23 deletions.
6 changes: 3 additions & 3 deletions api/templates/design.go
Original file line number Diff line number Diff line change
Expand Up @@ -1099,9 +1099,9 @@ var InstanceID = Type("InstanceId", String, func() {
Description("ID of the template instance.")
})

var ConfigID = Type("ConfigId", UInt64, func() {
Meta("struct:field:type", "= uint64")
Example(123456)
var ConfigID = Type("ConfigId", String, func() {
Meta("struct:field:type", "= string")
Example("123456")
Description("Config ID of the configuration created by preview.")
})

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/pkg/service/templates/api/openapi/openapi.json

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions internal/pkg/service/templates/api/openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2517,17 +2517,16 @@ definitions:
type: object
properties:
configId:
type: integer
type: string
description: ID of the created/updated configuration. Typically used by preview endpoint
example: 1
format: int64
example: abc123
instanceId:
type: string
description: ID of the created/updated template instance.
example: abc123
description: Outputs generated by the task.
example:
configId: 1
configId: abc123
instanceId: abc123
Template:
title: Template
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/service/templates/api/openapi/openapi3.json

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions internal/pkg/service/templates/api/openapi/openapi3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3780,17 +3780,16 @@ components:
type: object
properties:
configId:
type: integer
type: string
description: Config ID of the configuration created by preview.
example: 123456
format: int64
example: "123456"
instanceId:
type: string
description: ID of the template instance.
example: V1StGXR8IZ5jdHi6BAmyT
description: Outputs generated by the task.
example:
configId: 123456
configId: "123456"
instanceId: V1StGXR8IZ5jdHi6BAmyT
Template:
type: object
Expand Down
7 changes: 1 addition & 6 deletions internal/pkg/service/templates/api/service/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"slices"
"sort"
"strconv"
"time"

"github.com/spf13/cast"
Expand Down Expand Up @@ -87,12 +86,8 @@ func (m Mapper) TaskPayload(model task.Task) (r *Task, err error) {
}

if v, ok := model.Outputs["configId"].(string); ok {
configID, err := strconv.ParseUint(v, 10, 64)
if err != nil {
return nil, err
}
out.Outputs = &TaskOutputs{
ConfigID: &configID,
ConfigID: &v,
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"duration": %d,
"result": "template preview created",
"outputs": {
"configId": %d
"configId": "%s"
}
}

0 comments on commit 8144504

Please sign in to comment.