Skip to content

Commit 2722e54

Browse files
committed
Added an ability to configure operationsSorter via ENV
1 parent 4e0d3f8 commit 2722e54

4 files changed

Lines changed: 21 additions & 1 deletion

File tree

docker/configurator/translator.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ const defaultBaseConfig = {
5050
type: "boolean",
5151
base: true,
5252
}
53+
},
54+
operationsSorter: {
55+
value: "none",
56+
schema: {
57+
type: "string",
58+
base: true
59+
}
5360
}
5461
}
5562

docker/configurator/variables.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ const standardVariables = {
106106
WITH_CREDENTIALS: {
107107
type: "boolean",
108108
name: "withCredentials",
109+
},
110+
OPERATIONS_SORTER: {
111+
type: "string",
112+
name: "operationsSorter",
109113
}
110114
}
111115

docs/usage/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Parameter name | Docker variable | Description
139139
<td>
140140
<a name="user-content-operationssorter"></a><code>operationsSorter</code>
141141
</td>
142-
<td><em>Unavailable</em></td>
142+
<td><code>OPERATIONS_SORTER</code></td>
143143
<td><code>Function=(a =&gt; a)</code>. Apply a sort to the operation
144144
list of each API. It can be 'alpha' (sort by paths
145145
alphanumerically), 'method' (sort by HTTP method) or a function (see

test/unit/docker/translator.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,15 @@ describe("docker: env translator", function() {
147147
))
148148
})
149149

150+
it("should generate operationsSorter configuration prop", function () {
151+
const input = {
152+
OPERATIONS_SORTER: "alpha"
153+
}
154+
155+
expect(translator(input)).toEqual(dedent(`operationsSorter: true,`))
156+
157+
})
158+
150159
it("should generate an object config", function () {
151160
const input = {
152161
SPEC: `{ swagger: "2.0" }`

0 commit comments

Comments
 (0)