autorest icon indicating copy to clipboard operation
autorest copied to clipboard

Same Typed property if used at different places for and if it is not required at one model, the generated code has it as nullable everywhere else.

Open parvezah opened this issue 10 years ago • 4 comments

I have a scenario where JobStatus is used in two different classes/request/models.

In one model it is marked as required and on the other model it is not required. When i generate the code , both the properties having this Type in different Models are marked as nullable.

Upon further looking into the AutoRest code, i see that the MakeTypeNullable is making all the usages of that particular Type as nullable (because same ref type obj is used in all places when building the model?).

Anyone else noticed a similar issue?

parvezah avatar Jun 16 '16 15:06 parvezah

Yes indeed.

I'm working on a few related issues with nullability right now. I'm going to remove the mutability of the Type itself, and shift the responsibility of making nullable to the usage of it.

fearthecowboy avatar Jun 16 '16 15:06 fearthecowboy

Any idea by when can we expect this fix to be in place. We are planning to release our .net client by end of June.

parvezah avatar Jun 17 '16 08:06 parvezah

Well, the good news, is that I've finally go this working ... it took tearing the whole core apart but I see it correctly functioning now.

I can give you private bits to test with if you'd like...

fearthecowboy avatar Sep 28 '16 22:09 fearthecowboy

Fix promoted to master with the refactor.

fearthecowboy avatar Nov 08 '16 03:11 fearthecowboy