Azure / autorest.python

Extension for AutoRest (https://github.com/Azure/autorest) that generates Python code
MIT License
79 stars 57 forks source link

"All required parameters must be populated in order to send to server" - comment added in wrong classes #2623

Closed dargilco closed 3 months ago

dargilco commented 4 months ago

I see these code comments in emitted Python code "All required parameters must be populated in order to send to server". They are not in my TypeSpec files, so this is coming from the auto-gen tool. However, looks like they get inserted into all classes (TypeSpec "models") regardless if they are associated with HTTP request payload or response payload. I don't expect to see them inserted in class associated with response payload.

How do I control where this comment is inserted (or how do I disable this completely)?

My Python client library is here: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-inference My TypeSpec files are here (topic branch): https://github.com/Azure/azure-rest-api-specs/tree/dargilco/ai-model-inference/specification/ai/ModelClient

Thanks,

Darren

dargilco commented 4 months ago

But I must say it's a bit odd that the emitter adds code comments... My expectation is that the developer controls all code comments, and they all originate from what's written in TypeSpec files. My suggestion is to remove this completely. Do emitters in other programming languages add a similar comment?

dargilco commented 4 months ago

Also note that I define some models in TypeSpec related to response from the service, that are not used by auto-gen code. They are used by hand-written code. How is the auto-gen tool going to know how these models are used, and only to apply the added code comments to models related to service requests?