@typespec/emitter-framework 0.15.0-dev.3 → 0.15.0-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -16
- package/dist/src/python/builtins.d.ts +14 -0
- package/dist/src/python/builtins.d.ts.map +1 -0
- package/dist/src/python/builtins.js +29 -0
- package/dist/src/python/builtins.js.map +1 -0
- package/dist/src/python/components/array-expression/array-expression.d.ts +6 -0
- package/dist/src/python/components/array-expression/array-expression.d.ts.map +1 -0
- package/dist/src/python/components/array-expression/array-expression.js +11 -0
- package/dist/src/python/components/array-expression/array-expression.js.map +1 -0
- package/dist/src/python/components/array-expression/array-expression.test.d.ts +2 -0
- package/dist/src/python/components/array-expression/array-expression.test.d.ts.map +1 -0
- package/dist/src/python/components/array-expression/array-expression.test.js +19 -0
- package/dist/src/python/components/array-expression/array-expression.test.js.map +1 -0
- package/dist/src/python/components/array-expression/index.d.ts +2 -0
- package/dist/src/python/components/array-expression/index.d.ts.map +1 -0
- package/dist/src/python/components/array-expression/index.js +2 -0
- package/dist/src/python/components/array-expression/index.js.map +1 -0
- package/dist/src/python/components/atom/atom.d.ts +33 -0
- package/dist/src/python/components/atom/atom.d.ts.map +1 -0
- package/dist/src/python/components/atom/atom.js +88 -0
- package/dist/src/python/components/atom/atom.js.map +1 -0
- package/dist/src/python/components/atom/atom.test.d.ts +2 -0
- package/dist/src/python/components/atom/atom.test.d.ts.map +1 -0
- package/dist/src/python/components/atom/atom.test.js +224 -0
- package/dist/src/python/components/atom/atom.test.js.map +1 -0
- package/dist/src/python/components/atom/index.d.ts +2 -0
- package/dist/src/python/components/atom/index.d.ts.map +1 -0
- package/dist/src/python/components/atom/index.js +2 -0
- package/dist/src/python/components/atom/index.js.map +1 -0
- package/dist/src/python/components/class-declaration/class-bases.d.ts +45 -0
- package/dist/src/python/components/class-declaration/class-bases.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/class-bases.js +84 -0
- package/dist/src/python/components/class-declaration/class-bases.js.map +1 -0
- package/dist/src/python/components/class-declaration/class-body.d.ts +16 -0
- package/dist/src/python/components/class-declaration/class-body.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/class-body.js +52 -0
- package/dist/src/python/components/class-declaration/class-body.js.map +1 -0
- package/dist/src/python/components/class-declaration/class-declaration.d.ts +23 -0
- package/dist/src/python/components/class-declaration/class-declaration.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/class-declaration.js +118 -0
- package/dist/src/python/components/class-declaration/class-declaration.js.map +1 -0
- package/dist/src/python/components/class-declaration/class-declaration.test.d.ts +2 -0
- package/dist/src/python/components/class-declaration/class-declaration.test.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/class-declaration.test.js +1527 -0
- package/dist/src/python/components/class-declaration/class-declaration.test.js.map +1 -0
- package/dist/src/python/components/class-declaration/class-member.d.ts +16 -0
- package/dist/src/python/components/class-declaration/class-member.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/class-member.js +71 -0
- package/dist/src/python/components/class-declaration/class-member.js.map +1 -0
- package/dist/src/python/components/class-declaration/class-member.test.d.ts +2 -0
- package/dist/src/python/components/class-declaration/class-member.test.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/class-member.test.js +202 -0
- package/dist/src/python/components/class-declaration/class-member.test.js.map +1 -0
- package/dist/src/python/components/class-declaration/class-method.d.ts +22 -0
- package/dist/src/python/components/class-declaration/class-method.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/class-method.js +76 -0
- package/dist/src/python/components/class-declaration/class-method.js.map +1 -0
- package/dist/src/python/components/class-declaration/class-method.test.d.ts +2 -0
- package/dist/src/python/components/class-declaration/class-method.test.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/class-method.test.js +298 -0
- package/dist/src/python/components/class-declaration/class-method.test.js.map +1 -0
- package/dist/src/python/components/class-declaration/index.d.ts +7 -0
- package/dist/src/python/components/class-declaration/index.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/index.js +7 -0
- package/dist/src/python/components/class-declaration/index.js.map +1 -0
- package/dist/src/python/components/class-declaration/primitive-initializer.d.ts +22 -0
- package/dist/src/python/components/class-declaration/primitive-initializer.d.ts.map +1 -0
- package/dist/src/python/components/class-declaration/primitive-initializer.js +67 -0
- package/dist/src/python/components/class-declaration/primitive-initializer.js.map +1 -0
- package/dist/src/python/components/doc-element/doc-element.d.ts +46 -0
- package/dist/src/python/components/doc-element/doc-element.d.ts.map +1 -0
- package/dist/src/python/components/doc-element/doc-element.js +59 -0
- package/dist/src/python/components/doc-element/doc-element.js.map +1 -0
- package/dist/src/python/components/doc-element/index.d.ts +2 -0
- package/dist/src/python/components/doc-element/index.d.ts.map +1 -0
- package/dist/src/python/components/doc-element/index.js +2 -0
- package/dist/src/python/components/doc-element/index.js.map +1 -0
- package/dist/src/python/components/enum-declaration/enum-declaration.d.ts +8 -0
- package/dist/src/python/components/enum-declaration/enum-declaration.d.ts.map +1 -0
- package/dist/src/python/components/enum-declaration/enum-declaration.js +80 -0
- package/dist/src/python/components/enum-declaration/enum-declaration.js.map +1 -0
- package/dist/src/python/components/enum-declaration/enum-declaration.test.d.ts +2 -0
- package/dist/src/python/components/enum-declaration/enum-declaration.test.d.ts.map +1 -0
- package/dist/src/python/components/enum-declaration/enum-declaration.test.js +344 -0
- package/dist/src/python/components/enum-declaration/enum-declaration.test.js.map +1 -0
- package/dist/src/python/components/enum-declaration/enum-member.d.ts +9 -0
- package/dist/src/python/components/enum-declaration/enum-member.d.ts.map +1 -0
- package/dist/src/python/components/enum-declaration/enum-member.js +22 -0
- package/dist/src/python/components/enum-declaration/enum-member.js.map +1 -0
- package/dist/src/python/components/enum-declaration/index.d.ts +3 -0
- package/dist/src/python/components/enum-declaration/index.d.ts.map +1 -0
- package/dist/src/python/components/enum-declaration/index.js +3 -0
- package/dist/src/python/components/enum-declaration/index.js.map +1 -0
- package/dist/src/python/components/function-declaration/function-declaration.d.ts +24 -0
- package/dist/src/python/components/function-declaration/function-declaration.d.ts.map +1 -0
- package/dist/src/python/components/function-declaration/function-declaration.js +68 -0
- package/dist/src/python/components/function-declaration/function-declaration.js.map +1 -0
- package/dist/src/python/components/function-declaration/function-declaration.test.d.ts +2 -0
- package/dist/src/python/components/function-declaration/function-declaration.test.d.ts.map +1 -0
- package/dist/src/python/components/function-declaration/function-declaration.test.js +682 -0
- package/dist/src/python/components/function-declaration/function-declaration.test.js.map +1 -0
- package/dist/src/python/components/function-declaration/index.d.ts +2 -0
- package/dist/src/python/components/function-declaration/index.d.ts.map +1 -0
- package/dist/src/python/components/function-declaration/index.js +2 -0
- package/dist/src/python/components/function-declaration/index.js.map +1 -0
- package/dist/src/python/components/index.d.ts +12 -0
- package/dist/src/python/components/index.d.ts.map +1 -0
- package/dist/src/python/components/index.js +12 -0
- package/dist/src/python/components/index.js.map +1 -0
- package/dist/src/python/components/protocol-declaration/callable-parameters.d.ts +25 -0
- package/dist/src/python/components/protocol-declaration/callable-parameters.d.ts.map +1 -0
- package/dist/src/python/components/protocol-declaration/callable-parameters.js +33 -0
- package/dist/src/python/components/protocol-declaration/callable-parameters.js.map +1 -0
- package/dist/src/python/components/protocol-declaration/index.d.ts +3 -0
- package/dist/src/python/components/protocol-declaration/index.d.ts.map +1 -0
- package/dist/src/python/components/protocol-declaration/index.js +3 -0
- package/dist/src/python/components/protocol-declaration/index.js.map +1 -0
- package/dist/src/python/components/protocol-declaration/protocol-declaration.d.ts +8 -0
- package/dist/src/python/components/protocol-declaration/protocol-declaration.d.ts.map +1 -0
- package/dist/src/python/components/protocol-declaration/protocol-declaration.js +86 -0
- package/dist/src/python/components/protocol-declaration/protocol-declaration.js.map +1 -0
- package/dist/src/python/components/protocol-declaration/protocol-declaration.test.d.ts +2 -0
- package/dist/src/python/components/protocol-declaration/protocol-declaration.test.d.ts.map +1 -0
- package/dist/src/python/components/protocol-declaration/protocol-declaration.test.js +117 -0
- package/dist/src/python/components/protocol-declaration/protocol-declaration.test.js.map +1 -0
- package/dist/src/python/components/record-expression/index.d.ts +2 -0
- package/dist/src/python/components/record-expression/index.d.ts.map +1 -0
- package/dist/src/python/components/record-expression/index.js +2 -0
- package/dist/src/python/components/record-expression/index.js.map +1 -0
- package/dist/src/python/components/record-expression/record-expression.d.ts +6 -0
- package/dist/src/python/components/record-expression/record-expression.d.ts.map +1 -0
- package/dist/src/python/components/record-expression/record-expression.js +13 -0
- package/dist/src/python/components/record-expression/record-expression.js.map +1 -0
- package/dist/src/python/components/record-expression/record-expression.test.d.ts +2 -0
- package/dist/src/python/components/record-expression/record-expression.test.d.ts.map +1 -0
- package/dist/src/python/components/record-expression/record-expression.test.js +19 -0
- package/dist/src/python/components/record-expression/record-expression.test.js.map +1 -0
- package/dist/src/python/components/type-alias-declaration/index.d.ts +2 -0
- package/dist/src/python/components/type-alias-declaration/index.d.ts.map +1 -0
- package/dist/src/python/components/type-alias-declaration/index.js +2 -0
- package/dist/src/python/components/type-alias-declaration/index.js.map +1 -0
- package/dist/src/python/components/type-alias-declaration/type-alias-declaration.d.ts +16 -0
- package/dist/src/python/components/type-alias-declaration/type-alias-declaration.d.ts.map +1 -0
- package/dist/src/python/components/type-alias-declaration/type-alias-declaration.js +75 -0
- package/dist/src/python/components/type-alias-declaration/type-alias-declaration.js.map +1 -0
- package/dist/src/python/components/type-alias-declaration/type-alias-declaration.test.d.ts +2 -0
- package/dist/src/python/components/type-alias-declaration/type-alias-declaration.test.d.ts.map +1 -0
- package/dist/src/python/components/type-alias-declaration/type-alias-declaration.test.js +140 -0
- package/dist/src/python/components/type-alias-declaration/type-alias-declaration.test.js.map +1 -0
- package/dist/src/python/components/type-declaration/index.d.ts +2 -0
- package/dist/src/python/components/type-declaration/index.d.ts.map +1 -0
- package/dist/src/python/components/type-declaration/index.js +2 -0
- package/dist/src/python/components/type-declaration/index.js.map +1 -0
- package/dist/src/python/components/type-declaration/type-declaration.d.ts +11 -0
- package/dist/src/python/components/type-declaration/type-declaration.d.ts.map +1 -0
- package/dist/src/python/components/type-declaration/type-declaration.js +31 -0
- package/dist/src/python/components/type-declaration/type-declaration.js.map +1 -0
- package/dist/src/python/components/type-declaration/type-declaration.test.d.ts +2 -0
- package/dist/src/python/components/type-declaration/type-declaration.test.d.ts.map +1 -0
- package/dist/src/python/components/type-declaration/type-declaration.test.js +69 -0
- package/dist/src/python/components/type-declaration/type-declaration.test.js.map +1 -0
- package/dist/src/python/components/type-expression/index.d.ts +2 -0
- package/dist/src/python/components/type-expression/index.d.ts.map +1 -0
- package/dist/src/python/components/type-expression/index.js +2 -0
- package/dist/src/python/components/type-expression/index.js.map +1 -0
- package/dist/src/python/components/type-expression/type-expression.d.ts +12 -0
- package/dist/src/python/components/type-expression/type-expression.d.ts.map +1 -0
- package/dist/src/python/components/type-expression/type-expression.js +348 -0
- package/dist/src/python/components/type-expression/type-expression.js.map +1 -0
- package/dist/src/python/components/type-expression/type-expression.test.d.ts +2 -0
- package/dist/src/python/components/type-expression/type-expression.test.d.ts.map +1 -0
- package/dist/src/python/components/type-expression/type-expression.test.js +503 -0
- package/dist/src/python/components/type-expression/type-expression.test.js.map +1 -0
- package/dist/src/python/index.d.ts +4 -0
- package/dist/src/python/index.d.ts.map +1 -0
- package/dist/src/python/index.js +4 -0
- package/dist/src/python/index.js.map +1 -0
- package/dist/src/python/lib.d.ts +68 -0
- package/dist/src/python/lib.d.ts.map +1 -0
- package/dist/src/python/lib.js +38 -0
- package/dist/src/python/lib.js.map +1 -0
- package/dist/src/python/test-utils.d.ts +8 -0
- package/dist/src/python/test-utils.d.ts.map +1 -0
- package/dist/src/python/test-utils.js +25 -0
- package/dist/src/python/test-utils.js.map +1 -0
- package/dist/src/python/utils/index.d.ts +4 -0
- package/dist/src/python/utils/index.d.ts.map +1 -0
- package/dist/src/python/utils/index.js +4 -0
- package/dist/src/python/utils/index.js.map +1 -0
- package/dist/src/python/utils/operation.d.ts +27 -0
- package/dist/src/python/utils/operation.d.ts.map +1 -0
- package/dist/src/python/utils/operation.js +139 -0
- package/dist/src/python/utils/operation.js.map +1 -0
- package/dist/src/python/utils/refkey.d.ts +23 -0
- package/dist/src/python/utils/refkey.d.ts.map +1 -0
- package/dist/src/python/utils/refkey.js +36 -0
- package/dist/src/python/utils/refkey.js.map +1 -0
- package/dist/src/python/utils/type.d.ts +19 -0
- package/dist/src/python/utils/type.d.ts.map +1 -0
- package/dist/src/python/utils/type.js +24 -0
- package/dist/src/python/utils/type.js.map +1 -0
- package/package.json +9 -1
- package/package.json.bak +10 -1
- package/src/python/builtins.ts +43 -0
- package/src/python/components/array-expression/array-expression.test.tsx +14 -0
- package/src/python/components/array-expression/array-expression.tsx +11 -0
- package/src/python/components/array-expression/index.ts +1 -0
- package/src/python/components/atom/atom.test.tsx +244 -0
- package/src/python/components/atom/atom.tsx +95 -0
- package/src/python/components/atom/index.ts +1 -0
- package/src/python/components/class-declaration/class-bases.tsx +92 -0
- package/src/python/components/class-declaration/class-body.tsx +56 -0
- package/src/python/components/class-declaration/class-declaration.test.tsx +1414 -0
- package/src/python/components/class-declaration/class-declaration.tsx +116 -0
- package/src/python/components/class-declaration/class-member.test.tsx +194 -0
- package/src/python/components/class-declaration/class-member.tsx +67 -0
- package/src/python/components/class-declaration/class-method.test.tsx +250 -0
- package/src/python/components/class-declaration/class-method.tsx +97 -0
- package/src/python/components/class-declaration/index.ts +6 -0
- package/src/python/components/class-declaration/primitive-initializer.tsx +62 -0
- package/src/python/components/doc-element/doc-element.tsx +83 -0
- package/src/python/components/doc-element/index.ts +1 -0
- package/src/python/components/enum-declaration/enum-declaration.test.tsx +319 -0
- package/src/python/components/enum-declaration/enum-declaration.tsx +77 -0
- package/src/python/components/enum-declaration/enum-member.tsx +21 -0
- package/src/python/components/enum-declaration/index.ts +2 -0
- package/src/python/components/function-declaration/function-declaration.test.tsx +582 -0
- package/src/python/components/function-declaration/function-declaration.tsx +90 -0
- package/src/python/components/function-declaration/index.ts +1 -0
- package/src/python/components/index.ts +11 -0
- package/src/python/components/protocol-declaration/callable-parameters.tsx +44 -0
- package/src/python/components/protocol-declaration/index.ts +2 -0
- package/src/python/components/protocol-declaration/protocol-declaration.test.tsx +106 -0
- package/src/python/components/protocol-declaration/protocol-declaration.tsx +73 -0
- package/src/python/components/record-expression/index.ts +1 -0
- package/src/python/components/record-expression/record-expression.test.tsx +14 -0
- package/src/python/components/record-expression/record-expression.tsx +13 -0
- package/src/python/components/type-alias-declaration/index.ts +1 -0
- package/src/python/components/type-alias-declaration/type-alias-declaration.test.tsx +117 -0
- package/src/python/components/type-alias-declaration/type-alias-declaration.tsx +67 -0
- package/src/python/components/type-declaration/index.ts +1 -0
- package/src/python/components/type-declaration/type-declaration.test.tsx +58 -0
- package/src/python/components/type-declaration/type-declaration.tsx +26 -0
- package/src/python/components/type-expression/index.ts +1 -0
- package/src/python/components/type-expression/type-expression.test.tsx +463 -0
- package/src/python/components/type-expression/type-expression.tsx +333 -0
- package/src/python/index.ts +3 -0
- package/src/python/lib.ts +40 -0
- package/src/python/test-utils.tsx +31 -0
- package/src/python/utils/index.ts +3 -0
- package/src/python/utils/operation.ts +161 -0
- package/src/python/utils/refkey.ts +36 -0
- package/src/python/utils/type.ts +31 -0
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { Tester } from "#test/test-host.js";
|
|
3
|
+
import { d } from "@alloy-js/core/testing";
|
|
4
|
+
import { t } from "@typespec/compiler/testing";
|
|
5
|
+
import { describe, expect, it } from "vitest";
|
|
6
|
+
import { getOutput } from "../../test-utils.js";
|
|
7
|
+
import { EnumDeclaration } from "../enum-declaration/enum-declaration.js";
|
|
8
|
+
import { TypeExpression } from "./type-expression.js";
|
|
9
|
+
describe("map Typespec types to Python built-in types", () => {
|
|
10
|
+
it.each([["unknown", "Any", "from typing import Any"], ["string", "str"], ["boolean", "bool"], ["null", "None"], ["void", "None"], ["never", "Never", "from typing import Never"], ["bytes", "bytes"], ["numeric", "number"], ["integer", "int"], ["float", "float"], ["decimal", "Decimal", "from decimal import Decimal"], ["decimal128", "Decimal", "from decimal import Decimal"], ["int64", "int"], ["int32", "int"], ["int16", "int"], ["int8", "int"], ["safeint", "int"], ["uint64", "int"], ["uint32", "int"], ["uint16", "int"], ["uint8", "int"], ["float32", "float"], ["float64", "float"], ["plainDate", "str"], ["plainTime", "str"], ["utcDateTime", "datetime", "from datetime import datetime"], ["offsetDateTime", "str"], ["duration", "str"], ["url", "str"]])("%s => %s", async (tspType, pythonType, extraImport = "") => {
|
|
11
|
+
const {
|
|
12
|
+
program,
|
|
13
|
+
Type
|
|
14
|
+
} = await Tester.compile(t.code`
|
|
15
|
+
alias ${t.type("Type")} = ${t.type(tspType)};
|
|
16
|
+
`);
|
|
17
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
18
|
+
type: Type
|
|
19
|
+
})])).toRenderTo(d`
|
|
20
|
+
${extraImport ? `${extraImport}\n\n\n` : ""}${pythonType}
|
|
21
|
+
`);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
describe("map scalar to Python types", () => {
|
|
25
|
+
it("Email => str (scalars are inlined to base type)", async () => {
|
|
26
|
+
const {
|
|
27
|
+
program,
|
|
28
|
+
Email
|
|
29
|
+
} = await Tester.compile(t.code`
|
|
30
|
+
scalar ${t.scalar("Email")} extends string;
|
|
31
|
+
`);
|
|
32
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
33
|
+
type: Email
|
|
34
|
+
})])).toRenderTo(d`
|
|
35
|
+
str
|
|
36
|
+
`);
|
|
37
|
+
});
|
|
38
|
+
it("PhoneNumber => str (scalar in model property is inlined)", async () => {
|
|
39
|
+
const {
|
|
40
|
+
program,
|
|
41
|
+
_
|
|
42
|
+
} = await Tester.compile(t.code`
|
|
43
|
+
scalar PhoneNumber extends string;
|
|
44
|
+
|
|
45
|
+
model ${t.model("Widget")} {
|
|
46
|
+
phone: PhoneNumber;
|
|
47
|
+
}
|
|
48
|
+
`);
|
|
49
|
+
const phoneProperty = program.resolveTypeReference("Widget")[0];
|
|
50
|
+
const phoneProp = phoneProperty.properties.get("phone");
|
|
51
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
52
|
+
get type() {
|
|
53
|
+
return phoneProp.type;
|
|
54
|
+
}
|
|
55
|
+
})])).toRenderTo(d`
|
|
56
|
+
str
|
|
57
|
+
`);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
describe("map tuple to Python types", () => {
|
|
61
|
+
it("[int32, int32] => tuple[int, int]", async () => {
|
|
62
|
+
const {
|
|
63
|
+
program,
|
|
64
|
+
Tuple
|
|
65
|
+
} = await Tester.compile(t.code`
|
|
66
|
+
alias ${t.type("Tuple")} = [int32, int32];
|
|
67
|
+
`);
|
|
68
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
69
|
+
type: Tuple
|
|
70
|
+
})])).toRenderTo(d`
|
|
71
|
+
tuple[int, int]
|
|
72
|
+
`);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
describe("map operation (function type) to typing.Callable", () => {
|
|
76
|
+
it("op f(a: int32, b: string): void => Callable[[int, str], None]", async () => {
|
|
77
|
+
const {
|
|
78
|
+
program,
|
|
79
|
+
f
|
|
80
|
+
} = await Tester.compile(t.code`
|
|
81
|
+
op ${t.op("f")}(a: int32, b: string): void;
|
|
82
|
+
`);
|
|
83
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
84
|
+
type: f
|
|
85
|
+
})])).toRenderTo(d`
|
|
86
|
+
from typing import Callable
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
Callable[[int, str], None]
|
|
90
|
+
`);
|
|
91
|
+
});
|
|
92
|
+
it("op g(): int32 => Callable[[], int]", async () => {
|
|
93
|
+
const {
|
|
94
|
+
program,
|
|
95
|
+
g
|
|
96
|
+
} = await Tester.compile(t.code`
|
|
97
|
+
op ${t.op("g")}(): int32;
|
|
98
|
+
`);
|
|
99
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
100
|
+
type: g
|
|
101
|
+
})])).toRenderTo(d`
|
|
102
|
+
from typing import Callable
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
Callable[[], int]
|
|
106
|
+
`);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
describe("correctly solves a ModelProperty to Python types", () => {
|
|
110
|
+
it("[int32, int32] => tuple[int, int]", async () => {
|
|
111
|
+
const {
|
|
112
|
+
program,
|
|
113
|
+
tupleProperty
|
|
114
|
+
} = await Tester.compile(t.code`
|
|
115
|
+
model Test {
|
|
116
|
+
${t.modelProperty("tupleProperty")}: [int32, int32];
|
|
117
|
+
}
|
|
118
|
+
`);
|
|
119
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
120
|
+
type: tupleProperty
|
|
121
|
+
})])).toRenderTo(d`
|
|
122
|
+
tuple[int, int]
|
|
123
|
+
`);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
describe("handles UnionVariant types", () => {
|
|
127
|
+
it("renders named union variant with literal value as Literal[Union.MEMBER]", async () => {
|
|
128
|
+
const {
|
|
129
|
+
program,
|
|
130
|
+
Color
|
|
131
|
+
} = await Tester.compile(t.code`
|
|
132
|
+
union ${t.union("Color")} {
|
|
133
|
+
red: "red",
|
|
134
|
+
blue: "blue",
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
model Widget {
|
|
138
|
+
color: Color.red;
|
|
139
|
+
}
|
|
140
|
+
`);
|
|
141
|
+
const Widget = program.resolveTypeReference("Widget")[0];
|
|
142
|
+
const colorProperty = Widget.properties.get("color");
|
|
143
|
+
expect(getOutput(program, [_$createComponent(EnumDeclaration, {
|
|
144
|
+
type: Color
|
|
145
|
+
}), _$createComponent(TypeExpression, {
|
|
146
|
+
get type() {
|
|
147
|
+
return colorProperty.type;
|
|
148
|
+
}
|
|
149
|
+
})])).toRenderTo(d`
|
|
150
|
+
from enum import StrEnum
|
|
151
|
+
from typing import Literal
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
class Color(StrEnum):
|
|
155
|
+
RED = "red"
|
|
156
|
+
BLUE = "blue"
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
Literal[Color.RED]
|
|
160
|
+
`);
|
|
161
|
+
});
|
|
162
|
+
it("renders named union variant with integer literal as Literal[Union.MEMBER]", async () => {
|
|
163
|
+
const {
|
|
164
|
+
program,
|
|
165
|
+
Status
|
|
166
|
+
} = await Tester.compile(t.code`
|
|
167
|
+
union ${t.union("Status")} {
|
|
168
|
+
active: 1,
|
|
169
|
+
inactive: 0,
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
model Widget {
|
|
173
|
+
status: Status.active;
|
|
174
|
+
}
|
|
175
|
+
`);
|
|
176
|
+
const Widget = program.resolveTypeReference("Widget")[0];
|
|
177
|
+
const statusProperty = Widget.properties.get("status");
|
|
178
|
+
expect(getOutput(program, [_$createComponent(EnumDeclaration, {
|
|
179
|
+
type: Status
|
|
180
|
+
}), _$createComponent(TypeExpression, {
|
|
181
|
+
get type() {
|
|
182
|
+
return statusProperty.type;
|
|
183
|
+
}
|
|
184
|
+
})])).toRenderTo(d`
|
|
185
|
+
from enum import IntEnum
|
|
186
|
+
from typing import Literal
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
class Status(IntEnum):
|
|
190
|
+
ACTIVE = 1
|
|
191
|
+
INACTIVE = 0
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
Literal[Status.ACTIVE]
|
|
195
|
+
`);
|
|
196
|
+
});
|
|
197
|
+
it("unwraps union variant with non-literal type to reveal the inner type", async () => {
|
|
198
|
+
const {
|
|
199
|
+
program
|
|
200
|
+
} = await Tester.compile(t.code`
|
|
201
|
+
union Status {
|
|
202
|
+
active: string,
|
|
203
|
+
inactive: int32,
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
model Widget {
|
|
207
|
+
status: Status.inactive;
|
|
208
|
+
}
|
|
209
|
+
`);
|
|
210
|
+
const Widget = program.resolveTypeReference("Widget")[0];
|
|
211
|
+
const statusProperty = Widget.properties.get("status");
|
|
212
|
+
|
|
213
|
+
// The UnionVariant should unwrap to reveal int32 (non-literal type)
|
|
214
|
+
expect(statusProperty.type.kind).toBe("UnionVariant");
|
|
215
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
216
|
+
get type() {
|
|
217
|
+
return statusProperty.type;
|
|
218
|
+
}
|
|
219
|
+
})])).toRenderTo(d`
|
|
220
|
+
int
|
|
221
|
+
`);
|
|
222
|
+
});
|
|
223
|
+
it("handles named union variant in function return type", async () => {
|
|
224
|
+
const {
|
|
225
|
+
program,
|
|
226
|
+
Result
|
|
227
|
+
} = await Tester.compile(t.code`
|
|
228
|
+
union ${t.union("Result")} {
|
|
229
|
+
success: "success",
|
|
230
|
+
failure: "failure",
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
op getResult(): Result.success;
|
|
234
|
+
`);
|
|
235
|
+
const getResult = program.resolveTypeReference("getResult")[0];
|
|
236
|
+
const returnType = getResult.returnType;
|
|
237
|
+
expect(getOutput(program, [_$createComponent(EnumDeclaration, {
|
|
238
|
+
type: Result
|
|
239
|
+
}), _$createComponent(TypeExpression, {
|
|
240
|
+
type: returnType
|
|
241
|
+
})])).toRenderTo(d`
|
|
242
|
+
from enum import StrEnum
|
|
243
|
+
from typing import Literal
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
class Result(StrEnum):
|
|
247
|
+
SUCCESS = "success"
|
|
248
|
+
FAILURE = "failure"
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
Literal[Result.SUCCESS]
|
|
252
|
+
`);
|
|
253
|
+
});
|
|
254
|
+
it("unwraps nested union variant with non-literal inner types", async () => {
|
|
255
|
+
const {
|
|
256
|
+
program
|
|
257
|
+
} = await Tester.compile(t.code`
|
|
258
|
+
union Inner {
|
|
259
|
+
a: string,
|
|
260
|
+
b: int32,
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
union Outer {
|
|
264
|
+
x: Inner.a,
|
|
265
|
+
y: Inner.b,
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
model Widget {
|
|
269
|
+
value: Outer.x;
|
|
270
|
+
}
|
|
271
|
+
`);
|
|
272
|
+
const Widget = program.resolveTypeReference("Widget")[0];
|
|
273
|
+
const valueProperty = Widget.properties.get("value");
|
|
274
|
+
|
|
275
|
+
// Inner.a has type `string` (not a literal), so it unwraps
|
|
276
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
277
|
+
get type() {
|
|
278
|
+
return valueProperty.type;
|
|
279
|
+
}
|
|
280
|
+
})])).toRenderTo(d`
|
|
281
|
+
str
|
|
282
|
+
`);
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
describe("handles literal types", () => {
|
|
286
|
+
it("renders union of string literals as Literal[...]", async () => {
|
|
287
|
+
const {
|
|
288
|
+
program
|
|
289
|
+
} = await Tester.compile(t.code`
|
|
290
|
+
model Widget {
|
|
291
|
+
status: "active" | "inactive" | "pending";
|
|
292
|
+
}
|
|
293
|
+
`);
|
|
294
|
+
const Widget = program.resolveTypeReference("Widget")[0];
|
|
295
|
+
const statusProperty = Widget.properties.get("status");
|
|
296
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
297
|
+
get type() {
|
|
298
|
+
return statusProperty.type;
|
|
299
|
+
}
|
|
300
|
+
})])).toRenderTo(d`
|
|
301
|
+
from typing import Literal
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
Literal["active", "inactive", "pending"]
|
|
305
|
+
`);
|
|
306
|
+
});
|
|
307
|
+
it("renders union of integer literals as Literal[...]", async () => {
|
|
308
|
+
const {
|
|
309
|
+
program
|
|
310
|
+
} = await Tester.compile(t.code`
|
|
311
|
+
model Widget {
|
|
312
|
+
priority: 1 | 2 | 3;
|
|
313
|
+
}
|
|
314
|
+
`);
|
|
315
|
+
const Widget = program.resolveTypeReference("Widget")[0];
|
|
316
|
+
const priorityProperty = Widget.properties.get("priority");
|
|
317
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
318
|
+
get type() {
|
|
319
|
+
return priorityProperty.type;
|
|
320
|
+
}
|
|
321
|
+
})])).toRenderTo(d`
|
|
322
|
+
from typing import Literal
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
Literal[1, 2, 3]
|
|
326
|
+
`);
|
|
327
|
+
});
|
|
328
|
+
it("renders union of boolean literals as Literal[...]", async () => {
|
|
329
|
+
const {
|
|
330
|
+
program
|
|
331
|
+
} = await Tester.compile(t.code`
|
|
332
|
+
model Widget {
|
|
333
|
+
flag: true | false;
|
|
334
|
+
}
|
|
335
|
+
`);
|
|
336
|
+
const Widget = program.resolveTypeReference("Widget")[0];
|
|
337
|
+
const flagProperty = Widget.properties.get("flag");
|
|
338
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
339
|
+
get type() {
|
|
340
|
+
return flagProperty.type;
|
|
341
|
+
}
|
|
342
|
+
})])).toRenderTo(d`
|
|
343
|
+
from typing import Literal
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
Literal[True, False]
|
|
347
|
+
`);
|
|
348
|
+
});
|
|
349
|
+
it("renders mixed literal union as Literal[...]", async () => {
|
|
350
|
+
const {
|
|
351
|
+
program
|
|
352
|
+
} = await Tester.compile(t.code`
|
|
353
|
+
model Widget {
|
|
354
|
+
value: "auto" | 0 | 100;
|
|
355
|
+
}
|
|
356
|
+
`);
|
|
357
|
+
const Widget = program.resolveTypeReference("Widget")[0];
|
|
358
|
+
const valueProperty = Widget.properties.get("value");
|
|
359
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
360
|
+
get type() {
|
|
361
|
+
return valueProperty.type;
|
|
362
|
+
}
|
|
363
|
+
})])).toRenderTo(d`
|
|
364
|
+
from typing import Literal
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
Literal["auto", 0, 100]
|
|
368
|
+
`);
|
|
369
|
+
});
|
|
370
|
+
it("renders function returning literal union as Literal[...]", async () => {
|
|
371
|
+
const {
|
|
372
|
+
program
|
|
373
|
+
} = await Tester.compile(t.code`
|
|
374
|
+
op getStatus(): "success" | "failure";
|
|
375
|
+
`);
|
|
376
|
+
const getStatus = program.resolveTypeReference("getStatus")[0];
|
|
377
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
378
|
+
get type() {
|
|
379
|
+
return getStatus.returnType;
|
|
380
|
+
}
|
|
381
|
+
})])).toRenderTo(d`
|
|
382
|
+
from typing import Literal
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
Literal["success", "failure"]
|
|
386
|
+
`);
|
|
387
|
+
});
|
|
388
|
+
it("renders single string literal as Literal[...]", async () => {
|
|
389
|
+
const {
|
|
390
|
+
program
|
|
391
|
+
} = await Tester.compile(t.code`
|
|
392
|
+
model Widget {
|
|
393
|
+
constant: "fixed-value";
|
|
394
|
+
}
|
|
395
|
+
`);
|
|
396
|
+
const Widget = program.resolveTypeReference("Widget")[0];
|
|
397
|
+
const constantProperty = Widget.properties.get("constant");
|
|
398
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
399
|
+
get type() {
|
|
400
|
+
return constantProperty.type;
|
|
401
|
+
}
|
|
402
|
+
})])).toRenderTo(d`
|
|
403
|
+
from typing import Literal
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
Literal["fixed-value"]
|
|
407
|
+
`);
|
|
408
|
+
});
|
|
409
|
+
it("renders function returning single string literal as Literal[...]", async () => {
|
|
410
|
+
const {
|
|
411
|
+
program
|
|
412
|
+
} = await Tester.compile(t.code`
|
|
413
|
+
op getSteve(): "steve";
|
|
414
|
+
`);
|
|
415
|
+
const getSteve = program.resolveTypeReference("getSteve")[0];
|
|
416
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
417
|
+
get type() {
|
|
418
|
+
return getSteve.returnType;
|
|
419
|
+
}
|
|
420
|
+
})])).toRenderTo(d`
|
|
421
|
+
from typing import Literal
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
Literal["steve"]
|
|
425
|
+
`);
|
|
426
|
+
});
|
|
427
|
+
it("renders single numeric literal as Literal[...]", async () => {
|
|
428
|
+
const {
|
|
429
|
+
program
|
|
430
|
+
} = await Tester.compile(t.code`
|
|
431
|
+
op getAnswer(): 42;
|
|
432
|
+
`);
|
|
433
|
+
const getAnswer = program.resolveTypeReference("getAnswer")[0];
|
|
434
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
435
|
+
get type() {
|
|
436
|
+
return getAnswer.returnType;
|
|
437
|
+
}
|
|
438
|
+
})])).toRenderTo(d`
|
|
439
|
+
from typing import Literal
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
Literal[42]
|
|
443
|
+
`);
|
|
444
|
+
});
|
|
445
|
+
it("renders single boolean literal as Literal[...]", async () => {
|
|
446
|
+
const {
|
|
447
|
+
program
|
|
448
|
+
} = await Tester.compile(t.code`
|
|
449
|
+
op isEnabled(): true;
|
|
450
|
+
`);
|
|
451
|
+
const isEnabled = program.resolveTypeReference("isEnabled")[0];
|
|
452
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
453
|
+
get type() {
|
|
454
|
+
return isEnabled.returnType;
|
|
455
|
+
}
|
|
456
|
+
})])).toRenderTo(d`
|
|
457
|
+
from typing import Literal
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
Literal[True]
|
|
461
|
+
`);
|
|
462
|
+
});
|
|
463
|
+
it("renders union with non-literal types as regular union", async () => {
|
|
464
|
+
const {
|
|
465
|
+
program
|
|
466
|
+
} = await Tester.compile(t.code`
|
|
467
|
+
model Widget {
|
|
468
|
+
value: string | int32;
|
|
469
|
+
}
|
|
470
|
+
`);
|
|
471
|
+
const Widget = program.resolveTypeReference("Widget")[0];
|
|
472
|
+
const valueProperty = Widget.properties.get("value");
|
|
473
|
+
|
|
474
|
+
// Mixed literal and non-literal types render as regular union
|
|
475
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
476
|
+
get type() {
|
|
477
|
+
return valueProperty.type;
|
|
478
|
+
}
|
|
479
|
+
})])).toRenderTo(d`
|
|
480
|
+
str | int
|
|
481
|
+
`);
|
|
482
|
+
});
|
|
483
|
+
it("renders function with literal parameter type", async () => {
|
|
484
|
+
const {
|
|
485
|
+
program
|
|
486
|
+
} = await Tester.compile(t.code`
|
|
487
|
+
op setMode(mode: "auto" | "manual"): void;
|
|
488
|
+
`);
|
|
489
|
+
const setMode = program.resolveTypeReference("setMode")[0];
|
|
490
|
+
const modeParam = setMode.parameters.properties.get("mode");
|
|
491
|
+
expect(getOutput(program, [_$createComponent(TypeExpression, {
|
|
492
|
+
get type() {
|
|
493
|
+
return modeParam.type;
|
|
494
|
+
}
|
|
495
|
+
})])).toRenderTo(d`
|
|
496
|
+
from typing import Literal
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
Literal["auto", "manual"]
|
|
500
|
+
`);
|
|
501
|
+
});
|
|
502
|
+
});
|
|
503
|
+
//# sourceMappingURL=type-expression.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Tester","d","t","describe","expect","it","getOutput","EnumDeclaration","TypeExpression","each","tspType","pythonType","extraImport","program","Type","compile","code","type","_$createComponent","toRenderTo","Email","scalar","_","model","phoneProperty","resolveTypeReference","phoneProp","properties","get","Tuple","f","op","g","tupleProperty","modelProperty","Color","union","Widget","colorProperty","Status","statusProperty","kind","toBe","Result","getResult","returnType","valueProperty","priorityProperty","flagProperty","getStatus","constantProperty","getSteve","getAnswer","isEnabled","setMode","modeParam","parameters"],"sources":["../../../../../src/python/components/type-expression/type-expression.test.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,CAAC,QAAQ,wBAAwB;AAC1C,SAASC,CAAC,QAAQ,4BAA4B;AAC9C,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,SAAS,QAAQ,qBAAqB;AAC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C,CAAC;EAEFI,EAAE,CAAC,8CAA8C,EAAE,YAAY;IAC7D,MAAM;MAAEQ;IAAQ,CAAC,GAAG,MAAMb,MAAM,CAACe,OAAO,CAACb,CAAC,CAACc,IAAI;AACnD;AACA,KAAK,CAAC;IAEF,MAAMsC,OAAO,GAAGzC,OAAO,CAACY,oBAAoB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAS;IAClE,MAAM8B,SAAS,GAAGD,OAAO,CAACE,UAAU,CAAC7B,UAAU,CAACC,GAAG,CAAC,MAAM,CAAC;IAE3DxB,MAAM,CAACE,SAAS,CAACO,OAAO,EAAE,CAAAK,iBAAA,CAAEV,cAAc;MAAA,IAACS,IAAIA,CAAA;QAAA,OAAEsC,SAAS,CAACtC,IAAI;MAAA;IAAA,GAAK,CAAC,CAAC,CAACE,UAAU,CAAClB,CAAC;AACvF;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/python/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/python/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc,eAAe;AAC7B,cAAc,uBAAuB;AACrC,cAAc,kBAAkB","ignoreList":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export declare const $pythonLib: import("@typespec/compiler").TypeSpecLibrary<{
|
|
2
|
+
"python-unsupported-scalar": {
|
|
3
|
+
readonly default: "Unsupported scalar type, falling back to Any";
|
|
4
|
+
};
|
|
5
|
+
"python-unsupported-type": {
|
|
6
|
+
readonly default: "Unsupported type, falling back to Any";
|
|
7
|
+
};
|
|
8
|
+
"python-unsupported-model-discriminator": {
|
|
9
|
+
readonly default: "Unsupported model discriminator, falling back to not discriminating on serialization/deserialization";
|
|
10
|
+
};
|
|
11
|
+
"python-unsupported-type-transform": {
|
|
12
|
+
readonly default: "Unsupported type for transformation, falling back to not transforming this type";
|
|
13
|
+
};
|
|
14
|
+
}, Record<string, any>, never>;
|
|
15
|
+
export declare const reportPythonDiagnostic: <C extends "python-unsupported-scalar" | "python-unsupported-type" | "python-unsupported-model-discriminator" | "python-unsupported-type-transform", M extends keyof {
|
|
16
|
+
"python-unsupported-scalar": {
|
|
17
|
+
readonly default: "Unsupported scalar type, falling back to Any";
|
|
18
|
+
};
|
|
19
|
+
"python-unsupported-type": {
|
|
20
|
+
readonly default: "Unsupported type, falling back to Any";
|
|
21
|
+
};
|
|
22
|
+
"python-unsupported-model-discriminator": {
|
|
23
|
+
readonly default: "Unsupported model discriminator, falling back to not discriminating on serialization/deserialization";
|
|
24
|
+
};
|
|
25
|
+
"python-unsupported-type-transform": {
|
|
26
|
+
readonly default: "Unsupported type for transformation, falling back to not transforming this type";
|
|
27
|
+
};
|
|
28
|
+
}[C]>(program: import("@typespec/compiler").Program, diag: import("@typespec/compiler").DiagnosticReport<{
|
|
29
|
+
"python-unsupported-scalar": {
|
|
30
|
+
readonly default: "Unsupported scalar type, falling back to Any";
|
|
31
|
+
};
|
|
32
|
+
"python-unsupported-type": {
|
|
33
|
+
readonly default: "Unsupported type, falling back to Any";
|
|
34
|
+
};
|
|
35
|
+
"python-unsupported-model-discriminator": {
|
|
36
|
+
readonly default: "Unsupported model discriminator, falling back to not discriminating on serialization/deserialization";
|
|
37
|
+
};
|
|
38
|
+
"python-unsupported-type-transform": {
|
|
39
|
+
readonly default: "Unsupported type for transformation, falling back to not transforming this type";
|
|
40
|
+
};
|
|
41
|
+
}, C, M>) => void, createPythonDiagnostic: <C extends "python-unsupported-scalar" | "python-unsupported-type" | "python-unsupported-model-discriminator" | "python-unsupported-type-transform", M extends keyof {
|
|
42
|
+
"python-unsupported-scalar": {
|
|
43
|
+
readonly default: "Unsupported scalar type, falling back to Any";
|
|
44
|
+
};
|
|
45
|
+
"python-unsupported-type": {
|
|
46
|
+
readonly default: "Unsupported type, falling back to Any";
|
|
47
|
+
};
|
|
48
|
+
"python-unsupported-model-discriminator": {
|
|
49
|
+
readonly default: "Unsupported model discriminator, falling back to not discriminating on serialization/deserialization";
|
|
50
|
+
};
|
|
51
|
+
"python-unsupported-type-transform": {
|
|
52
|
+
readonly default: "Unsupported type for transformation, falling back to not transforming this type";
|
|
53
|
+
};
|
|
54
|
+
}[C]>(diag: import("@typespec/compiler").DiagnosticReport<{
|
|
55
|
+
"python-unsupported-scalar": {
|
|
56
|
+
readonly default: "Unsupported scalar type, falling back to Any";
|
|
57
|
+
};
|
|
58
|
+
"python-unsupported-type": {
|
|
59
|
+
readonly default: "Unsupported type, falling back to Any";
|
|
60
|
+
};
|
|
61
|
+
"python-unsupported-model-discriminator": {
|
|
62
|
+
readonly default: "Unsupported model discriminator, falling back to not discriminating on serialization/deserialization";
|
|
63
|
+
};
|
|
64
|
+
"python-unsupported-type-transform": {
|
|
65
|
+
readonly default: "Unsupported type for transformation, falling back to not transforming this type";
|
|
66
|
+
};
|
|
67
|
+
}, C, M>) => import("@typespec/compiler").Diagnostic;
|
|
68
|
+
//# sourceMappingURL=lib.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../../src/python/lib.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;;;;;;;8BAgCrB,CAAC;AAEH,eAAO,MACa,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;mBACtB,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;oDAC5B,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createTypeSpecLibrary } from "@typespec/compiler";
|
|
2
|
+
export const $pythonLib = createTypeSpecLibrary({
|
|
3
|
+
name: "emitter-framework",
|
|
4
|
+
diagnostics: {
|
|
5
|
+
"python-unsupported-scalar": {
|
|
6
|
+
severity: "warning",
|
|
7
|
+
messages: {
|
|
8
|
+
default: "Unsupported scalar type, falling back to Any"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"python-unsupported-type": {
|
|
12
|
+
severity: "error",
|
|
13
|
+
messages: {
|
|
14
|
+
default: "Unsupported type, falling back to Any"
|
|
15
|
+
},
|
|
16
|
+
description: "This type is not supported by the Python emitter"
|
|
17
|
+
},
|
|
18
|
+
"python-unsupported-model-discriminator": {
|
|
19
|
+
severity: "error",
|
|
20
|
+
messages: {
|
|
21
|
+
default: "Unsupported model discriminator, falling back to not discriminating on serialization/deserialization"
|
|
22
|
+
},
|
|
23
|
+
description: "Discriminators at the model are not supported"
|
|
24
|
+
},
|
|
25
|
+
"python-unsupported-type-transform": {
|
|
26
|
+
severity: "error",
|
|
27
|
+
messages: {
|
|
28
|
+
default: "Unsupported type for transformation, falling back to not transforming this type"
|
|
29
|
+
},
|
|
30
|
+
description: "This type cannot be transformed"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
export const {
|
|
35
|
+
reportDiagnostic: reportPythonDiagnostic,
|
|
36
|
+
createDiagnostic: createPythonDiagnostic
|
|
37
|
+
} = $pythonLib;
|
|
38
|
+
//# sourceMappingURL=lib.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createTypeSpecLibrary","$pythonLib","name","diagnostics","severity","messages","default","description","reportDiagnostic","reportPythonDiagnostic","createDiagnostic","createPythonDiagnostic"],"sources":["../../../src/python/lib.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,qBAAqB,QAAQ,oBAAoB;AAE1D,OAAO,MAAMC,UAAU,GAAGD,qBAAqB,CAAC;EAC9CE,IAAI,EAAE,mBAAmB;EACzBC,WAAW,EAAE;IACX,2BAA2B,EAAE;MAC3BC,QAAQ,EAAE,SAAS;MACnBC,QAAQ,EAAE;QACRC,OAAO,EAAE;MACX;IACF,CAAC;IACD,yBAAyB,EAAE;MACzBF,QAAQ,EAAE,OAAO;MACjBC,QAAQ,EAAE;QACRC,OAAO,EAAE;MACX,CAAC;MACDC,WAAW,EAAE;IACf,CAAC;IACD,wCAAwC,EAAE;MACxCH,QAAQ,EAAE,OAAO;MACjBC,QAAQ,EAAE;QACRC,OAAO,EACL;MACJ,CAAC;MACDC,WAAW,EAAE;IACf,CAAC;IACD,mCAAmC,EAAE;MACnCH,QAAQ,EAAE,OAAO;MACjBC,QAAQ,EAAE;QACRC,OAAO,EAAE;MACX,CAAC;MACDC,WAAW,EAAE;IACf;EACF;AACF,CAAC,CAAC;AAEF,OAAO,MAAM;EACXC,gBAAgB,EAAEC,sBAAsB;EACxCC,gBAAgB,EAAEC;AACpB,CAAC,GAAGV,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Children } from "@alloy-js/core";
|
|
2
|
+
import type { Program } from "@typespec/compiler";
|
|
3
|
+
export declare const renderOptions: {
|
|
4
|
+
printWidth: number;
|
|
5
|
+
tabWidth: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function getOutput(program: Program, children: Children[]): Children;
|
|
8
|
+
//# sourceMappingURL=test-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../../src/python/test-utils.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGlD,eAAO,MAAM,aAAa;;;CAGzB,CAAC;AAEF,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAmB1E"}
|