Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1486 from finos/1456_make_nullable_false_by_default
Browse files Browse the repository at this point in the history
1456 make nullable false by default
  • Loading branch information
JHarrisSL authored Oct 24, 2019
2 parents be7d020 + b1fa32b commit 7faab95
Show file tree
Hide file tree
Showing 69 changed files with 1,069 additions and 1,635 deletions.
2 changes: 1 addition & 1 deletion docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Feature: the name of my feature
Background:
Given the generation strategy is interesting
And there is a field foo
And there is a non nullable field foo
Scenario: Running the generator should emit the correct data
Given foo is equal to 8
Expand Down
19 changes: 10 additions & 9 deletions docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,6 @@ firstName
[...]
```

Fields are nullable by default, however, you can add a further constraint to a field to indicate it is 'not null'. If you add the following constraint, the generator will no longer output null values:

```json
"constraints": [
{ "field": "firstName", "is": "matchingRegex", "value": "[a-z]{1,10}" },
{ "not": { "field": "firstName", "is": "null" } }
]
```

The generator supports three different types of constraint. These are:

- **Predicates** - boolean-valued functions that define whether a given value is valid or invalid. In the above profile `ofType` and `matchingRegex` are examples of predicates.
Expand Down Expand Up @@ -313,6 +304,16 @@ firstName,age,nationalInsurance
[...]
```

Fields are non-nullable by default, however, you can indicate that a field is nullable:

```json
{
"name": "field1",
"type": "datetime",
"nullable": true
}
```

You can find out more about the various constraints the generator supports in the detailed [User Guide](UserGuide.md).

## Generation modes
Expand Down
6 changes: 3 additions & 3 deletions docs/archive/developer/CucumberSyntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: the name of my feature
Background:
Given the generation strategy is interesting
And there is a field foo
And there is a non nullable field foo
Scenario: Running the generator should emit the correct data
Given foo is equal to 8
Expand Down Expand Up @@ -37,8 +37,8 @@ foo is greaterThan 5

Operators are converted to English language equivalents for use in cucumber, so 'greaterThan' is expressed as 'greater than'.

* _there is a field `{field}`_, adds a field called `field` to the profile
* _the following fields exist:_, adds a set of fields to the profile (is followed by a single column set of strings, each represents a field name)
* _there is a non nullable field `{field}`_, adds a field called `field` to the profile
* _the following non nullable fields exist:_, adds a set of fields to the profile (is followed by a single column set of strings, each represents a field name)
* _`{field}` is null_, adds a null constraint to the profile for the field `field`
* _`{field}` is anything but null_, adds a not(is null) constraint to the profile for field `field`
* _`{field}` is `{operator}` `{operand}`_, adds an `operator` constraint to the field `field` with the data `operand`, see **operators** and **operands** sections below
Expand Down
4 changes: 2 additions & 2 deletions docs/developer/CucumberCookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ foo is greaterThan 5

Operators are converted to English language equivalents for use in cucumber, so 'greaterThan' is expressed as 'greater than'.

* _there is a field `{field}`_, adds a field called `field` to the profile
* _the following fields exist:_, adds a set of fields to the profile (is followed by a single column set of strings, each represents a field name)
* _there is a non nullable field `{field}`_, adds a field called `field` to the profile
* _the following nullable fields exist:_, adds a set of fields to the profile (is followed by a single column set of strings, each represents a field name)
* _`{field}` is null_, adds a null constraint to the profile for the field `field`
* _`{field}` is anything but null_, adds a not(is null) constraint to the profile for field `field`
* _`{field}` is `{operator}` `{operand}`_, adds an `operator` constraint to the field `field` with the data `operand`, see **operators** and **operands** sections below
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,25 @@ Feature: Generator can produce correct data for complex profiles.
Scenario: Running a random strategy on a profile where there are hard to detect contradictions within or statements does not crash
Given the generation strategy is Random
And the generator can generate at most 5 rows
And the following fields exist:
And the following non nullable fields exist:
| foo |
| bar |
And foo has type "integer"
And foo is anything but null
And bar has type "integer"
And bar is anything but null
And Any Of the next 2 constraints
And All Of the next 3 constraints
And Any Of the next 2 constraints
And bar is equal to 1
And bar is equal to 2
And Any Of the next 2 constraints
And foo is equal to 1
And bar is equal to 3
And Any Of the next 2 constraints
And foo is equal to 2
And bar is equal to 4
And Any Of the next 2 constraints
And bar is equal to 1
And bar is equal to 2
And Any Of the next 2 constraints
And foo is equal to 1
And bar is equal to 3
And Any Of the next 2 constraints
And foo is equal to 2
And bar is equal to 4
And All Of the next 2 constraints
And foo is equal to 10
And bar is equal to 10
And foo is equal to 10
And bar is equal to 10
Then the following data should be generated:
| foo | bar |
| 10 | 10 |
Expand Down
Loading

0 comments on commit 7faab95

Please sign in to comment.