Skip to content

[Bug]: Playground goes blank when choosing TCGC output #6752

@anuchandy

Description

@anuchandy

Describe the bug

The following spec in playground outputs in openapi3 format but the playground crashes when choosing TCGC output

import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-client-generator-core";
import "@typespec/http";
import "@typespec/rest";

using global.Azure.Core.Foundations;
using Azure.ClientGenerator.Core;
using TypeSpec.Http;
using TypeSpec.Versioning;

@service(#{ title: "Contoso" })
namespace Contoso {

  model GetUserOptions {
    @query userid?: string;
    @query zipcode?: string;
  }

  model User {
    name: string;
    age: int16;
  }

  @get
  @route("/get-user")
  op getUser(p: GetUserOptions) : User;

}

namespace Customization {
  op getUserCustomization(
    options?: Contoso.GetUserOptions,
  ): void;
  @@override(Contoso.getUser, Customization.getUserCustomization);
}

but if I slightly change the spec to the following, the TCGC output appears

import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-client-generator-core";
import "@typespec/http";
import "@typespec/rest";
import "@typespec/versioning";

using global.Azure.Core.Foundations;
using Azure.ClientGenerator.Core;
using TypeSpec.Http;
using TypeSpec.Versioning;

@service(#{ title: "Contoso" })
@versioned(Versions)
namespace Contoso {
  enum Versions {
    @useDependency(global.Azure.Core.Versions.v1_0_Preview_2)
    v2022_12_01_preview: "2022-12-01-preview",
  }

  model Options {
    @query userid?: string;
    @query zipcode?: string;
  }

  model User {
    name: string;
    age: uint16;
  }

  @get
  @route("/get-user")
  op getUser is global.Azure.Core.RpcOperation<Options, User>;
}

namespace Customization {
  op getUserCustomization(
    options?: Contoso.Options,
    ...ApiVersionParameter,
  ): void;
  @@override(Contoso.getUser, Customization.getUserCustomization);
}

Reproduction

Here is the link to the failing playground, go to the link and change output to TCGC

Checklist

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions