autorest icon indicating copy to clipboard operation
autorest copied to clipboard

Default doesn't do anything

Open emgerner-msft opened this issue 10 years ago • 4 comments

I'm trying to set an enum to a default. I create the enum per the spec below. I've tried requiring and not requiring, but neither uses the default. Generating with and without the default seems to make difference at all.

"kind": {
  "type": "string",
  "default":  "Xyz",
  "enum": [
    "Xyz",
    "Abc"
  ],
  "x-ms-enum": {
    "name": "Kind",
    "modelAsString": false
  }
}

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

@emgerner-msft - Is this for parameter or model types? I think currently C# does not support defaults for Model Types. If this was a parameter in C# it should have worked. node.js supports defaults for models and parameters.

amarzavery avatar Mar 25 '16 00:03 amarzavery

This is for a parameter. I can send the full spec to you privately to test if desired.

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

Sure. That would be great. Let me know the parameter and operationId to look for. Shall take a look.

amarzavery avatar Mar 25 '16 00:03 amarzavery

Duplicate: https://github.com/Azure/autorest/issues/781

amarzavery avatar Mar 25 '16 01:03 amarzavery