Skip to content

Commit

Permalink
positionInOperation defaults to first
Browse files Browse the repository at this point in the history
  • Loading branch information
amarzavery committed Apr 9, 2016
1 parent 63b9fd6 commit d8110cf
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion AutoRest/Generators/Extensions/Extensions/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"x-ms-parameterized-host": {
"hostTemplate": "{vault}{secret}{dnsSuffix}",
"useSchemePrefix": false,
"positionInOperation": "first",
"parameters": [
{
"name": "vault",
Expand Down
1 change: 1 addition & 0 deletions AutoRest/TestServer/swagger/custom-baseUrl.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"host": "badhost",
"x-ms-parameterized-host": {
"hostTemplate": "{accountName}{host}",
"positionInOperation": "last",
"parameters": [
{
"name": "accountName",
Expand Down
4 changes: 2 additions & 2 deletions Documentation/swagger-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion schema/swagger-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -1546,7 +1546,7 @@
},
"positionInOperation": {
"type": "string",
"default": "end",
"default": "first",
"pattern": "^(fir|la)st$"
},
"parameters": {
Expand Down

0 comments on commit d8110cf

Please sign in to comment.