Граф коммитов

310 Коммитов

Автор SHA1 Сообщение Дата
m-nash 87f210ce4b
Connect emitter to generator and use that path during generate.ps1 (#3320)
Fixes https://github.com/Azure/autorest.csharp/issues/4464

---------

Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
2024-05-10 22:20:10 +00:00
Dapeng Zhang 94deb0175c
fix(http-client-csharp): update the field and property declaration and add test cases for them (#3222)
Fixes https://github.com/Azure/autorest.csharp/issues/4327

`CodeWriterDeclaration` is useful, but it is not suitable to put inside
`FieldDeclaration` or `PropertyDeclaration`.

When writing the expressions for a type, we define the fields and
properties in one place, and may use them in other members, for example,
we might use the fields and properties in ctors, other fields, other
properties, or methods.

The `CodeWriterDeclaration` instance cannot be properly used unless it
has been "declared" somewhere first, but we cannot always guarantee that
when we are using this field, the field has been declared.

This is the first reason I would like to remove the usage of
`CodeWriterDeclaration` from these two types.

The second reason is: `CodeWriterDeclaration` is useful because the
`CodeWriter` tracks if there is already a declaration with the same
name, if so, it will append digits to the declaration so that in our
generated code, there would not be duplicated declared local variables.
This feature actually shows us that `CodeWriterDeclaration` should only
be used for local variable/parameter declaration to avoid name
collisions, and since it might rename the name, it is not suitable to
use to define a field or property, because we usually always want the
generated field/property to be exactly the name we give it.
2024-05-10 18:10:33 +00:00
m-nash 52377dda44
Run apiview checks in pr to detect public api changes (#3283)
Fixes https://github.com/microsoft/typespec/issues/3203
Fixes https://github.com/microsoft/typespec/issues/3207
2024-05-10 01:02:05 +00:00
Jorge Rangel 70348b336d
feat: enhance summary for binarydata props (#3289)
This PR enhances the description of model properties that are of type
`BinaryData`.
2024-05-09 18:07:44 +00:00
Dapeng Zhang eb8e34a5a9
fix(http-client-csharp): fix the int/float literals are generated as strings (#3248)
Fixes https://github.com/Azure/autorest.csharp/issues/4630

This PR also includes a refactor to remove the
constant/reference/ReferenceOrConstant class, because we now have
expressions and statements, we could fully express those concepts using
the expressions/statements therefore we do not need these pre-expression
era things.
2024-05-08 00:10:46 +00:00
Jorge Rangel d3a4454fa0
fix(http-client-csharp): remove setters for model properties collection types (#3233)
This PR fixes the case where setters were being generated for model
properties that were collection types. Model properties that are
collection types will no longer generated a setter unless they are
nullable.

---------

Co-authored-by: ShivangiReja <45216704+ShivangiReja@users.noreply.github.com>
Co-authored-by: Dapeng Zhang <ufo54153@gmail.com>
Co-authored-by: ShivangiReja <shivangi.reja@microsoft.com>
2024-04-29 05:51:42 +00:00
Jorge Rangel 559eb674b4
feat(http-client-csharp): add clienttypeprovider & method collection (#3226)
Migrated from
https://github.com/jorgerangel-msft/Microsoft.Generator.CSharp/pull/49.

This PR adds the client type provider and adds the initial type factory
method for CreateOperationMethods which constructs a collection of
CSharpMethod types for a given InputOperation. The implementation of
creating each of the methods for an input operation will be addressed in
follow up items.
2024-04-24 16:24:38 +00:00
ShivangiReja 4c63c99292
[Microsoft Generator CSharp] Generate properties for Model types (#3221)
Transferring this PR from
[jorgerangel-msft/Microsoft.Generator.CSharp](https://github.com/jorgerangel-msft/Microsoft.Generator.CSharp/pull/51)
to this repo.

This PR implements the `BuildProperties()` method within the
`ModelTypeProvider` class and generate properties for model types.

- Fixes: https://github.com/Azure/autorest.csharp/issues/4475
- Fixes: https://github.com/Azure/autorest.csharp/issues/4520

---------

Co-authored-by: ShivangiReja <shivangi.reja@microsoft.com>
2024-04-24 00:03:01 +00:00
m-nash e2adc0709b
Fix generate script (#3220)
Fixes https://github.com/microsoft/typespec/issues/3209
2024-04-23 23:25:25 +00:00
m-nash d2292f0280
Move generator over to microsoft/typespec (#3175)
Fixes https://github.com/microsoft/typespec/issues/3173
2024-04-22 22:36:24 +00:00