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

304 Коммитов

Автор SHA1 Сообщение Дата
Jorge Rangel aa531cfafc
[http-client-csharp] fix: generate deserialization switch for nested discriminators (#4982)
fixes: https://github.com/microsoft/typespec/issues/4979
2024-11-06 17:54:57 +00:00
Crystal YU 9c51f13aea
Don't propagate client parameters to operation (#4295)
Fix https://github.com/microsoft/typespec/issues/4161

We will not propagate client parameters to each operation of this
client.

- remove client parameters from Operation.Parameters
2024-11-05 02:22:08 +00:00
Jorge Rangel 49c05272f3
[http-client-csharp] Remove incorrect casting for unknown discriminated subtype models (#4963)
fixes: https://github.com/microsoft/typespec/issues/4958
2024-11-04 23:30:18 +00:00
Jorge Rangel 597d794088
[http-client-csharp] fix: use correct discriminator prop name during deserialization (#4953)
fixes : https://github.com/microsoft/typespec/issues/4949
2024-11-01 22:46:35 +00:00
Jorge Rangel b7d351b35e
[http-client-csharp] fix: gen. unknown discriminator model when discriminator prop exists (#4936)
fixes: https://github.com/microsoft/typespec/issues/4935
2024-11-01 20:11:07 +00:00
JoshLove-msft a244ac87f4
Use customized enum name for discriminators (#4947)
Fixes https://github.com/microsoft/typespec/issues/4948
2024-11-01 19:25:16 +00:00
Nisha Bhatia 79f88702b4
Add cadl-ranch structure default sln (#4924)
Fixes: https://github.com/microsoft/typespec/issues/3967
2024-11-01 01:56:50 +00:00
JoshLove-msft 40c89073fc
Fix check for determining if abstract serialization method is needed (#4930) 2024-10-31 17:05:37 +00:00
Wei Hu fe8f3f1bbc
Update ClientPipelineApi, HttpMessageApi abstraction (#4816)
- Remove unused `ClientPipelineApi.CreateMessage`
- Add `HttpRequestOptionsApi` to `ClientPipelineApi.Send(Async)`
- Replace `HttpMessageApi.ResponseClassifier` with
`HttpMessageApi.ApplyResponseClassifier`
- Make abstraction more generic

This fix is needed for below issues of Azure plugin:
https://github.com/Azure/azure-sdk-for-net/issues/46899
https://github.com/Azure/azure-sdk-for-net/issues/46900
https://github.com/Azure/azure-sdk-for-net/issues/46901
https://github.com/Azure/azure-sdk-for-net/issues/46902
2024-10-31 04:24:33 +00:00
Jorge Rangel 80f5c4c35f
[http-client-csharp] fix: use correct custom ctor in model factory (#4921)
This PR fixes an issue where the model factory method for a model was
using the incorrect full constructor when the full constructor was
suppressed and customized.

fixes: https://github.com/microsoft/typespec/issues/4830
2024-10-30 22:39:19 +00:00
JoshLove-msft 6d168d399e
Don't check for null for structs (#4922)
Fix to https://github.com/microsoft/typespec/pull/4919
2024-10-30 21:48:05 +00:00
JoshLove-msft 3f13f87333
Fix binary content implicit cast (#4919)
Fixes https://github.com/microsoft/typespec/issues/4916

Found https://github.com/microsoft/typespec/issues/4918 while testing
2024-10-30 20:45:34 +00:00
Crystal YU 54b0d8a044
onboard two-operation-group (#4880)
Fix https://github.com/microsoft/typespec/issues/3970
2024-10-30 03:42:59 +00:00
JoshLove-msft 47daae6b87
Do not initialize ReadOnlyMemory in model factory methods (#4900)
ROM is a struct, so there is no point in doing the empty initialization.
This would result in build errors if the parameter was not defined as
nullable as the null coalescing operator can't be used with a struct.
2024-10-29 18:24:52 +00:00
Jorge Rangel a3ea277849
[http-client-csharp] fix: incorrect discriminator value in modelfactory (#4888)
fixes: https://github.com/microsoft/typespec/issues/4885
2024-10-29 14:53:32 +00:00
Jorge Rangel 0675e50a35
[http-client-csharp] Fix: do not add wire info for duplicate props (#4877)
fixes: https://github.com/microsoft/typespec/issues/4852
2024-10-28 21:19:00 +00:00
Nisha Bhatia c8b55b95d3
Update ReadOnlyMemory ToList() in ModelFactoryProvider.cs (#4875)
Fixes:
https://github.com/microsoft/typespec/issues/4832?reload=1?reload=1
2024-10-28 16:43:11 +00:00
JoshLove-msft 93a2c3fdc2
Changes to support modifying methods via plugin (#4876)
Contributes to https://github.com/microsoft/typespec/issues/4798
2024-10-25 22:53:41 +00:00
Jorge Rangel 057d0c63dc
[http-client-csharp] fix: handle collections of custom extensible enums (#4870)
fixes: https://github.com/microsoft/typespec/issues/4824
2024-10-25 19:21:47 +00:00
Jorge Rangel 3504675a25
[http-client-csharp] Fix: add support for 201 classifier (#4866)
Fixes an issue where an operation with a 201 response would cause the
generator to crash since there is no corresponding classifier generated
for a 201 response.

contributes to https://github.com/microsoft/typespec/issues/4865
2024-10-24 22:39:02 +00:00
Jorge Rangel 87cd159360
Remove obsolete method description in MRW provider (#4853)
follow up cleanup item for
https://github.com/microsoft/typespec/pull/4850
2024-10-24 15:11:06 +00:00
Jorge Rangel ffef479571
[http-client-csharp] Fix: Properly handle property wire nullability during deserialization (#4850)
This PR adds a set of fixes related to the generated deserialization
code and customization:
- Properties will be set to null during deserialization if both the
customized type and the wire type are nullable. Previously, this exposed
a corner case where the wire type was nullable but the customized type
was not.
- Removed the unnecessary null check when a custom deserialization
method hook is added for a property.

fixes: https://github.com/microsoft/typespec/issues/4813
2024-10-24 00:43:21 +00:00
Nisha Bhatia e600be5dda
Update assignment of Json ReadOnlyMemory Property (#4829)
Fixes: https://github.com/microsoft/typespec/issues/4778
2024-10-23 19:41:07 +00:00
JoshLove-msft 49300ce376
Support customizing to abstract (#4848)
Fixes https://github.com/microsoft/typespec/issues/4847
2024-10-23 19:30:09 +00:00
JoshLove-msft 9194b1ab09
Make AsParameter property not cache Type (#4839)
Fixes https://github.com/microsoft/typespec/issues/4838
2024-10-23 18:55:43 +00:00
Crystal YU 1b5d87a4f3
onboard client-operation-group (#4814)
Fix https://github.com/microsoft/typespec/issues/4187

onboard http/client/structure/client-operation-group

---------

Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
2024-10-23 00:59:50 +00:00
JoshLove-msft 53db1212ed
Fix bug in customizing URI property (#4828) 2024-10-22 20:13:18 +00:00
Jorge Rangel 30568a4910
[http-client-csharp] fix: use inputmodel name as default name in serialization provider (#4823)
This PR fixes an issue where the name of the serialization provider for
a model was being built incorrectly when the model is renamed and the
renamed model is also further customized. It addresses this issue by
ensuring the default name of the serialization provider is the name of
the input model it is constructed from.

fixes: https://github.com/microsoft/typespec/issues/4793
2024-10-22 19:14:58 +00:00
JoshLove-msft 12a560559b
Fix serialization of properties customized to be framework types (#4812)
Fixes https://github.com/microsoft/typespec/issues/4810
2024-10-21 23:15:29 +00:00
Jorge Rangel b33fe857f4
[http-client-csharp] Fix: remove setters for props in readonly structs (#4809)
Removes the invalid setters from auto-implemented properties in
read-only structs.

fixes: https://github.com/microsoft/typespec/issues/4351
2024-10-21 21:04:57 +00:00
Jorge Rangel a8c67ff628
[http-client-csharp] Fix: allow suppressing & replacing fields (#4795)
This PR enables the suppression of fields via the `CodeGenSuppress`
attribute, and enables the replacement of fields via custom code.

fixes: https://github.com/microsoft/typespec/issues/4792
2024-10-21 19:38:19 +00:00
JoshLove-msft 48d7bc0cd2
Generate raw data field as readonly (#4808)
Fixes https://github.com/microsoft/typespec/issues/4350
2024-10-21 19:24:33 +00:00
JoshLove-msft 7d0cbb55bb
Use IEnumerable for list parameters in client methods (#4787)
Fixes https://github.com/microsoft/typespec/issues/4786
2024-10-18 17:01:43 +00:00
Jorge Rangel 2d9d3a92ad
[http-client-csharp] Fix: remove duplicate 'Client' suffix in subclients (#4791)
fixes: https://github.com/microsoft/typespec/issues/4777
2024-10-18 16:23:08 +00:00
Wei Hu cec638d301
Response abstraction (#4438)
Resolves https://github.com/microsoft/typespec/issues/3693
2024-10-18 04:21:18 +00:00
Jorge Rangel f1bfe9cdf9
[http-client-csharp]: Don't include custom required literal properties in public ctor (#4783)
This PR addresses an issue where required spec properties that were
literals and then customized to another literal type were being
incorrectly included in the public constructor.

fixes: https://github.com/microsoft/typespec/issues/4747
2024-10-17 22:40:53 +00:00
Nisha Bhatia a689659f64
Update Generator to support Parent parameters (#4392)
Fixes: https://github.com/microsoft/typespec/issues/3969
2024-10-17 21:56:25 +00:00
JoshLove-msft 37f9883cdd
Respect usage for properties (#4781)
Fixes https://github.com/microsoft/typespec/issues/4780
2024-10-17 21:37:41 +00:00
JoshLove-msft 7772f4f299
Fix handling for customization to fixed enums (#4767)
Fixes https://github.com/microsoft/typespec/issues/4744
2024-10-17 16:23:29 +00:00
Jorge Rangel a2ed4632d2
Support Customizing Discriminator Types as Fixed Enums (#4766)
This PR fixes an issue where a discriminator property was customized via
custom code to a custom fixed enum type and the generator was still
generating the discriminator value using the original type.

fixes: https://github.com/microsoft/typespec/issues/4636,
https://github.com/microsoft/typespec/issues/4636
2024-10-17 15:34:20 +00:00
Mingzhe Huang 0b9246764a
build(deps): bump tsp 0.61.2 (#4693)
- bump tsp 0.61.2 and corresponding libraries
- update according to API change

part of https://github.com/Azure/autorest.csharp/issues/5111

---------

Co-authored-by: Mingzhe Huang (from Dev Box) <mingzhehuang@microsoft.com>
2024-10-17 05:33:53 +00:00
Crystal YU 64f1dbae92
support apiVersion as path parameter (#4691)
Fix https://github.com/microsoft/typespec/issues/3986
Fix https://github.com/microsoft/typespec/issues/4673
Fix https://github.com/microsoft/typespec/issues/4690

- support api-version is a path parameter. We will add a `_apiVersion`
field in the client, and will use `_apiVersion` field in
`CreateXXXMessage`
- When the type of api-version is Enum, we will convert it to string
- Not to generate constructor for `ClientOptionsProvider` in
`stubLibraryVistor`.
2024-10-17 00:12:49 +00:00
JoshLove-msft 518ac2b2f4
Support serializing fields (#4746)
Fixes https://github.com/microsoft/typespec/issues/4638

Also fixes serialization for literal extensible enums (enums with one
default literal value).
2024-10-16 16:55:35 +00:00
JoshLove-msft 4e63496411
Ensure customized properties are included in full constructor (#4734) 2024-10-14 23:06:12 +00:00
Jorge Rangel c215c5a35a
Additional fixes for custom nullable types (#4722)
This PR adds some more fixes around namespace and name construction for
custom types.

Fixes: https://github.com/microsoft/typespec/issues/4635
2024-10-14 23:03:15 +00:00
JoshLove-msft 45787924a8
Add canonical view and fix customized struct serialization (#4712)
Fixes https://github.com/microsoft/typespec/issues/4624 and
https://github.com/microsoft/typespec/issues/3796
2024-10-14 21:36:29 +00:00
Jorge Rangel ff1725c4a8
Don't generate prop if custom prop exists in base (#4682)
This PR address the following bugs:
- If a model contains a spec property that was also added as a custom
model in it's base model, the derived model will not generate the
property.
- if a custom property is added to a base model and it includes the
`CodeGenSerialization` attribute, that property is included in
serialization ctor for the derived model.

fixes: https://github.com/microsoft/typespec/issues/4629
2024-10-11 16:37:47 +00:00
Timothee Guerin 58bd612c17
Remove duplicate title heading for generated docs (#4666) 2024-10-10 17:40:05 +00:00
Crystal YU bd952945c0
implement apiversion parameter (#4527)
Fix https://github.com/microsoft/typespec/issues/4206

- When the service is versioned, the client will has apiVersion field. 
- Each operation which has apiVersion parameter should use the client
apiVersion parameter directly and the operation signature should not
include the apiVersion parameter.
2024-10-10 02:52:56 +00:00
JoshLove-msft be9f9eb080
Fix parameter matching for reference types where the CSharpType is nullable (#4659) 2024-10-09 19:52:18 +00:00