mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-26 08:01:38 +00:00
fix unknown type not handled and add go interface as recognizable type
This commit is contained in:
@@ -99,6 +99,11 @@ fn parse_go_typ(typ: &parser_go_ast::Expr) -> (Option<String>, Typ) {
|
||||
Typ::Object(typs),
|
||||
)
|
||||
}
|
||||
Expr::InterfaceType(_) => (Some("interface{}".to_string()), Typ::Object(vec![])),
|
||||
Expr::MapType(_) => (
|
||||
Some("map[string]interface{}".to_string()),
|
||||
Typ::Object(vec![]),
|
||||
),
|
||||
_ => (None, Typ::Unknown),
|
||||
}
|
||||
}
|
||||
@@ -122,7 +127,7 @@ package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main(x int, y string, z bool, l []string, o struct { Name string `json:"name"` }) {
|
||||
func main(x int, y string, z bool, l []string, o struct { Name string `json:"name"` }, n interface{}, m map[string]interface{}) {
|
||||
fmt.Println("hello world")
|
||||
}
|
||||
|
||||
@@ -172,6 +177,20 @@ func main(x int, y string, z bool, l []string, o struct { Name string `json:"nam
|
||||
default: None,
|
||||
has_default: false
|
||||
},
|
||||
Arg {
|
||||
otyp: Some("interface{}".to_string()),
|
||||
name: "n".to_string(),
|
||||
typ: Typ::Object(vec![]),
|
||||
default: None,
|
||||
has_default: false
|
||||
},
|
||||
Arg {
|
||||
otyp: Some("map[string]interface{}".to_string()),
|
||||
name: "m".to_string(),
|
||||
typ: Typ::Object(vec![]),
|
||||
default: None,
|
||||
has_default: false
|
||||
},
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
@@ -113,6 +113,8 @@ function argSigToJsonSchemaType(
|
||||
} else {
|
||||
newS.items = { type: 'string' }
|
||||
}
|
||||
} else {
|
||||
newS.type = 'object'
|
||||
}
|
||||
if (oldS.type != newS.type) {
|
||||
for (const prop of Object.getOwnPropertyNames(newS)) {
|
||||
|
||||
Reference in New Issue
Block a user