Skip to content

Latest commit

 

History

History
37 lines (21 loc) · 1.71 KB

xms-parameter-location.md

File metadata and controls

37 lines (21 loc) · 1.71 KB

XmsParameterLocation

Category

SDK Error

Applies to

ARM and Data Plane OpenAPI(swagger) specs

Output Message

The parameter '{your parameter name}' is defined in global parameters section without 'x-ms-parameter-location' extension. This would add the parameter as the client property. Please ensure that this is exactly you want. If so, apply the extension "x-ms-parameter-location": "client". Else, apply the extension "x-ms-parameter-location": "method".

Description

SDKs generated by AutoRest have two types of operation parameters: method arguments and client fields. The x-ms-parameter-location extension gives the Swagger author control of how an operation-parameter will be interpreted by AutoRest, and as such is one of few things in a Swagger document that has semantic value only relevant to the shape of the generated SDKs.

Some parameters, such as API Version and Subscription ID will make sense as part of nearly every request. For these, having developers specify them for each method call would be burdensome; attaching them to the client and automatically including them in each request makes way more sense. Other parameters will be very operation specific and should be provided each time the method is called.

Why this rule is important

Without providing the parameter-location, constructor parameter lists end up incorporating entries that are only relevant to one of the methods that belong to a type. Needless to say, this can spiral out of control and turn your SDKs into gunk.

How to fix the violation

For each parameter in the document-level "parameters" section of your document provide either:

"x-ms-parameter-location":"method"

or

"x-ms-parameter-location":"client"