Skip to content

Commit

Permalink
Update to latest cadl-ranch-specs and tcgc (#1326)
Browse files Browse the repository at this point in the history
Added tests for new APIs.
Removed TODO comment as the behavior is by design.
  • Loading branch information
jhendrixMSFT authored May 8, 2024
1 parent 8075a74 commit 3cfea82
Show file tree
Hide file tree
Showing 14 changed files with 420 additions and 29 deletions.
141 changes: 116 additions & 25 deletions common/config/rush/pnpm-lock.yaml

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

4 changes: 2 additions & 2 deletions packages/typespec-go/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"devDependencies": {
"@azure-tools/cadl-ranch": "~0.12.7",
"@azure-tools/cadl-ranch-expect": "~0.13.3",
"@azure-tools/cadl-ranch-specs": "0.33.1",
"@azure-tools/cadl-ranch-specs": "0.33.4",
"@azure-tools/typespec-autorest": "0.40.0",
"@azure-tools/typespec-azure-resource-manager": "0.40.0",
"@types/js-yaml": "~4.0.6",
Expand All @@ -66,7 +66,7 @@
"@azure-tools/codegen": "~2.9.2",
"@azure-tools/linq": "~3.1.0",
"@azure-tools/typespec-azure-core": ">=0.41.0 <1.0.0",
"@azure-tools/typespec-client-generator-core": "0.41.5",
"@azure-tools/typespec-client-generator-core": "0.42.0",
"@typespec/compiler": ">=0.55.0 <1.0.0",
"@typespec/http": ">=0.55.0 <1.0.0",
"@typespec/rest": ">=0.55.0 <1.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/typespec-go/src/tcgcadapter/clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ export class clientAdapter {
throw new Error('single-client cannot be enabled when there are multiple clients');
}
for (const sdkClient of sdkPackage.clients) {
// workaround for https://github.com/Azure/typespec-azure/issues/782
if (sdkClient.methods.length === 0) {
// skip generating empty clients
continue;
}
// end workaround

// start with instantiable clients and recursively work down
if (sdkClient.initialization.access === 'public') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ func TestHeaderClientDefault(t *testing.T) {
require.Zero(t, resp)
}

func TestHeaderClientFloat64Seconds(t *testing.T) {
client, err := durationgroup.NewDurationClient(nil)
require.NoError(t, err)
resp, err := client.NewDurationHeaderClient().Float64Seconds(context.Background(), 35.621, nil)
require.NoError(t, err)
require.Zero(t, resp)
}

func TestHeaderClientFloatSeconds(t *testing.T) {
client, err := durationgroup.NewDurationClient(nil)
require.NoError(t, err)
Expand Down Expand Up @@ -66,6 +74,17 @@ func TestPropertyClientDefault(t *testing.T) {
require.EqualValues(t, "P40D", *resp.Value)
}

func TestPropertyClientFloat64Seconds(t *testing.T) {
client, err := durationgroup.NewDurationClient(nil)
require.NoError(t, err)
resp, err := client.NewDurationPropertyClient().Float64Seconds(context.Background(), durationgroup.Float64SecondsDurationProperty{
Value: to.Ptr(35.621),
}, nil)
require.NoError(t, err)
require.NotNil(t, resp.Value)
require.EqualValues(t, float64(35.621), *resp.Value)
}

func TestPropertyClientFloatSeconds(t *testing.T) {
client, err := durationgroup.NewDurationClient(nil)
require.NoError(t, err)
Expand Down Expand Up @@ -124,6 +143,14 @@ func TestQueryClientDefault(t *testing.T) {
require.Zero(t, resp)
}

func TestQueryClientFloat64Seconds(t *testing.T) {
client, err := durationgroup.NewDurationClient(nil)
require.NoError(t, err)
resp, err := client.NewDurationQueryClient().Float64Seconds(context.Background(), 35.621, nil)
require.NoError(t, err)
require.Zero(t, resp)
}

func TestQueryClientFloatSeconds(t *testing.T) {
client, err := durationgroup.NewDurationClient(nil)
require.NoError(t, err)
Expand Down

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

Loading

0 comments on commit 3cfea82

Please sign in to comment.