Skip to content

Conversation

@baywet
Copy link
Member

@baywet baywet commented Jan 28, 2022

fixes #164

@baywet baywet added this to the 1.0.10 milestone Jan 28, 2022
@baywet baywet self-assigned this Jan 28, 2022
@baywet baywet marked this pull request as ready for review January 31, 2022 16:50
@baywet baywet enabled auto-merge January 31, 2022 16:53
/// <summary>
/// Name of the extension as used in the description.
/// </summary>
public string Name => "x-ms-enum";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static or static readonly since it's constant?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this property is required by the interface, and this syntax makes it readonly.

/// <summary>
/// Descriptions for the enum symbols, where the value MUST match the enum symbols in the main description
/// </summary>
public List<EnumDescription> ValuesDescriptions { get; set; } = new();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't need the "set" for the collection since you have new(), right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the set is here so people can assign the whole collection (used in unit tests)

"Microsoft.OData.Service.Sample.TrippinInMemory.Models.PersonGender": {
"title": "PersonGender",
"description": "Gender of the person.",
"enum": [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we extend the item in the array to be a complex object, which has the "name" and description?

In this case, we don't need to add an extension to repeat the name or value for enum member?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here I'm just implementing this spec so people also get compatibility with auto rest should they be using it afterwards https://github.com/Azure/autorest/blob/main/docs/extensions/readme.md#x-ms-enum

@xuzhg
Copy link
Contributor

xuzhg commented Jan 31, 2022

leave comments, others look good to me.

@baywet baywet requested a review from xuzhg January 31, 2022 19:15
@xuzhg
Copy link
Contributor

xuzhg commented Jan 31, 2022

:shipit:

@baywet baywet merged commit dbcf686 into master Jan 31, 2022
@baywet baywet deleted the feature/enum-description branch January 31, 2022 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for enum descriptions

3 participants