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

Fix generator to accomodate array types #435

Merged
merged 2 commits into from
Apr 25, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
16 changes: 10 additions & 6 deletions generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,16 @@ func findDefaults(schema *datautils.JSONObject) *datautils.JSONObject {
results := &datautils.JSONObject{}
for key := range *props {
property := props.GetObj(key)
if property.HasKey("type") &&
property.GetS("type") == "object" &&
property.HasKey("properties") {
// Add the child defaults to the template.
childResults := findDefaults(property)
(*results)[key] = childResults
if property.HasKey("type") {
switch (*property)["type"].(type) {
case string:
if property.GetS("type") == "object" &&
property.HasKey("properties") {
// Add the child defaults to the template.
childResults := findDefaults(property)
(*results)[key] = childResults
}
}
}
if property.HasKey("default") {
(*results)[key] = (*property)["default"]
Expand Down
Loading