-
Notifications
You must be signed in to change notification settings - Fork 64
adds support for enum descriptions #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
src/Microsoft.OpenApi.OData.Reader/OpenApiExtensions/OpenApiEnumValuesDescriptionExtension.cs
Show resolved
Hide resolved
| /// <summary> | ||
| /// Name of the extension as used in the description. | ||
| /// </summary> | ||
| public string Name => "x-ms-enum"; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
...t.OpenAPI.OData.Reader.Tests/OpenApiExtensions/OpenApiEnumValuesDescriptionExtensionTexts.cs
Show resolved
Hide resolved
| "Microsoft.OData.Service.Sample.TrippinInMemory.Models.PersonGender": { | ||
| "title": "PersonGender", | ||
| "description": "Gender of the person.", | ||
| "enum": [ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
|
leave comments, others look good to me. |
Signed-off-by: Vincent Biret <[email protected]>
|
|
fixes #164