autorest icon indicating copy to clipboard operation
autorest copied to clipboard

Return values should be renameable

Open stankovski opened this issue 10 years ago • 3 comments

The naming of results is not so intuitive, e.g. list result becomes result.body.value which was result.StorageAccounts before. Allowing us to override value to be StorageAccounts (or any other value) would make this API a lot more clear.

Acceptance

APPROVED FOR CONSIDERATION AND DESIGN DEBATE

  • Add swagger extension for client parameter/property called 'x-ms-client-name' which controls the publicly presented name for the property
  • Support this extension in swagger generator for list types
  • When present, swagger modeler shoudl use the name from the extension, and copy the wire name
  • Add acceptance tests with renaming

stankovski avatar Jan 14 '16 23:01 stankovski

One more consideration to include here: enable override for more than list property names. We should be able to override the property name for any schema member. This would be similar in style/design to the json serialization markup in C#:

    [JsonValue("**assemblyClrName**")]
    [PropertyBinding]
    [Documentation("Gets or sets the name of the assembly.")]
    public string **Name** { get; set; }

The above shows that the json value for a property is "assemblyClrName" but the property name in generated code is just "Name"

begoldsm avatar Jan 14 '16 23:01 begoldsm

Here's a duplicate issue with even more scenarios where this would be useful: https://github.com/Azure/autorest/issues/316

bitsforthought avatar Jan 14 '16 23:01 bitsforthought

@brjohnstmsft thanks for linking this issue. I couldn't find it.

stankovski avatar Jan 14 '16 23:01 stankovski