Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
209 changes: 185 additions & 24 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions cli/daemon/mcp/schema_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ func renderBuiltinValue(buf *bytes.Buffer, b schema.Builtin, urlEncode bool) {
value = "{}"
case schema.Builtin_USER_ID:
value = "\"userID\""
case schema.Builtin_DECIMAL:
value = "\"0.0\""
default:
value = "<unknown>"
}
Expand Down
2 changes: 1 addition & 1 deletion internal/gocodegen/marshalling.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ func (w *MarshallingCodeWrapper) Finalize(ifErrorBlock ...Code) []Code {
}

func (g *MarshallingCodeGenerator) shouldBeTreatedAsString(builtin schema.Builtin) bool {
return builtin == schema.Builtin_STRING ||
return builtin == schema.Builtin_STRING || builtin == schema.Builtin_DECIMAL ||
(g.encoreTypesAsString && builtin == schema.Builtin_UUID) ||
(g.encoreTypesAsString && builtin == schema.Builtin_USER_ID)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/clientgen/golang.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func (g *golang) generateClient(file *File, appSlug string, set clientgentypes.S
g.generateOptionFunc(
file,
"HTTPClient",
`can be used to configure the underlying HTTP client used when making API calls.
`can be used to configure the underlying HTTP client used when making API calls.

Defaults to http.DefaultClient`,
&Statement{Id("client").Id("HTTPDoer")},
Expand Down Expand Up @@ -886,7 +886,7 @@ func (g *golang) getType(typ *schema.Type) Code {
return Qual("time", "Time")
case schema.Builtin_JSON:
return Qual("encoding/json", "RawMessage")
case schema.Builtin_UUID, schema.Builtin_USER_ID:
case schema.Builtin_UUID, schema.Builtin_USER_ID, schema.Builtin_DECIMAL:
// we don't want to add any custom depdancies, so these come in as strings
return String()
default:
Expand Down
2 changes: 2 additions & 0 deletions pkg/clientgen/javascript.go
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,8 @@ func (js *javascript) convertStringToBuiltin(typ schema.Builtin, val string) str
return val
case schema.Builtin_USER_ID:
return val
case schema.Builtin_DECIMAL:
return val
default:
js.errorf("unknown builtin type %v", typ)
return "any"
Expand Down
4 changes: 4 additions & 0 deletions pkg/clientgen/openapi/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ func (g *Generator) builtinSchemaType(t schema.Builtin) *openapi3.Schema {
return openapi3.NewObjectSchema()
case schema.Builtin_USER_ID:
return openapi3.NewStringSchema()
case schema.Builtin_DECIMAL:
return openapi3.NewStringSchema()
default:
doBailout(errors.Newf("unknown builtin type %v", t))
panic("unreachable")
Expand Down Expand Up @@ -370,6 +372,8 @@ func (g *Generator) typeToDefinitionName(typ *schema.Type) string {
return "int"
case schema.Builtin_UINT:
return "uint"
case schema.Builtin_DECIMAL:
return "string"
default:
return ""
}
Expand Down
Loading