-
Notifications
You must be signed in to change notification settings - Fork 219
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
refactor(http-client-csharp): dump deprecated description
properties
#5154
base: main
Are you sure you want to change the base?
refactor(http-client-csharp): dump deprecated description
properties
#5154
Conversation
- emitter: replace all `description` properties of input types with `summary` and `doc` - generator: - update json converters for the emitter schema change - only expose `Summary` and `Doc` properties if they are used by other classes - update test cases accordingly part of microsoft#4771
filter-out-core-models
optiondescription
properties
API change check APIView has identified API level changes in this PR and created following API reviews. |
private static readonly InputClient _animalClient = new("animal", "", "AnimalClient description", [], [], TestClientName); | ||
private static readonly InputClient _dogClient = new("dog", "", "DogClient description", [], [], _animalClient.Name); | ||
private static readonly InputClient _catClient = new("cat", "", "CatClient description", [], [], _animalClient.Name); | ||
private static readonly InputClient _hawkClient = new("hawkClient", "", "HawkClient description", [], [], _animalClient.Name); | ||
private static readonly InputClient _huskyClient = new("husky", "", "HuskyClient description", [], [], _dogClient.Name); |
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.
i think we should do string.Empty
instead of ""
.
Also should this be null
?
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.
I think it is never required to have summary or doc there these two properties should be nullable.
And there should be difference between when we have:
model Foo {}
and
@doc("")
model Foo {}
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.
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.
I think it is never required to have summary or doc there these two properties should be nullable. And there should be difference between when we have:
model Foo {}
and
@doc("") model Foo {}
Zero values are the same here. You don't want to generate an empty doc anyway. Also, we're not consistent in our code base. Some defines string?
and others define string
. I just follow what the current codes were written.
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 comment follows this one: #5154 (comment)
For example an input enum type is not required to have a doc or summary or description, therefore our definition here is wrong in the first place.
We define this in this way, because previously these are defined for azure purpose, and for azure libraries, types, properties are not allowed without documentation. But in unbranded libraries, there is no such rules.
Azure part should change accordingly if we change it here - assign default value when an output type is constructed.
: base(name) | ||
{ | ||
CrossLanguageDefinitionId = crossLanguageDefinitionId; | ||
Accessibility = accessibility; | ||
Deprecated = deprecated; | ||
Description = description; | ||
Description = string.IsNullOrEmpty(summary) ? (doc ?? string.Empty) : summary; |
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.
I think we should change this property to two new properties Summary
and Doc
The classes in input types should just be the C# version of those typescript interfaces.
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.
I see two different strategies regarding the input types between http-client-csharp
and autorest.csharp
:
- In
http-client-csharp
, we declare them asclass
. So, I keep the minimal interface here. - In
autorest.csharp
, we declare them asrecord
. So, I keep the interface like the original data schema as much as possible.
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.
record is a class, there is no differences.
Making this change might take quite a few efforts, this I admit.
But we should not be avoiding them - I have done multiple of those when consolidating the models part.
description
properties of input types withsummary
anddoc
Summary
andDoc
properties if they are used by other classespart of #4771