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

Fail to set default value for non-required properties in generated code #2923

Open
xiangyan99 opened this issue Nov 15, 2024 · 0 comments
Open

Comments

@xiangyan99
Copy link
Member

E.g. I have tsp like:

model PatternTokenizer extends LexicalTokenizer {
/**

  • A regular expression pattern to match token separators. Default is an
  • expression that matches one or more non-word characters.
    */
    pattern?: string = "\W+";

/**

  • Regular expression flags.
    */
    flags?: RegexFlags;

/**

  • The zero-based ordinal of the matching group in the regular expression pattern
  • to extract into tokens. Use -1 if you want to use the entire pattern to split
  • the input into tokens, irrespective of matching groups. Default is -1.
    */
    group?: int32 = -1;

/**

  • A URI fragment specifying the type of tokenizer.
    */
    #suppress "@azure-tools/typespec-azure-core/casing-style" "Maintain compatibility with existing models."
    @odata.type: "#Microsoft.Azure.Search.PatternTokenizer";
    }

I expected in the generated code, we set default values for pattern, flags and group. But it does not.

https://github.com/Azure/azure-rest-api-specs/blob/b7ed8b7ef731ee89b71f4ca699a5280800f969d1/specification/search/Azure.Search/models-service.tsp#L7638

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant