Azure / autorest.java

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

[MPG] versioning for @added mixed with @removed #2644

Closed XiaofeiCao closed 3 months ago

XiaofeiCao commented 4 months ago
@added(Versions.v2022_09_02_preview)
@added(Versions.v2023_03_15_preview)
@added(Versions.v2023_06_15_preview)
@added(Versions.v2023_08_15_preview)
@removed(Versions.v2023_10_15)
@added(Versions.v2024_02_02_preview)
hubProfile?: FleetHubProfile;

https://github.com/Azure/azure-rest-api-specs/blob/80be470f83f16d693291beb988ee80cd9a0b8023/specification/containerservice/Fleet.Management/fleet.tsp#L50-L58

TCGCContext will likely contain a flag to only include operations in latest version: https://github.com/Azure/typespec-azure/issues/129#issuecomment-2011627278

TCGC getAllOperations will return operations/models with all the available versions.

Before TCGC supports it and we integrate getAllOperations, we could see if we can leverage existsAtVersion from versioning, using the default(latest) version.

weidongxu-microsoft commented 3 months ago

One suggestion is to have a e.g. "api-version" var in class (default to the latest api-version). This var maybe settable later.

And codegen (in default mode -- not handling breaking changes caused by REST-API non-break) would only generate API (it may include parameter and model property) that is available in this "api-version".

Context: Mgmt may need to generate for a GA api-version, when the latest is preview.