microsoft / typespec

https://typespec.io/
MIT License
4.52k stars 218 forks source link

[Feature Request] Enhanced Support for Versioning Decorators in Emitters #4590

Open mario-guerra opened 1 month ago

mario-guerra commented 1 month ago

Requested by the London Stock Exchange Group.

Description: The current REST-level client emitters in TypeSpec have inconsistent support for versioning decorators. While the TypeScript autorest emitter has been updated to handle versioning decorators, the Python emitter still lacks this capability. This inconsistency creates difficulties in managing different versions of APIs, which is crucial for maintaining backward compatibility and allowing clients to transition smoothly between versions.

Impact:

Desired Outcome:

Steps to Reproduce:

  1. Define versioning decorators in a TypeSpec specification.
  2. Generate REST-level clients using both TypeScript and Python emitters.
  3. Observe the inconsistent handling of versioning decorators between the two emitters.

Expected Behavior: Both TypeScript and Python emitters should handle versioning decorators consistently, generating code that supports multiple API versions effectively.

Actual Behavior: The TypeScript emitter handles versioning decorators, but the Python emitter does not, leading to inconsistencies in version management.

Additional Context: Proper versioning support is essential for large-scale projects where APIs need to evolve without breaking existing clients. This feature will facilitate smoother transitions and upgrades, improving the overall developer and user experience.

Checklist

mario-guerra commented 1 month ago

Tagging @lmazuel since this involves emitters.

tadelesh commented 1 month ago

python emitter should already support versioning. @mario-guerra could you share more about what inconsistencies you met and provide the tsp file?