Azure / autorest.java

Extension for AutoRest (https://github.com/Azure/autorest) that generates Java code
MIT License
33 stars 82 forks source link

tsp, json-merge-patch, bug fixes #2576

Closed haolingdong-msft closed 6 months ago

haolingdong-msft commented 6 months ago

Code changes:

  1. set toJsonMergePatch() as private method
  2. switch the order of updatedProperties check and null check
  3. bump minor version.

Link issue: https://github.com/Azure/autorest.java/issues/2471

Remain two issues:

  1. about discriminator/hierarchical model. https://github.com/Azure/autorest.java/pull/2576#discussion_r1504012383
  2. about deserialization called setter. https://github.com/Azure/autorest.java/pull/2576#issuecomment-1966144039
weidongxu-microsoft commented 6 months ago

@haolingdong-msft

Also please bump the minor version, and do a release after the PR.

Shawn is investigating the stream on OpenAI. With a release, he may help you solve the problems relates to OpenAI.

weidongxu-microsoft commented 6 months ago

Another problem on polymorphic class is that the fromJson of the subclass calls the setters of the base class to set field on base class. https://github.com/Azure/autorest.java/blob/5c1f03fd12792048c9d1aa68b162b560313e3311/typespec-tests/src/main/java/com/cadl/patch/models/Salmon.java#L280-L284

I assume it triggers updatedProperties (I assume it should not).

It probably not a blocking issue for now (at least it does not affect public API).

Please log it for discussion with Srikanta/Alan.

weidongxu-microsoft commented 6 months ago

The case of polymorphic class would not be a blocker to the PR -- let's hope service not using such in PATCH...

But it would be higher priority when service uses it.