Skip to content

Commit 3bcc3e6

Browse files
committed
fix: use schema in type name
1 parent 5dfd66e commit 3bcc3e6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/server/templates/python.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ class PythonContext {
4747
return PY_TYPE_MAP[name]
4848
}
4949
if (name in this.types) {
50-
return formatForPyClassName(this.types[name].name);
50+
const type = this.types[name];
51+
const schema = type!.schema;
52+
return `${formatForPyClassName(schema)}${formatForPyClassName(name)}`;
5153
}
5254
throw new TypeError(`Unknown row type: ${name}`);
5355
}
@@ -251,9 +253,10 @@ export const apply = ({
251253
const composite_types = types.filter((type) => type.attributes.length > 0).map((type) => ctx.typeToClass(type));
252254

253255
let output = `
254-
from pydantic import BaseModel, Json, Field
255-
from typing import Any, Annotated, Literal, Optional, TypeAlias
256256
import datetime
257+
from typing import Annotated, Any, List, Literal, Optional, TypeAlias
258+
259+
from pydantic import BaseModel, Field, Json
257260
258261
${concatLines(Object.values(ctx.user_enums))}
259262

0 commit comments

Comments
 (0)