Skip to content

Commit

Permalink
starting to address issue #820: handling default and examples from RE…
Browse files Browse the repository at this point in the history
…ST schemas
  • Loading branch information
arcuri82 committed Oct 27, 2023
1 parent f18ed7d commit ea072d8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions core/src/main/kotlin/org/evomaster/core/EMConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,11 @@ class EMConfig {

if (saveMockedResponseAsSeparatedFile && testResourcePathToSaveMockedResponse.isBlank())
throw IllegalArgumentException("testResourcePathToSaveMockedResponse cannot be empty if it is required to save mocked responses in separated files (ie, saveMockedResponseAsSeparatedFile=true)")

if(probRestDefault + probRestExamples > 1){
throw IllegalArgumentException("Invalid combination of probabilities for probRestDefault and probRestExamples. " +
"Their sum should be lower or equal to 1.")
}
}

private fun checkPropertyConstraints(m: KMutableProperty<*>) {
Expand Down Expand Up @@ -1941,6 +1946,18 @@ class EMConfig {
var excludedTargetsForImpactCollection : List<String> = extractExcludedTargetsForImpactCollection()
private set


@Experimental
@Cfg("In REST, specify probability of using 'default' values, if any is specified in the schema")
@Probability(true)
var probRestDefault = 0.0

@Experimental
@Cfg("In REST, specify probability of using 'example(s)' values, if any is specified in the schema")
@Probability(true)
var probRestExamples = 0.0


fun timeLimitInSeconds(): Int {
if (maxTimeInSeconds > 0) {
return maxTimeInSeconds
Expand Down

0 comments on commit ea072d8

Please sign in to comment.