Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binder models tcgc #2759

Open
wants to merge 95 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
10267e1
Generate models from TCGC and use binder
joheredi Aug 15, 2024
1d0e542
generic serializers
joheredi Aug 19, 2024
5522764
fix const and enum value expression
qiaozha Aug 29, 2024
ff42613
merge main and resolve conflicts
qiaozha Aug 29, 2024
fb5cc9f
merge main
qiaozha Sep 2, 2024
136a66b
fix paged result model name
qiaozha Sep 3, 2024
1205b52
Update packages/typespec-ts/src/modular/emit-models.ts
qiaozha Sep 3, 2024
e9446b3
remove old imports and refactor serializer util
qiaozha Sep 3, 2024
efe343b
fix serializer
qiaozha Sep 4, 2024
1f251c3
fix anomalydetector
qiaozha Sep 4, 2024
e8ffadb
fix readonly, enum docs missing, serializeRecord crash issues
qiaozha Sep 5, 2024
6a7e682
Update packages/typespec-ts/src/index.ts
qiaozha Sep 5, 2024
cb143cc
Merge branch 'main' into binder-models-tcgc
qiaozha Sep 5, 2024
be80522
fix extensible enum docs, knownvalue enum
qiaozha Sep 5, 2024
91e4e9e
fix known enum name
qiaozha Sep 5, 2024
c61258e
Merge branch 'main' into binder-models-tcgc
qiaozha Sep 5, 2024
92c5a25
use binder to resolve dependencies and reserve work
qiaozha Sep 5, 2024
5149443
Fix missing TokenCredential imports
joheredi Sep 5, 2024
53e235f
Fix client not found issue
joheredi Sep 5, 2024
a6384c7
fix client factory signature
qiaozha Sep 6, 2024
160aa9f
fix anonymous models and visitSdkPackage type
qiaozha Sep 7, 2024
39703d1
fix missing models and client parameters
qiaozha Sep 7, 2024
f15218b
add deserializer
qiaozha Sep 7, 2024
655e1d0
add serializer for enum and union
qiaozha Sep 7, 2024
bf9946c
do not export deserializer
qiaozha Sep 7, 2024
2da07d2
use operation template
qiaozha Sep 9, 2024
ce9bcd4
use sdkmethod to filter method level lifted parameters
qiaozha Sep 9, 2024
d2d6839
Merge branch 'main' into binder-models-tcgc
qiaozha Sep 10, 2024
207268f
fix endpoint template arguments fetching logic
qiaozha Sep 10, 2024
45cdf02
fix duplicate imports
qiaozha Sep 10, 2024
c203010
fix record serializer missing
qiaozha Sep 10, 2024
b1532c1
fix unused imports
qiaozha Sep 10, 2024
02abce0
update serializer and reserve work
qiaozha Sep 11, 2024
2b30bb3
fix body optional
qiaozha Sep 11, 2024
4d799fc
use tcgc name
qiaozha Sep 11, 2024
849dbae
fix model namespace name
qiaozha Sep 11, 2024
e673ece
smoke-test
qiaozha Sep 11, 2024
7794efc
fix extra quotes
qiaozha Sep 12, 2024
4c43a3a
fix serializer and deserializer missing
qiaozha Sep 12, 2024
2aac9f4
normalize clientOptional params
qiaozha Sep 12, 2024
4629802
add array serializer
qiaozha Sep 12, 2024
0f092a8
add array serializer
qiaozha Sep 12, 2024
1aac384
refactor operation helpers
qiaozha Sep 12, 2024
8a10a46
fix serialize value
qiaozha Sep 12, 2024
14e3118
fix smoke test
qiaozha Sep 13, 2024
aa62957
use binder for streamable and generate empty object as record of any
qiaozha Sep 13, 2024
5132824
fix docs missing
qiaozha Sep 13, 2024
cd3fe73
modular models for multi clients
qiaozha Sep 13, 2024
5fb0ae6
use modular client name as context name
qiaozha Sep 13, 2024
66dd336
move options into api folder
qiaozha Sep 13, 2024
3046174
fix docs missing
qiaozha Sep 13, 2024
9c8d698
fix unit test
qiaozha Sep 14, 2024
04f7ab5
fix some unit test and deserializer missing
qiaozha Sep 15, 2024
7022f13
refactor serializer in operationHelpers
qiaozha Sep 16, 2024
f4afc39
fix some ut and add alias description
qiaozha Sep 18, 2024
d1306cc
fix some ut description
qiaozha Sep 20, 2024
b804c19
fix duplicate union type generation
qiaozha Sep 20, 2024
2995eb7
merge main and resolve conflicts
qiaozha Sep 24, 2024
6f545ee
resolve conflicts and rerun smoke-test
qiaozha Sep 24, 2024
308e4e0
resolve emit unit test
qiaozha Sep 24, 2024
9130d15
fix some issues
qiaozha Sep 24, 2024
f3a06e2
skip tests because of clientDefaultValue
qiaozha Sep 24, 2024
206a35e
add todo
qiaozha Sep 25, 2024
1b8b0d6
fix client parameters and remove enum serializer and deserializer
qiaozha Sep 25, 2024
5593e27
resolve ut
qiaozha Sep 25, 2024
6ce248e
additional properties support and parameterized host issues
qiaozha Sep 25, 2024
23ad282
add notes for todo
qiaozha Sep 25, 2024
bdee238
Merge branch 'main' into binder-models-tcgc
qiaozha Sep 25, 2024
d0e1622
fix smoke test
qiaozha Sep 25, 2024
fa49888
filter models with usage
qiaozha Sep 26, 2024
57f1e66
fix test
qiaozha Sep 26, 2024
9de22a8
resolve cadl-ranch generation
qiaozha Sep 26, 2024
c6e37dc
fix cadl ranch
qiaozha Sep 26, 2024
1f6b05f
fix addcredential filter
qiaozha Sep 27, 2024
021aa8a
regen smoke test
qiaozha Sep 27, 2024
3efe347
fix additional properties and record ser/deserializer
qiaozha Sep 27, 2024
525a0f5
filter api version if it is not global
qiaozha Sep 29, 2024
79fe320
fix deserializer undefined prefix
qiaozha Sep 29, 2024
95e722f
fix binary payload and array ser/deser
qiaozha Sep 29, 2024
d4f15b7
fix array and discriminated union ser/deser
qiaozha Sep 29, 2024
d4efe9f
Merge branch 'main' into binder-models-tcgc
qiaozha Sep 29, 2024
2c98a3f
fix smoke test
qiaozha Sep 30, 2024
e5c54b6
fix cadl ranch regen
qiaozha Sep 30, 2024
3f6181e
fix smoke test
qiaozha Sep 30, 2024
a5c8ff2
improve ser/deser
qiaozha Sep 30, 2024
b6a60ee
fix ci
qiaozha Sep 30, 2024
3444ad7
add unit test
qiaozha Oct 8, 2024
286f8c9
add extensible enum case
qiaozha Oct 8, 2024
9a87639
add additional properties ser/deser unit test
qiaozha Oct 9, 2024
b21b83d
fix extensible enum inline generation
qiaozha Oct 9, 2024
6257aaf
fix ci
qiaozha Oct 9, 2024
27bcd94
Merge branch 'main' into binder-models-tcgc
qiaozha Oct 9, 2024
9fa085f
fix duplicate expression
qiaozha Oct 9, 2024
5ad149e
format change
qiaozha Oct 9, 2024
653a022
fix unit test
qiaozha Oct 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
}
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[powershell]": {
"editor.defaultFormatter": "ms-vscode.powershell"
},
"[javascript]": {
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
}
}
4 changes: 2 additions & 2 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions packages/rlc-common/src/helpers/nameConstructors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,10 @@ export function getImportModuleName(name: ModuleName, codeModel: RLCModel) {

export function getClientName(model: RLCModel) {
const clientName = model.libraryName;
let clientInterfaceName = clientName.endsWith("Client")
const clientInterfaceName = clientName.endsWith("Client")
? `${clientName}`
: `${clientName}Client`;

if (model.options?.isModularLibrary) {
clientInterfaceName = `${clientName.replace("Client", "")}Context`;
}

return clientInterfaceName;
}

Expand Down
1 change: 1 addition & 0 deletions packages/rlc-common/src/helpers/nameUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export const ReservedModelNames: ReservedName[] = [
{ name: "with", reservedFor: [NameType.Parameter] },
{ name: "yield", reservedFor: [NameType.Parameter] },
{ name: "arguments", reservedFor: [NameType.Parameter] },
{ name: "global", reservedFor: [...Newable] },
// reserve client for codegen
{ name: "client", reservedFor: [NameType.Parameter] },
{ name: "endpoint", reservedFor: [NameType.Parameter] },
Expand Down
8 changes: 1 addition & 7 deletions packages/rlc-common/src/metadata/buildReadmeFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { RLCModel } from "../interfaces.js";
import hbs from "handlebars";
import { NameType, normalizeName } from "../helpers/nameUtils.js";
import { isAzurePackage } from "../helpers/packageUtil.js";
import { getClientName } from "../helpers/nameConstructors.js";

const azureReadmeRLCTemplate = `# {{ clientDescriptiveName }} library for JavaScript

Expand Down Expand Up @@ -430,10 +431,3 @@ function getServiceName(model: RLCModel) {
: `Azure ${simpleServiceName}`
: simpleServiceName;
}

function getClientName(model: RLCModel) {
const clientName = model.libraryName;
return clientName.endsWith("Client")
? `${clientName}`
: `${clientName}Client`;
}
7 changes: 5 additions & 2 deletions packages/typespec-test/eng/smoke-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@ async function generate(path, logger) {

// Clean up the folder before generation
if (await exists(join(path, "generated", "typespec-ts"))) {
const pathToRemove = join(path, "generated", "typespec-ts");
await rm(pathToRemove, { recursive: true, force: true });
fstat.readdirSync(join(path, "generated", "typespec-ts")).forEach((file) => {
if(file !== "node_modules") {
rm(join(path, "generated", "typespec-ts", file), { recursive: true, force: true });
}
});
}
} catch (e) {
// do nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
```ts

import { AbortSignalLike } from '@azure/abort-controller';
import { Client } from '@azure-rest/core-client';
import { ClientOptions } from '@azure-rest/core-client';
import { OperationOptions } from '@azure-rest/core-client';
import { OperationState } from '@azure/core-lro';
Expand Down Expand Up @@ -61,6 +62,9 @@ export type ControlState = string;
// @public
export type CreatedByType = string;

// @public (undocumented)
export function createNetworkAnalytics(credential: TokenCredential, options?: NetworkAnalyticsClientOptionalParams): NetworkAnalyticsContext;

// @public
export interface DataProduct extends TrackedResource {
identity?: ManagedServiceIdentityV4;
Expand Down Expand Up @@ -300,6 +304,10 @@ export interface DataTypeUpdateProperties {
// @public
export type DefaultAction = string;

// @public
export interface DeleteDataRequest {
qiaozha marked this conversation as resolved.
Show resolved Hide resolved
}

// @public
export interface EncryptionKeyDetails {
keyName: string;
Expand All @@ -313,6 +321,10 @@ export interface ErrorAdditionalInfo {
readonly type?: string;
}

// @public
export interface ErrorAdditionalInfoInfo {
}

// @public
export interface ErrorDetail {
readonly additionalInfo?: ErrorAdditionalInfo[];
Expand Down Expand Up @@ -407,6 +419,10 @@ export interface ListRoleAssignments {
roleAssignmentResponse: RoleAssignmentDetail[];
}

// @public
export interface ListRolesAssignmentsRequest {
}

// @public
export interface ManagedResourceGroupConfiguration {
location: string;
Expand Down Expand Up @@ -439,6 +455,10 @@ export interface NetworkAnalyticsClientOptionalParams extends ClientOptions {
apiVersion?: string;
}

// @public (undocumented)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs missing.

export interface NetworkAnalyticsContext extends Client {
}

// @public
export interface Operation {
actionType?: ActionType;
Expand Down Expand Up @@ -554,9 +574,6 @@ export interface UserAssignedIdentity {
readonly principalId?: string;
}

// @public
export type Versions = "2023-11-15";

// @public
export interface VirtualNetworkRule {
action?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
// Licensed under the MIT License.

import { NetworkAnalyticsClient } from "@azure/arm-networkanalytics";
import {
_DataProductListResult,
_dataProductListResultDeserializer,
_DataTypeListResult,
_dataTypeListResultDeserializer,
_DataProductsCatalogListResult,
_dataProductsCatalogListResultDeserializer,
_OperationListResult,
_operationListResultDeserializer,
} from "../src/models/models.js";
import { DefaultAzureCredential } from "@azure/identity";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
// Licensed under the MIT License.

import { NetworkAnalyticsClient } from "@azure/arm-networkanalytics";
import {
_DataProductListResult,
_dataProductListResultDeserializer,
_DataTypeListResult,
_dataTypeListResultDeserializer,
_DataProductsCatalogListResult,
_dataProductsCatalogListResultDeserializer,
_OperationListResult,
_operationListResultDeserializer,
} from "../src/models/models.js";
import { DefaultAzureCredential } from "@azure/identity";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
// Licensed under the MIT License.

import { NetworkAnalyticsClient } from "@azure/arm-networkanalytics";
import {
_DataProductListResult,
_dataProductListResultDeserializer,
_DataTypeListResult,
_dataTypeListResultDeserializer,
_DataProductsCatalogListResult,
_dataProductsCatalogListResultDeserializer,
_OperationListResult,
_operationListResultDeserializer,
} from "../src/models/models.js";
import { DefaultAzureCredential } from "@azure/identity";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
// Licensed under the MIT License.

import { NetworkAnalyticsClient } from "@azure/arm-networkanalytics";
import {
_DataProductListResult,
_dataProductListResultDeserializer,
_DataTypeListResult,
_dataTypeListResultDeserializer,
_DataProductsCatalogListResult,
_dataProductsCatalogListResultDeserializer,
_OperationListResult,
_operationListResultDeserializer,
} from "../src/models/models.js";
import { DefaultAzureCredential } from "@azure/identity";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
// Licensed under the MIT License.

import { NetworkAnalyticsClient } from "@azure/arm-networkanalytics";
import {
_DataProductListResult,
_dataProductListResultDeserializer,
_DataTypeListResult,
_dataTypeListResultDeserializer,
_DataProductsCatalogListResult,
_dataProductsCatalogListResultDeserializer,
_OperationListResult,
_operationListResultDeserializer,
} from "../src/models/models.js";
import { DefaultAzureCredential } from "@azure/identity";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
// Licensed under the MIT License.

import { NetworkAnalyticsClient } from "@azure/arm-networkanalytics";
import {
_DataProductListResult,
_dataProductListResultDeserializer,
_DataTypeListResult,
_dataTypeListResultDeserializer,
_DataProductsCatalogListResult,
_dataProductsCatalogListResultDeserializer,
_OperationListResult,
_operationListResultDeserializer,
} from "../src/models/models.js";
import { DefaultAzureCredential } from "@azure/identity";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
// Licensed under the MIT License.

import { NetworkAnalyticsClient } from "@azure/arm-networkanalytics";
import {
_DataProductListResult,
_dataProductListResultDeserializer,
_DataTypeListResult,
_dataTypeListResultDeserializer,
_DataProductsCatalogListResult,
_dataProductsCatalogListResultDeserializer,
_OperationListResult,
_operationListResultDeserializer,
} from "../src/models/models.js";
import { DefaultAzureCredential } from "@azure/identity";

/**
Expand Down
Loading
Loading