Skip to content
This repository was archived by the owner on Feb 2, 2022. It is now read-only.

Commit a89f22c

Browse files
stishkinstas
andauthored
Expose Examples RESTler compile configuration options (#205)
Co-authored-by: stas <[email protected]>
1 parent f2ec419 commit a89f22c

File tree

4 files changed

+37
-16
lines changed

4 files changed

+37
-16
lines changed

ado/variables/version-variables.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ variables:
44
- name: version.minor
55
value: 0
66
- name: version.revision
7-
value: 0
7+
value: 1
88
- name: imageTag
9-
value: 'v4.0.0'
9+
value: 'v4.0.1'
1010
- name: imageTagLatest
1111
value: 'v4.latest'
1212
- name: devRevision

cli/samples/restler/no-authentication/compile.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
"toolName": "RESTler",
1616
"outputFolder": "compile",
1717
"toolConfiguration": {
18-
"task": "Compile"
18+
"task": "Compile",
19+
"compileConfiguration" : {
20+
"discoverExamples" : false
21+
}
1922
}
2023
}
2124
]

src/Agent/RESTlerAgent/AgentMain.fs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -348,32 +348,32 @@ let createRESTlerCompilerConfiguration (workDirectory: string) (grammar: Grammar
348348
// If specified, update the engine settings with hints derived from the grammar.
349349
EngineSettingsFilePath = None
350350

351-
IncludeOptionalParameters = true
351+
IncludeOptionalParameters = compileConfig.IncludeOptionalParameters
352352

353-
UseQueryExamples = true
353+
UseQueryExamples = compileConfig.UseQueryExamples
354354

355-
UseBodyExamples = true
355+
UseBodyExamples = compileConfig.UseBodyExamples
356356

357357
/// When set to 'true', discovers examples and outputs them to a directory next to the grammar.
358358
/// If an existing directory exists, does not over-write it.
359-
DiscoverExamples = true
359+
DiscoverExamples = compileConfig.DiscoverExamples
360360

361361
/// The directory where the compiler should look for examples.
362362
/// If 'discoverExamples' is true, this directory will contain the
363363
/// example files that have been discovered.
364364
/// If 'discoverExamples' is false, every time an example is used in the
365365
/// Swagger file, RESTler will first look for it in this directory.
366-
ExamplesDirectory = workDirectory ++ "Examples"
366+
ExamplesDirectory = match compileConfig.ExamplesDirectory with None -> workDirectory ++ "Examples" | Some d -> d
367367

368368
/// Perform data fuzzing
369-
DataFuzzing = true
369+
DataFuzzing = compileConfig.DataFuzzing
370370

371371
// When true, only fuzz the GET requests
372372
ReadOnlyFuzz = compileConfig.ReadOnlyFuzz
373373

374-
ResolveQueryDependencies = true
374+
ResolveQueryDependencies = compileConfig.ResolveQueryDependencies
375375

376-
ResolveBodyDependencies = true
376+
ResolveBodyDependencies = compileConfig.ResolveBodyDependencies
377377

378378
UseRefreshableToken = compileConfig.UseRefreshableToken
379379

src/Agent/RESTlerAgent/RESTlerAgentConfigTypes.fs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,35 @@ type CompileConfiguration =
5656
MutationsSeed : int64 option
5757

5858
CustomDictionary: CustomDictionary option
59+
60+
DiscoverExamples : bool
61+
ExamplesDirectory : string option
62+
63+
DataFuzzing : bool
64+
ResolveQueryDependencies: bool
65+
ResolveBodyDependencies : bool
66+
UseBodyExamples : bool
67+
UseQueryExamples : bool
68+
IncludeOptionalParameters : bool
5969
}
6070

6171
static member Empty : CompileConfiguration =
6272
{
63-
InputJsonGrammarPath = None;
64-
InputFolderPath = None;
65-
ReadOnlyFuzz = false;
66-
AllowGetProducers = false;
67-
UseRefreshableToken = false;
73+
InputJsonGrammarPath = None
74+
InputFolderPath = None
75+
ReadOnlyFuzz = false
76+
AllowGetProducers = false
77+
UseRefreshableToken = false
6878
MutationsSeed = None;
6979
CustomDictionary = None
80+
DiscoverExamples = true
81+
ExamplesDirectory = None
82+
DataFuzzing = true
83+
ResolveQueryDependencies = true
84+
ResolveBodyDependencies = true
85+
UseBodyExamples = true
86+
UseQueryExamples = true
87+
IncludeOptionalParameters = true
7088
}
7189

7290

0 commit comments

Comments
 (0)