diff --git a/AutoRest/Generators/Extensions/Extensions/Extensions.cs b/AutoRest/Generators/Extensions/Extensions/Extensions.cs index b80820b8c0..620a2d594c 100644 --- a/AutoRest/Generators/Extensions/Extensions/Extensions.cs +++ b/AutoRest/Generators/Extensions/Extensions/Extensions.cs @@ -77,7 +77,7 @@ public static void ProcessParameterizedHost(ServiceClient serviceClient, Setting useSchemePrefix = bool.Parse(hostExtension[UseSchemePrefix].ToString()); } - var position = "last"; + var position = "first"; if (hostExtension[PositionInOperation] != null) { diff --git a/AutoRest/TestServer/swagger/custom-baseUrl-more-options.json b/AutoRest/TestServer/swagger/custom-baseUrl-more-options.json index 875759e680..75ef745397 100644 --- a/AutoRest/TestServer/swagger/custom-baseUrl-more-options.json +++ b/AutoRest/TestServer/swagger/custom-baseUrl-more-options.json @@ -8,7 +8,6 @@ "x-ms-parameterized-host": { "hostTemplate": "{vault}{secret}{dnsSuffix}", "useSchemePrefix": false, - "positionInOperation": "first", "parameters": [ { "name": "vault", diff --git a/AutoRest/TestServer/swagger/custom-baseUrl.json b/AutoRest/TestServer/swagger/custom-baseUrl.json index 5ca07d1627..aaa0309f4b 100644 --- a/AutoRest/TestServer/swagger/custom-baseUrl.json +++ b/AutoRest/TestServer/swagger/custom-baseUrl.json @@ -8,6 +8,7 @@ "host": "badhost", "x-ms-parameterized-host": { "hostTemplate": "{accountName}{host}", + "positionInOperation": "last", "parameters": [ { "name": "accountName", diff --git a/Documentation/swagger-extensions.md b/Documentation/swagger-extensions.md index dba70ead92..f606ac3355 100644 --- a/Documentation/swagger-extensions.md +++ b/Documentation/swagger-extensions.md @@ -390,8 +390,8 @@ Field Name | Type | Description ---|:---:|--- hostTemplate | `string` | **Required**. Specifies the parameterized template for the host. useSchemePrefix | `boolean` | **Optional, Default: true**. Specifes whether to prepend the default scheme a.k.a protocol to the base uri of client. -positionInOperation | `string` | **Optional, Default: last**. Specifies whether the list of parameters will appear in the beginning or in the end, in the method signature for every operation. The order within the parameters provided in the below mentioned array will be preserved. Either the array of parameters will be prepended or appended, based on the value provided over here. Valid values are **"first", "last"**. -parameters | [Array of Parameter Objects](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameterObject) | The list of parameters that are used within the hostTemplate. This can include both reference parameters as well as explicit parameters. Note that "in" is **required** and **must be** set to "path" +positionInOperation | `string` | **Optional, Default: first**. Specifies whether the list of parameters will appear in the beginning or in the end, in the method signature for every operation. The order within the parameters provided in the below mentioned array will be preserved. Either the array of parameters will be prepended or appended, based on the value provided over here. Valid values are **"first", "last"**. Every method/operation in any programming language has parameters categorized into two buckets **"required"** and **"optional"**. It is natural for optional paramaters to appear in the end in a method signature. **This aspect will be preserved, while prepending(first) or appending(last) hostTemplate parameters .** +parameters | [Array of Parameter Objects](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameterObject) | The list of parameters that are used within the hostTemplate. This can include both reference parameters as well as explicit parameters. Note that "in" is **required** and **must be** set to **"path"**. The reference parameters will be treated as **global parameters** and will end up as property of the client. **Example**: Using both explicit and reference parameters diff --git a/schema/swagger-extensions.json b/schema/swagger-extensions.json index 8b93156a83..6e6476c56d 100644 --- a/schema/swagger-extensions.json +++ b/schema/swagger-extensions.json @@ -1546,7 +1546,7 @@ }, "positionInOperation": { "type": "string", - "default": "end", + "default": "first", "pattern": "^(fir|la)st$" }, "parameters": {