Conditions | 7 |
Total Lines | 22 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 7.0222 |
Changes | 0 |
1 | package data |
||
39 | func (generator *integerGenerator) getMinMax(schema *openapi3.Schema) (int64, int64) { |
||
40 | 1 | minimum := generator.defaultMinimum |
|
41 | 1 | maximum := generator.defaultMaximum |
|
42 | 1 | if schema.Format == "int32" && generator.defaultMaximum > math.MaxInt32 { |
|
43 | maximum = math.MaxInt32 |
||
44 | } |
||
45 | |||
46 | 1 | if schema.Min != nil { |
|
47 | 1 | minimum = int64(*schema.Min) |
|
48 | } |
||
49 | 1 | if schema.Max != nil { |
|
50 | 1 | maximum = int64(*schema.Max) |
|
51 | } |
||
52 | |||
53 | 1 | if schema.ExclusiveMin { |
|
54 | 1 | minimum++ |
|
55 | } |
||
56 | 1 | if schema.ExclusiveMax { |
|
57 | 1 | maximum-- |
|
58 | } |
||
59 | |||
60 | 1 | return minimum, maximum |
|
61 | } |
||
71 |