Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {

allprojects {
group = 'dk.fust.docgen'
version = '1.13.0'
version = '1.14.0'

plugins.withType(JavaPlugin).whenPluginAdded {
dependencies {
Expand All @@ -22,7 +22,7 @@ allprojects {
testImplementation project(':helpers:documentation-generator-test-utilities')
testImplementation platform('org.spockframework:spock-bom:2.4-groovy-5.0')
testImplementation 'org.spockframework:spock-core'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:6.0.2'
}

tasks.withType(Test).configureEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class Column {
@Description("Regular expression that the contain must obey. Example: ((\\d{3}[A-Z]?)|0{4})")
private String regex;

@Description("Format for dates. Example: yyyy-MM-dd HH:mm:ss.SSS")
private String format;

@Description("Example on how the content may look. Could be a description as well: 'value between 0 and 1. eg 0,3333'")
private String example;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
"type" : "string",
"description" : "Example on how the content may look. Could be a description as well: 'value between 0 and 1. eg 0,3333'"
},
"format" : {
"type" : "string",
"description" : "Format for dates. Example: yyyy-MM-dd HH:mm:ss.SSS"
},
"keys" : {
"type" : "string",
"description" : "Is this column a part of the unique key?"
Expand Down
2 changes: 2 additions & 0 deletions generators/documentation-generator-data-dictionary/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ To use the data dictionary generator, you must configure it with `dk.fust.docgen
| columnPosition | [DataDictionaryConfigurationColumn](#dataDictionaryConfigurationColumn) | Customizing position | Export: `true`<br/>Header: `Position`<br/>Alignment: `RIGHT` |
| columnType | [DataDictionaryConfigurationColumn](#dataDictionaryConfigurationColumn) | Customizing data type | Export: `true`<br/>Header: `Type`<br/>Alignment: `LEFT` |
| columnMandatory | [DataDictionaryConfigurationColumn](#dataDictionaryConfigurationColumn) | Customizing mandatory | Export: `true`<br/>Header: `Mandatory`<br/>Alignment: `LEFT` |
| columnFormat | [DataDictionaryConfigurationColumn](#dataDictionaryConfigurationColumn) | Customizing format | Export: `false`<br/>Header: `Format`<br/>Alignment: `LEFT` |
| columnKeys | [DataDictionaryConfigurationColumn](#dataDictionaryConfigurationColumn) | Customizing keys | Export: `true`<br/>Header: `Keys`<br/>Alignment: `LEFT` |
| columnDescription | [DataDictionaryConfigurationColumn](#dataDictionaryConfigurationColumn) | Customizing description | Export: `true`<br/>Header: `Description`<br/>Alignment: `LEFT` |
| columnExample | [DataDictionaryConfigurationColumn](#dataDictionaryConfigurationColumn) | Customizing example | Export: `true`<br/>Header: `Example`<br/>Alignment: `LEFT` |
Expand Down Expand Up @@ -63,6 +64,7 @@ Documentation
│ ├── dataType
│ ├── regex
│ ├── example
│ ├── format
│ ├── mandatory
│ ├── minimumValue
│ ├── maximumValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class DataDictionaryConfiguration extends AbstractDataDictionaryConfigura
@MergeWithDefault private DataDictionaryConfigurationColumn columnDescription = new DataDictionaryConfigurationColumn(true, "Description", Alignment.LEFT);
@MergeWithDefault private DataDictionaryConfigurationColumn columnExample = new DataDictionaryConfigurationColumn(true, "Example", Alignment.LEFT);
@MergeWithDefault private DataDictionaryConfigurationColumn columnSchema = new DataDictionaryConfigurationColumn(false, "Schema", Alignment.LEFT);
@MergeWithDefault private DataDictionaryConfigurationColumn columnFormat = new DataDictionaryConfigurationColumn(false, "Format", Alignment.LEFT);

private String schemaName = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ private static Row createRowForColumn(Column column, long position, DataDictiona
addCellIfConfigured(cells, dataDictionaryConfiguration.getColumnColumn(), column.getColumnName());
addCellIfConfigured(cells, dataDictionaryConfiguration.getColumnPosition(), position);
addCellIfConfigured(cells, dataDictionaryConfiguration.getColumnType(), column.getDataType());
addCellIfConfigured(cells, dataDictionaryConfiguration.getColumnFormat(), column.getFormat());
addCellIfConfigured(cells, dataDictionaryConfiguration.getColumnMandatory(), column.getMandatory() ? "Yes" : "No");
addCellIfConfigured(cells, dataDictionaryConfiguration.getColumnKeys(), column.getKeys());
addCellIfConfigured(cells, dataDictionaryConfiguration.getColumnDescription(), column.getColumnDescription());
Expand Down Expand Up @@ -113,6 +114,7 @@ private static Row createDescriptionForFileRow(DataDictionaryFile dataDictionary
emptyCells += dataDictionaryConfiguration.getColumnKeys().getExport() ? 1 : 0;
emptyCells += dataDictionaryConfiguration.getColumnPosition().getExport() ? 1 : 0;
emptyCells += dataDictionaryConfiguration.getColumnType().getExport() ? 1 : 0;
emptyCells += dataDictionaryConfiguration.getColumnFormat().getExport() ? 1 : 0;
for (int i = 0; i < emptyCells; i++) {
cells.add(new Cell((String) null, true));
}
Expand All @@ -134,6 +136,7 @@ private static Row createHeaderRow(DataDictionaryConfiguration dataDictionaryCon
addHeaderCellIfConfigured(headerCells, dataDictionaryConfiguration.getColumnColumn());
addHeaderCellIfConfigured(headerCells, dataDictionaryConfiguration.getColumnPosition());
addHeaderCellIfConfigured(headerCells, dataDictionaryConfiguration.getColumnType());
addHeaderCellIfConfigured(headerCells, dataDictionaryConfiguration.getColumnFormat());
addHeaderCellIfConfigured(headerCells, dataDictionaryConfiguration.getColumnMandatory());
addHeaderCellIfConfigured(headerCells, dataDictionaryConfiguration.getColumnKeys());
addHeaderCellIfConfigured(headerCells, dataDictionaryConfiguration.getColumnDescription());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class DataDictionaryGeneratorSpec extends Specification {
configuration.columnType.export = expType
configuration.columnPosition.export = expPosition
configuration.columnExample.export = expExam
configuration.columnFormat.export = expFormat

Generator generator = configuration.getGenerator()

Expand All @@ -43,25 +44,26 @@ class DataDictionaryGeneratorSpec extends Specification {
mockTableFormatter.formatTableArgument.rows[2].cells.size() == cellSize

where:
addDescFile | expFile | expDesc | expColumn | expKeys | expType | expPosition | expExam | expSchema | schemaName | cellSize | rowSize
false | true | true | true | true | true | true | true | true | 'schema' | 9 | 4
false | true | true | true | true | true | true | true | false | null | 8 | 4
false | false | true | true | true | true | true | true | false | null | 7 | 4
false | false | false | true | true | true | true | true | false | null | 6 | 4
false | false | false | false | true | true | true | true | false | null | 5 | 4
false | false | false | false | false | true | true | true | false | null | 4 | 4
false | false | false | false | false | false | true | true | false | null | 3 | 4
false | false | false | false | false | false | false | true | false | null | 2 | 4
false | false | false | false | false | false | false | false | false | null | 1 | 4
true | true | true | true | true | true | true | true | true | 'schema' | 9 | 6
true | true | true | true | true | true | true | true | false | null | 8 | 6
true | false | true | true | true | true | true | true | false | null | 7 | 6
true | false | false | true | true | true | true | true | false | null | 6 | 6
true | false | false | false | true | true | true | true | false | null | 5 | 6
true | false | false | false | false | true | true | true | false | null | 4 | 6
true | false | false | false | false | false | true | true | false | null | 3 | 6
true | false | false | false | false | false | false | true | false | null | 2 | 6
true | false | false | false | false | false | false | false | false | null | 1 | 6
addDescFile | expFile | expDesc | expColumn | expKeys | expType | expPosition | expFormat | expExam | expSchema | schemaName | cellSize | rowSize
false | true | true | true | true | true | true | false | true | true | 'schema' | 9 | 4
false | true | true | true | true | true | true | false | true | false | null | 8 | 4
false | false | true | true | true | true | true | false | true | false | null | 7 | 4
false | false | false | true | true | true | true | false | true | false | null | 6 | 4
false | false | false | false | true | true | true | false | true | false | null | 5 | 4
false | false | false | false | false | true | true | false | true | false | null | 4 | 4
false | false | false | false | false | false | true | false | true | false | null | 3 | 4
false | false | false | false | false | false | false | false | true | false | null | 2 | 4
false | false | false | false | false | false | false | false | false | false | null | 1 | 4
true | true | true | true | true | true | true | false | true | true | 'schema' | 9 | 6
true | true | true | true | true | true | true | false | true | false | null | 8 | 6
true | false | true | true | true | true | true | false | true | false | null | 7 | 6
true | false | false | true | true | true | true | false | true | false | null | 6 | 6
true | false | false | false | true | true | true | false | true | false | null | 5 | 6
true | false | false | false | false | true | true | false | true | false | null | 4 | 6
true | false | false | false | false | false | true | false | true | false | null | 3 | 6
true | false | false | false | false | false | false | false | true | false | null | 2 | 6
true | false | false | false | false | false | false | false | false | false | null | 1 | 6
true | false | false | false | false | false | false | true | false | false | null | 2 | 6
}

def "read using generator configuration"() {
Expand Down
4 changes: 4 additions & 0 deletions site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ <h3>The documentation files must adhere to the JSON schema</h3>
<td>5</td>
<td><a href="v5/documentation-schema.json">Documentation Generator JSON schema with options for applying collate to fields</a></td>
</tr>
<tr>
<td>6</td>
<td><a href="v6/documentation-schema.json">Added format</a></td>
</tr>
</table>
</div>
</div>
Expand Down
Loading