fix(frontend): infer args if the schema is not an object (#2782)

This commit is contained in:
Faton Ramadani
2023-12-05 15:03:49 +01:00
committed by GitHub
parent a6d1e7c79b
commit b67d00540b
+3 -1
View File
@@ -210,7 +210,8 @@ function argSigToJsonSchemaType(
export async function loadSchemaFromPath(path: string, hash?: string): Promise<Schema> {
if (path.startsWith('hub/')) {
const { content, language, schema } = await ScriptService.getHubScriptByPath({ path })
if (schema && 'properties' in schema) {
if (schema && typeof schema === 'object' && 'properties' in schema) {
return schema
} else {
const newSchema = emptySchema()
@@ -222,6 +223,7 @@ export async function loadSchemaFromPath(path: string, hash?: string): Promise<S
workspace: get(workspaceStore)!,
hash
})
return inferSchemaIfNecessary(script)
} else {
const script = await ScriptService.getScriptByPath({