Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema Generation for nested yml configurations #1027

Merged
merged 102 commits into from
Jan 10, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
774506b
Added initial schema test
Aug 7, 2019
7051ca9
Added Schema Validation functions
Aug 8, 2019
f1b2d30
Added test jsonSchemGenerator
Aug 10, 2019
17079c7
Added test to generate an intermediate schema
Aug 16, 2019
886bc5a
Added schema generation for a single descriptor
Aug 17, 2019
0271cd3
Completed the string generation 2/4 of the schema
Aug 21, 2019
522f4e5
Added exclusion
Aug 22, 2019
f264c70
generic get configurators
jetersen Aug 22, 2019
076fe14
Finished Descriptor Configuration generation
Aug 22, 2019
2bd7f9d
Base configurator and HetroDescribable Configurator Schema Generation…
Aug 22, 2019
0da381b
Added Base configurators with no attributes
Aug 23, 2019
3d45f6b
Added Base configurator attribute enumeration schema
Aug 23, 2019
cd9a9dd
Added Non-enumerated attributes to schema
Aug 23, 2019
4bf306c
Added fully validated Configured schema
Aug 23, 2019
4657e0c
Added validation initial test
Aug 24, 2019
c734c0f
Using JSON objects to construct Schema
Aug 24, 2019
fe1ce60
Added valid schema integration tests
Aug 25, 2019
8108038
Converted class names to simple names
Aug 26, 2019
38dad38
Upgraded schema version
Aug 26, 2019
d89e24c
Changes to test and pom.xml
Aug 26, 2019
3c4510c
Added functions to split up the generateSchema() function
Aug 26, 2019
f079505
Added additional methods in generateSchema()
Aug 26, 2019
76c0932
Code Cleanup
Aug 26, 2019
623914f
Inital impl for describeStructure
Aug 27, 2019
13e893a
Incremental Impl changes
Aug 27, 2019
2ede6f6
Concept implementation
Aug 27, 2019
ec07960
Added annotation and test implementations
Aug 28, 2019
448c4a2
Added addition configurator wise tests
Aug 28, 2019
3165323
Added the utlisation of describeStructure
Aug 28, 2019
ad57f8d
Added default configurators describe structure
Aug 29, 2019
14197bc
Added describe Strucure function to default Config
Aug 29, 2019
a338fbc
Added JSON Schema mode and boolean
Aug 30, 2019
d0f9349
Added describeStructure to Attribute and Configurator
Aug 31, 2019
6c4cb3c
Merge branch 'master' into nested_yaml_schema
Sep 4, 2019
901ac01
Lookup addition for configurators
Sep 6, 2019
4df5e1e
Added tests and added baseConfigurator LookupFeature
Sep 6, 2019
81b9a68
Merge master into current branch
Sep 12, 2019
fd886c8
Added test for rootConfiguratorGeneration
Sep 14, 2019
6c42055
Sequence indication fix
Sep 20, 2019
b0b870b
Configurator Lookup Addition
Sep 20, 2019
fe7b0b8
Added javadoc and logger warning for failing tests
Sep 24, 2019
dcd5f6f
Added storeConfigurators function
Sep 25, 2019
122c8d9
Added root configurator nesting
Sep 25, 2019
e5bde57
Fixed root configurators
Sep 26, 2019
b97f380
Merge branch 'master' into nested_yaml_schema
Sep 26, 2019
1e0a6a2
Added support for the root configurators
Sep 27, 2019
d0083d8
Added mock test
Sep 27, 2019
a030035
Merge branch 'master' into nested_yaml_schema
Sep 27, 2019
2b105a4
Added nesting support for every base configurator and tests for the same
Sep 28, 2019
79892a2
Removed functions that are not used
Sep 28, 2019
51ae5fd
Added jenkins base configurator test
Sep 30, 2019
cee3cf6
Added validSelfConfig Test
Sep 30, 2019
1f72339
Added validSelfConfig and validJenkinsBaseConfig files
Oct 2, 2019
67c3f81
Don't fetch the jenkins.model.Jenkins
timja Oct 2, 2019
dff9199
Resolved merge conflicts and reverted tim's changes
Oct 4, 2019
5388f66
Resolved conflicts
Nov 15, 2019
e992aee
WIP
timja Dec 2, 2019
0e9e3bd
Merge branch 'master' into nested_yaml_schema
timja Dec 2, 2019
5bacdd2
Fix self configurator
timja Dec 2, 2019
b07c22b
Fix formatting
timja Dec 2, 2019
9bc089a
More formatting
timja Dec 2, 2019
94e14d4
Undo whitespace changes
timja Dec 2, 2019
a96a4f7
Change json schema test API to return list of errors
timja Dec 3, 2019
802c9c9
Merge branch 'change-json-schema-test-api' into nested_yaml_schema
timja Dec 3, 2019
d50ad6e
Adding failing test demonstrating all attributes getting flattenned to
timja Dec 3, 2019
26341c4
Fix flattening issues
timja Dec 3, 2019
3ce5e2b
Remove print lines
timja Dec 3, 2019
b92032d
Fix spot bugs
timja Dec 3, 2019
5e9ce85
Checkstyle
timja Dec 3, 2019
a71b71e
Fix test
timja Dec 3, 2019
ce565f2
Fix checkstyle
timja Dec 3, 2019
cd01391
Introduce test-harness module
timja Dec 7, 2019
e50c94f
shush codacy + docs
timja Dec 7, 2019
55e0216
Fix javadoc
timja Dec 7, 2019
80221ea
Fix import
timja Dec 7, 2019
2ef14a3
Merge branch 'change-json-schema-test-api' into nested_yaml_schema
timja Dec 8, 2019
53342bf
Add integration tests for some of the remaining issues
timja Dec 8, 2019
2403838
Fix enforcer
timja Dec 8, 2019
0395bea
Comment out debug
timja Dec 8, 2019
30fdbf8
Fix tests
timja Dec 8, 2019
912b46d
Add symbol support and fix tests
timja Dec 8, 2019
603a577
Add for symbol support
timja Dec 9, 2019
d271135
Checkstyle
timja Dec 9, 2019
896d2cb
Add long to case
timja Dec 9, 2019
ee1c946
Add one level of array support
timja Dec 9, 2019
6ab2a31
remove unused imports
jetersen Dec 10, 2019
3e32f25
Merge branch 'master' into nested_yaml_schema
timja Dec 10, 2019
3be3926
Revert unneeded change
timja Dec 10, 2019
e7b2a8f
Fix earlier merge, restore help file support
timja Dec 10, 2019
314f1a7
Fix checkstyle
timja Dec 10, 2019
b646a04
Added system log and removed exception
Dec 14, 2019
423ee6c
Improved warning string
Dec 14, 2019
d5d10f4
Added describeForSchema Function
Jan 5, 2020
1cdd881
Fixed Checkstyle
Jan 5, 2020
1040a6a
Removed boolean
Jan 7, 2020
a242048
Fixed ClassCast Exception
Jan 7, 2020
0cfde4a
Combined declaration and assignment
Jan 8, 2020
1aa84b1
Added javadoc and beta class
Jan 9, 2020
1ff2aaf
Update plugin/src/main/java/io/jenkins/plugins/casc/Configurator.java
Jan 10, 2020
15a7500
Update plugin/src/main/java/io/jenkins/plugins/casc/Attribute.java
Jan 10, 2020
b468ee9
Update plugin/src/main/java/io/jenkins/plugins/casc/Configurator.java
Jan 10, 2020
772445a
Update plugin/src/main/java/io/jenkins/plugins/casc/Attribute.java
Jan 10, 2020
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
24 changes: 10 additions & 14 deletions plugin/src/main/java/io/jenkins/plugins/casc/Attribute.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,9 @@ public CNode describe(Owner instance, ConfigurationContext context) throws Confi
}
try {
Object o;
if(isJsonSchema) {
o = getType();
if (o == null) {
return null;
}
} else {
o = getValue(instance);
if (o == null) {
return null;
}
o = getValue(instance);
sladyn98 marked this conversation as resolved.
Show resolved Hide resolved
if (o == null) {
return null;
}

// In Export we sensitive only those values which do not get rendered as secrets
Expand All @@ -270,14 +263,13 @@ public CNode describe(Owner instance, ConfigurationContext context) throws Confi
}
}


