autorest icon indicating copy to clipboard operation
autorest copied to clipboard

Support default value in C# models

Open stankovski opened this issue 10 years ago • 7 comments

Currently default value is only honored in method arguments. Need to add support to models.

stankovski avatar Mar 02 '16 23:03 stankovski

+1 for this feature.

emgerner-msft avatar Mar 25 '16 16:03 emgerner-msft

Howdy!

In our planning for driving towards a stable '1.0' release, I'm marking this issue as 'deferred' :zzz: and we're going to review it during the post-1.0 planning cycle.

It's not to say that we're not going to work on it, or that this isn't not important, but at the moment, we're picking and choosing the stuff we must do before 1.0. :horse_racing: :horse_racing: :horse_racing:

We'll make sure we pick this back up at that point. :tada:

fearthecowboy avatar Jun 15 '16 17:06 fearthecowboy

Hmmm. I think this may need to be included in 1.0.

fearthecowboy avatar Jun 17 '16 20:06 fearthecowboy

If you add this ability, will it be opt-out?

The reason I ask is that for default values, it doesn't really make sense to set them on the client, since the REST API should provide them. The types themselves are nullable (because only optional properties can have default values), so leaving them out of the request payload saves bandwidth.

What I'd find more useful is if AutoRest appended something to the description of the property that describes what the default value is.

bitsforthought avatar Jun 17 '16 21:06 bitsforthought

I imagine it will have to be something you actively want turned on.

I do have to think about this one just a bit more before I actually reactivate this bug for 1.0.

Adding it to the description in any event would be a good idea.

fearthecowboy avatar Jun 17 '16 21:06 fearthecowboy

@fearthecowboy Do we consider this fixed as of #2190?

olydis avatar May 09 '17 16:05 olydis

Will close due to https://github.com/Azure/autorest/pull/2190. I think this solution will do until generator wave 2.0.

olydis avatar Jun 15 '17 00:06 olydis