Skip to content

Add a lint if the clientDefaultValue type doesn't match the actual property type #3934

@JialinHuang803

Description

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

using TypeSpec.Http;

@service(#{ title: "Pet Store Service" })
namespace PetStoreNamespace;

interface PetStore {
  /**
   * Get a list of pets
   */
  list(
    @Azure.ClientGenerator.Core.Legacy.clientDefaultValue("10")
    @query
    pageSize?: int32,

    @Azure.ClientGenerator.Core.Legacy.clientDefaultValue(123)
    @query
    sortOrder?: string,
  ): string[];
}

In the example above, the type of the value inside @clientDefaultValue doesn't match the actual parameter type. Should we add an error from compiler or tcgc?

Metadata

Metadata

Assignees

No one assigned

    Labels

    lib:tcgcIssues for @azure-tools/typespec-client-generator-core library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions