-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Problem
The value field of ConfigProperty instances returned from methods such as ConfigurationControllerApi#readConfiguration(String) and ConfigurationControllerApi#getConfiguration() is always null.
For example, executing this Groovy script:
new ConfigurationControllerApi(client)
.getData()
.getProperties()
.stream()
.forEach{ println("${it.name}:${it.value}") }will output:
auditassistant.enabled:null
auditassistant.auth.token:null
...
x509.enabled:null
x509.username.pattern:null
I have attached a full Groovy script which demonstrates this issue.
Proposed Solution
Looking at the generated code, it appears this issue is being caused by an erroneous enum in the ConfigProperty model of spec.json. The relevant JSON snippet being:
"ConfigProperty": {
"properties": {
"value": {
"type": "string",
"description": "Configuration property value.",
"enum": [
"Depends on property type. It can be number",
"string",
"URL",
"email or value from values list."
]
}
}
}The value field has an enum constraint which appears to contain a description rather than allowable values. Because of this, the value field of the ConfigProperty class is being generated as an enum rather than a String. Since value is an enum, the API client is parsing the value returned by SSC as null since it does not match any items in the enum.
Removing the enum constraint from the spec.json file should fix this; however, I'm assuming the spec file in this repo was generated by SSC so only fixing it here would mean this would continue to be a problem for anyone generating their own client from SSC. A fix probably needs to be made to SSC as well.