Skip to content

Commit

Permalink
do not override parent id property config if found
Browse files Browse the repository at this point in the history
  • Loading branch information
dikhan committed Sep 20, 2019
1 parent 2750c71 commit 96c7d94
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion openapi/openapi_spec_resource_schema_definition.go
Expand Up @@ -24,12 +24,20 @@ func (s *specSchemaDefinition) createDataSourceSchema() (map[string]*schema.Sche
return nil, err
}
for propertyName := range terraformSchema {
terraformSchema[propertyName] = setPropertyForDataSourceSchema(terraformSchema[propertyName])
// TODO: to be tested
p, err := s.getProperty(propertyName)
if err != nil {
return nil, err
}
if !p.IsParentProperty {
terraformSchema[propertyName] = setPropertyForDataSourceSchema(terraformSchema[propertyName])
}
}
return terraformSchema, nil
}

func setPropertyForDataSourceSchema(inputProperty *schema.Schema) (outputProperty *schema.Schema) {

outputProperty = inputProperty // the output is a clone of the input, do changes on the output var
outputProperty.Required = false
outputProperty.Optional = true
Expand Down

0 comments on commit 96c7d94

Please sign in to comment.