Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions packages/typespec-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
"type": "module",
"dependencies": {
"@azure-tools/typespec-ts": "workspace:^0.50.4",
"@typespec/openapi": "^1.9.0",
"@azure-tools/typespec-autorest": "^0.65.0",
"@typespec/openapi3": "^1.9.0",
"@azure-tools/typespec-azure-core": "^0.65.0",
"@azure-tools/typespec-client-generator-core": "^0.65.4",
"@azure-tools/typespec-azure-resource-manager": "^0.65.0",
"@azure-tools/typespec-azure-rulesets": "^0.65.0",
"@typespec/compiler": "^1.9.0",
"@typespec/http": "^1.9.0",
"@typespec/rest": "^0.79.0",
"@typespec/versioning": "^0.79.0",
"@typespec/json-schema": "^1.9.0",
"@typespec/openapi": "^1.10.0",
"@azure-tools/typespec-autorest": "^0.66.0",
"@typespec/openapi3": "^1.10.0",
"@azure-tools/typespec-azure-core": "^0.66.0",
"@azure-tools/typespec-client-generator-core": "^0.66.2",
"@azure-tools/typespec-azure-resource-manager": "^0.66.0",
"@azure-tools/typespec-azure-rulesets": "^0.66.0",
"@typespec/compiler": "^1.10.0",
"@typespec/http": "^1.10.0",
"@typespec/rest": "^0.80.0",
"@typespec/versioning": "^0.80.0",
"@typespec/json-schema": "^1.10.0",
"prettier": "^3.1.0"
},
"devDependencies": {
Expand Down
42 changes: 21 additions & 21 deletions packages/typespec-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@
"license": "MIT",
"devDependencies": {
"@azure-rest/core-client": "^2.3.1",
"@typespec/http-specs": "0.1.0-alpha.33-dev.3",
"@typespec/spector": "0.1.0-alpha.24-dev.2",
"@typespec/spec-api": "0.1.0-dev.0",
"@typespec/tspd": "0.74.0",
"@azure-tools/azure-http-specs": "0.1.0-alpha.38-dev.6",
"@azure-tools/typespec-autorest": "^0.65.0",
"@azure-tools/typespec-azure-core": "^0.65.0",
"@azure-tools/typespec-azure-resource-manager": "^0.65.0",
"@azure-tools/typespec-client-generator-core": "^0.65.4",
"@typespec/http-specs": "0.1.0-alpha.35-dev.1",
"@typespec/spector": "0.1.0-dev.0",
"@typespec/spec-api": "0.1.0-alpha.14-dev.1",
"@typespec/tspd": "0.74.1",
"@azure-tools/azure-http-specs": "0.1.0-alpha.39-dev.2",
"@azure-tools/typespec-autorest": "^0.66.0",
"@azure-tools/typespec-azure-core": "^0.66.0",
"@azure-tools/typespec-azure-resource-manager": "^0.66.0",
"@azure-tools/typespec-client-generator-core": "^0.66.2",
"@azure/abort-controller": "^2.1.2",
"@azure/core-auth": "^1.6.0",
"@azure/core-lro": "^3.1.0",
Expand All @@ -87,12 +87,12 @@
"@types/mocha": "^10.0.6",
"@typescript-eslint/eslint-plugin": "^8.28.0",
"@typescript-eslint/parser": "^8.28.0",
"@typespec/compiler": "^1.9.0",
"@typespec/http": "^1.9.0",
"@typespec/openapi": "^1.9.0",
"@typespec/rest": "^0.79.0",
"@typespec/compiler": "^1.10.0",
"@typespec/http": "^1.10.0",
"@typespec/openapi": "^1.10.0",
"@typespec/rest": "^0.80.0",
"@typespec/ts-http-runtime": "^0.1.0",
"@typespec/versioning": "^0.79.0",
"@typespec/versioning": "^0.80.0",
"chai": "^4.3.6",
"chalk": "^4.0.0",
"cross-env": "^7.0.3",
Expand All @@ -111,13 +111,13 @@
"js-yaml": "^4.1.0"
},
"peerDependencies": {
"@azure-tools/typespec-azure-core": "^0.65.0",
"@azure-tools/typespec-client-generator-core": "^0.65.4",
"@typespec/compiler": "^1.9.0",
"@typespec/http": "^1.9.0",
"@typespec/rest": "^0.79.0",
"@typespec/versioning": "^0.79.0",
"@typespec/xml": "^0.79.0"
"@azure-tools/typespec-azure-core": "^0.66.0",
"@azure-tools/typespec-client-generator-core": "^0.66.2",
"@typespec/compiler": "^1.10.0",
"@typespec/http": "^1.10.0",
"@typespec/rest": "^0.80.0",
"@typespec/versioning": "^0.80.0",
"@typespec/xml": "^0.80.0"
},
"dependencies": {
"@azure-tools/rlc-common": "workspace:^0.50.4",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Client } from '@azure-rest/core-client';
import type { ClientOptions } from '@azure-rest/core-client';
import type { HttpResponse } from '@azure-rest/core-client';
import type { RawHttpHeaders } from '@azure/core-rest-pipeline';
import type { RequestParameters } from '@azure-rest/core-client';
import type { StreamableMethod } from '@azure-rest/core-client';

Expand Down Expand Up @@ -80,6 +81,34 @@ export declare interface Exec {
name: string;
}

export declare type ExtensibleString = string;

export declare type ExtensibleStringOutput = string;

export declare interface ExtensibleStringsPutExtensibleStringValue {
put(options: ExtensibleStringsPutExtensibleStringValueParameters): StreamableMethod<ExtensibleStringsPutExtensibleStringValue200Response>;
}

export declare interface ExtensibleStringsPutExtensibleStringValue200Headers {
"content-type": "application/json";
}

export declare interface ExtensibleStringsPutExtensibleStringValue200Response extends HttpResponse {
status: "200";
body: ExtensibleStringOutput;
headers: RawHttpHeaders & ExtensibleStringsPutExtensibleStringValue200Headers;
}

export declare interface ExtensibleStringsPutExtensibleStringValueBodyParam {
body: ExtensibleString;
}

export declare interface ExtensibleStringsPutExtensibleStringValueMediaTypesParam {
contentType: "application/json";
}

export declare type ExtensibleStringsPutExtensibleStringValueParameters = ExtensibleStringsPutExtensibleStringValueMediaTypesParam & ExtensibleStringsPutExtensibleStringValueBodyParam & RequestParameters;

export declare interface Finally {
name: string;
}
Expand Down Expand Up @@ -1623,6 +1652,7 @@ export declare interface Routes {
(path: "/special-words/model-properties/same-as-model"): ModelPropertiesSameAsModel;
(path: "/special-words/model-properties/dict-methods"): ModelPropertiesDictMethods;
(path: "/special-words/model-properties/list"): ModelPropertiesWithList;
(path: "/special-words/extensible-strings/string"): ExtensibleStringsPutExtensibleStringValue;
(path: "/special-words/operations/and"): OperationsAnd;
(path: "/special-words/operations/as"): OperationsAs;
(path: "/special-words/operations/assert"): OperationsAssert;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,75 +6,61 @@ describe("NameAndEncodedName Client", () => {
beforeEach(() => {
client = new NamingClient({
endpoint: "http://localhost:3002",
allowInsecureConnection: true,
retryOptions: {
maxRetries: 0
}
allowInsecureConnection: true
});
});

it("should work with property client", async () => {
const result = await client.client({ clientName: true });
assert.isUndefined(result);
await client.property.client({ clientName: true });
});

it("should work with property language", async () => {
const result = await client.language({ tsName: true });
assert.isUndefined(result);
await client.property.language({ tsName: true });
});

it("should work with property compatibleWithEncodedName", async () => {
const result = await client.compatibleWithEncodedName({
await client.property.compatibleWithEncodedName({
clientName: true
});
assert.isUndefined(result);
});

it("should work with operation", async () => {
const result = await client.clientName();
assert.isUndefined(result);
await client.clientName();
});

it("should work with parameter", async () => {
const result = await client.parameter("true");
assert.isUndefined(result);
await client.parameter("true");
});

it("should work with header request", async () => {
const result = await client.request("true");
assert.isUndefined(result);
await client.header.request("true");
});

it("should work with header response", async () => {
const result = await client.response({
await client.header.response({
onResponse: function (res) {
assert.strictEqual(res.headers.get("default-name"), "true");
}
});
assert.isUndefined(result);
});

it("should work with model client", async () => {
const result = await client.modelClient.client({ defaultName: true });
assert.isUndefined(result);
await client.modelClient.client({ defaultName: true });
});

it("should work with model language", async () => {
const result = await client.modelClient.language({ defaultName: true });
assert.isUndefined(result);
await client.modelClient.language({ defaultName: true });
});

it("should work union enum name", async () => {
const result = await client.unionEnum.unionEnumName("value1", {
await client.unionEnum.unionEnumName("value1", {
requestOptions: { headers: { "content-type": "text/plain" } }
});
assert.isUndefined(result);
});

it("should work with union enum member name", async () => {
const result = await client.unionEnum.unionEnumMemberName("value1", {
await client.unionEnum.unionEnumMemberName("value1", {
requestOptions: { headers: { "content-type": "text/plain" } }
});
assert.isUndefined(result);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ describe("Client Structure Operation Group Rest Client", () => {
});

it("should call operation two correctly", async () => {
const result = await client1.group3.two();
const result = await client1.two();
assert.strictEqual(result, undefined);
});

it("should call operation three correctly", async () => {
const result = await client1.group3.three();
const result = await client1.three();
assert.strictEqual(result, undefined);
});

it("should call operation four correctly", async () => {
const result = await client1.group4.four();
const result = await client1.four();
assert.strictEqual(result, undefined);
});

Expand All @@ -50,7 +50,7 @@ describe("Client Structure Operation Group Rest Client", () => {
});

it("should call operation six correctly", async () => {
const result = await client2.group5.six();
const result = await client2.six();
assert.strictEqual(result, undefined);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("Client Structure Renamed-Operation Rest Client", () => {
});

it("should call operation two correctly", async () => {
const result = await client.group.renamedTwo();
const result = await client.renamedTwo();
assert.strictEqual(result, undefined);
});

Expand All @@ -29,7 +29,7 @@ describe("Client Structure Renamed-Operation Rest Client", () => {
});

it("should call operation four correctly", async () => {
const result = await client.group.renamedFour();
const result = await client.renamedFour();
assert.strictEqual(result, undefined);
});

Expand All @@ -39,7 +39,7 @@ describe("Client Structure Renamed-Operation Rest Client", () => {
});

it("should call operation six correctly", async () => {
const result = await client.group.renamedSix();
const result = await client.renamedSix();
assert.strictEqual(result, undefined);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,32 @@ describe("Client Structure Two-Operation-Group Rest Client", () => {
});

it("should call operation one correctly", async () => {
const result = await client.group1.one();
const result = await client.one();
assert.strictEqual(result, undefined);
});

it("should call operation two correctly", async () => {
const result = await client.group2.two();
const result = await client.two();
assert.strictEqual(result, undefined);
});

it("should call operation three correctly", async () => {
const result = await client.group1.three();
const result = await client.three();
assert.strictEqual(result, undefined);
});

it("should call operation four correctly", async () => {
const result = await client.group1.four();
const result = await client.four();
assert.strictEqual(result, undefined);
});

it("should call operation five correctly", async () => {
const result = await client.group2.five();
const result = await client.five();
assert.strictEqual(result, undefined);
});

it("should call operation six correctly", async () => {
const result = await client.group2.six();
const result = await client.six();
assert.strictEqual(result, undefined);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,23 @@ export declare interface ClientNameModel {
export declare interface ClientNameOptionalParams extends OperationOptions {
}

export declare interface ClientOptionalParams extends OperationOptions {
export declare type ExtensibleEnum = "value1" | "value2";

export declare interface HeaderOperations {
response: (options?: HeaderResponseOptionalParams) => Promise<void>;
request: (clientName: string, options?: HeaderRequestOptionalParams) => Promise<void>;
}

export declare interface CompatibleWithEncodedNameOptionalParams extends OperationOptions {
export declare interface HeaderRequestOptionalParams extends OperationOptions {
}

export declare type ExtensibleEnum = "value1" | "value2";
export declare interface HeaderResponseOptionalParams extends OperationOptions {
}

export declare interface LanguageClientNameModel {
tsName: boolean;
}

export declare interface LanguageOptionalParams extends OperationOptions {
}

export declare interface ModelClientClientOptionalParams extends OperationOptions {
}

Expand All @@ -49,15 +51,12 @@ export declare class NamingClient {
private _client;
readonly pipeline: Pipeline;
constructor(options?: NamingClientOptionalParams);
response(options?: ResponseOptionalParams): Promise<void>;
request(clientName: string, options?: RequestOptionalParams): Promise<void>;
compatibleWithEncodedName(body: ClientNameAndJsonEncodedNameModel, options?: CompatibleWithEncodedNameOptionalParams): Promise<void>;
language(body: LanguageClientNameModel, options?: LanguageOptionalParams): Promise<void>;
client(body: ClientNameModel, options?: ClientOptionalParams): Promise<void>;
parameter(clientName: string, options?: ParameterOptionalParams): Promise<void>;
clientName(options?: ClientNameOptionalParams): Promise<void>;
readonly unionEnum: UnionEnumOperations;
readonly modelClient: ModelClientOperations;
readonly header: HeaderOperations;
readonly property: PropertyOperations;
}

export declare interface NamingClientOptionalParams extends ClientOptions {
Expand All @@ -66,10 +65,19 @@ export declare interface NamingClientOptionalParams extends ClientOptions {
export declare interface ParameterOptionalParams extends OperationOptions {
}

export declare interface RequestOptionalParams extends OperationOptions {
export declare interface PropertyClientOptionalParams extends OperationOptions {
}

export declare interface PropertyCompatibleWithEncodedNameOptionalParams extends OperationOptions {
}

export declare interface PropertyLanguageOptionalParams extends OperationOptions {
}

export declare interface ResponseOptionalParams extends OperationOptions {
export declare interface PropertyOperations {
compatibleWithEncodedName: (body: ClientNameAndJsonEncodedNameModel, options?: PropertyCompatibleWithEncodedNameOptionalParams) => Promise<void>;
language: (body: LanguageClientNameModel, options?: PropertyLanguageOptionalParams) => Promise<void>;
client: (body: ClientNameModel, options?: PropertyClientOptionalParams) => Promise<void>;
}

export declare interface TSModel {
Expand Down
Loading
Loading