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

[DPG] A property defined in TypeSpec as "MyExtensibleEnum | null" should be generated as nullable #3600

Closed
joseharriaga opened this issue Jul 17, 2023 · 0 comments · Fixed by #3373
Assignees
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. DPG needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Not-GA-Required

Comments

@joseharriaga
Copy link
Member

Using version 20230714.1.

We're seeing this in the OpenAI library. Consider the following example in TypeSpec:

enum MyExtensibleEnum{
  foo: "foo",
  bar: "bar",
}

model MyModel {
  myProperty: MyExtensibleEnum | null;
}

The code that is being generated for this model looks like this:

public partial class MyModel
{
    public MyExtensibleEnum MyProperty { get; }
}

And its deserialization code looks like this:

if (property.NameEquals("myProperty"u8))
{
    myProperty = new MyExtensibleEnum(property.Value.GetString());
    continue;
}

In other words, MyProperty is not nullable, as opposed to what is specified in the TypeSpec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. DPG needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Not-GA-Required
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants