@azure-tools/typespec-ts 0.52.1 → 0.52.2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/typespec-ts",
|
|
3
|
-
"version": "0.52.
|
|
3
|
+
"version": "0.52.2",
|
|
4
4
|
"description": "An experimental TypeSpec emitter for TypeScript RLC",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"@typespec/spector": "0.1.0-alpha.25-dev.5",
|
|
23
23
|
"@typespec/spec-api": "0.1.0-alpha.14-dev.4",
|
|
24
24
|
"@typespec/tspd": "0.74.1",
|
|
25
|
-
"@azure-tools/azure-http-specs": "0.1.0-alpha.40-dev.
|
|
25
|
+
"@azure-tools/azure-http-specs": "0.1.0-alpha.40-dev.4",
|
|
26
26
|
"@azure-tools/typespec-autorest": "^0.67.0",
|
|
27
27
|
"@azure-tools/typespec-azure-core": "^0.67.0",
|
|
28
|
-
"@azure-tools/typespec-azure-resource-manager": "^0.67.
|
|
29
|
-
"@azure-tools/typespec-client-generator-core": "^0.67.
|
|
28
|
+
"@azure-tools/typespec-azure-resource-manager": "^0.67.1",
|
|
29
|
+
"@azure-tools/typespec-client-generator-core": "^0.67.2",
|
|
30
30
|
"@azure/abort-controller": "^2.1.2",
|
|
31
31
|
"@azure/core-auth": "^1.6.0",
|
|
32
32
|
"@azure/core-lro": "^3.1.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@azure-tools/typespec-azure-core": "^0.67.0",
|
|
67
|
-
"@azure-tools/typespec-client-generator-core": "^0.67.
|
|
67
|
+
"@azure-tools/typespec-client-generator-core": "^0.67.2",
|
|
68
68
|
"@typespec/compiler": "^1.11.0",
|
|
69
69
|
"@typespec/http": "^1.11.0",
|
|
70
70
|
"@typespec/rest": "^0.81.0",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@typespec/xml": "^0.81.0"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@azure-tools/rlc-common": "^0.52.
|
|
75
|
+
"@azure-tools/rlc-common": "^0.52.2",
|
|
76
76
|
"fast-xml-parser": "^4.5.0",
|
|
77
77
|
"fs-extra": "^11.1.0",
|
|
78
78
|
"lodash": "^4.17.21",
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
isReadOnly,
|
|
34
34
|
listAllServiceNamespaces
|
|
35
35
|
} from "@azure-tools/typespec-client-generator-core";
|
|
36
|
+
// import { isKey } from "@typespec/compiler";
|
|
36
37
|
import {
|
|
37
38
|
getExternalModel,
|
|
38
39
|
getModelExpression,
|
|
@@ -59,7 +60,7 @@ import {
|
|
|
59
60
|
import path from "path";
|
|
60
61
|
import { refkey } from "../framework/refkey.js";
|
|
61
62
|
import { useContext } from "../contextManager.js";
|
|
62
|
-
import { isMetadata, isOrExtendsHttpFile } from "@typespec/http";
|
|
63
|
+
import { isMetadata, isOrExtendsHttpFile, Visibility } from "@typespec/http";
|
|
63
64
|
import { isAzureCoreErrorType } from "../utils/modelUtils.js";
|
|
64
65
|
import { getHeaderClientOptions } from "./helpers/clientOptionHelpers.js";
|
|
65
66
|
import { isExtensibleEnum } from "./type-expressions/get-enum-expression.js";
|
|
@@ -736,7 +737,6 @@ function buildModelInterface(
|
|
|
736
737
|
// properties (@header, @query, @path) since they are deserialized separately.
|
|
737
738
|
// For input models, keep metadata properties — users need to pass them.
|
|
738
739
|
const hasInputUsage = (type.usage & UsageFlags.Input) === UsageFlags.Input;
|
|
739
|
-
const isArmResource = isArmResourceModel(type);
|
|
740
740
|
const interfaceStructure = {
|
|
741
741
|
kind: StructureKind.Interface,
|
|
742
742
|
name: normalizeModelName(context, type, NameType.Interface, true),
|
|
@@ -746,14 +746,13 @@ function buildModelInterface(
|
|
|
746
746
|
if (!hasInputUsage && p.__raw && isMetadata(context.program, p.__raw)) {
|
|
747
747
|
return false;
|
|
748
748
|
}
|
|
749
|
-
// Skip
|
|
750
|
-
//
|
|
751
|
-
// and is handled by the ARM infrastructure, not set by the user directly.
|
|
749
|
+
// Skip required metadata properties with Read visibility for ARM as they are not intended to be in the model
|
|
750
|
+
// These properties are not be generated no matter they are in input or output models in most cases in HLC
|
|
752
751
|
if (
|
|
753
|
-
|
|
754
|
-
p.name === "name" &&
|
|
752
|
+
context.arm &&
|
|
755
753
|
p.__raw &&
|
|
756
|
-
isMetadata(context.program, p.__raw)
|
|
754
|
+
isMetadata(context.program, p.__raw) &&
|
|
755
|
+
p.visibility?.includes(Visibility.Read)
|
|
757
756
|
) {
|
|
758
757
|
return false;
|
|
759
758
|
}
|
|
@@ -950,20 +949,6 @@ export function normalizeModelName(
|
|
|
950
949
|
return `${internalModelPrefix}${normalizeName(namespacePrefix + type.name, nameType, true)}${unionSuffix}`;
|
|
951
950
|
}
|
|
952
951
|
|
|
953
|
-
/**
|
|
954
|
-
* Checks if a model descends from the ARM common-types Resource base type
|
|
955
|
-
* (TrackedResource, ProxyResource, etc.) by walking the ancestor chain.
|
|
956
|
-
*/
|
|
957
|
-
function isArmResourceModel(type: SdkModelType): boolean {
|
|
958
|
-
const ancestors = getAllAncestors(type);
|
|
959
|
-
return ancestors.some(
|
|
960
|
-
(ancestor) =>
|
|
961
|
-
ancestor.kind === "model" &&
|
|
962
|
-
ancestor.crossLanguageDefinitionId ===
|
|
963
|
-
"Azure.ResourceManager.CommonTypes.Resource"
|
|
964
|
-
);
|
|
965
|
-
}
|
|
966
|
-
|
|
967
952
|
function buildModelPolymorphicType(context: SdkContext, type: SdkModelType) {
|
|
968
953
|
// Only include direct subtypes in this union
|
|
969
954
|
const directSubtypes = getDirectSubtypes(type);
|