/**
* This function is for the JSONSchemaGeneration
* @param instance Owner Instance
* @param context Context to be passed
* @return CNode object describing the structure of the node
*/
timja marked this conversation as resolved.
Show resolved Hide resolved
public CNode describeStructure(Owner instance, ConfigurationContext context) {
public CNode describeForSchema(Owner instance, ConfigurationContext context) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DescribeStructure would then no longer be needed as the describeForSchema would essentially perform the check.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need the mode var?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would not need it in the describeForSchema anymore because if isJsonSchema is set then it would anyways be calling describeStructure which would in turn call describeForSchema

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok please remove then

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done:+1:


sladyn98 marked this conversation as resolved.
Show resolved Hide resolved
final Configurator c = context.lookup(type);
if (c == null) {
Expand All @@ -291,6 +283,11 @@ public CNode describeStructure(Owner instance, ConfigurationContext context) {
if (o == null) {
return null;
}
} else {
o = getValue(instance);
if (o == null) {
return null;
}
}

// In Export we sensitive only those values which do not get rendered as secrets
Expand All @@ -313,8 +310,7 @@ public CNode describeStructure(Owner instance, ConfigurationContext context) {
+ printThrowable(e));
}
}



/**
* Describes a node.
* @param c Configurator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ default CNode describeStructure(T instance, ConfigurationContext context)
if(context.getMode().equals("JSONSchema")) {
sladyn98 marked this conversation as resolved.
Show resolved Hide resolved
attribute.setJsonSchema(true);
}
CNode value = attribute.describeStructure(instance, context);
CNode value = attribute.describeForSchema(instance, context);
if (value != null) {
mapping.put(attribute.getName(), attribute.getType().getSimpleName());
}
Expand Down