Azure / autorest.java

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

use isErrorOrChildOfError method from tcgc to check if model is an error model #2586

Closed lmazuel closed 6 months ago

lmazuel commented 6 months ago

The isErrorModel function in tsp core currently doesn't recursively mark children of error models as error models. This issue is going to go up for design review. In the meantime, we want to support inheritance for child error models.

We want to switch uses of isErrorModel from tsp core in our emitter to use isErrorOrChildOfError from tcgc, since this will recurse through child models as well.

NOTE: need to use 0.40.0-dev.15 of tcgc to get isErrorOrChildOfError support

Cadl-Ranch is not yet implemented, the scenario can be seen in this playground here

weidongxu-microsoft commented 6 months ago

@lmazuel Does any service depend on this "isErrorOrChildOfError"?

Reason is that typespec-java is currently on 0.13.x patch branch and 0.14.x release branch. 0.14.x switched to stream-style-serialization (basically it means the whole JSON serialization code is changed -- therefore we are still in the middle of migrating existing libs on SDK repo). Therefore, SDK repo is currently still on 0.13.x. If any service has this dependency, we had to patch on 0.13.x as well.

weidongxu-microsoft commented 6 months ago

PR ready https://github.com/Azure/autorest.java/pull/2604

Hope we can release 0.14.1 tomorrow (PS: may want to include https://github.com/Azure/autorest.java/pull/2603; may also want to include the flavor but maybe I am asking too much).

weidongxu-microsoft commented 6 months ago

I will move back to isErrorModel when updating cadl-ranch on the ErrorModel test case.