From 96c7d942dba96e0251f9affedc12bb8467d456a6 Mon Sep 17 00:00:00 2001 From: dikhan Date: Fri, 20 Sep 2019 11:22:52 -0700 Subject: [PATCH] do not override parent id property config if found --- openapi/openapi_spec_resource_schema_definition.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/openapi/openapi_spec_resource_schema_definition.go b/openapi/openapi_spec_resource_schema_definition.go index 7f60c2446..d5cc6b7ca 100644 --- a/openapi/openapi_spec_resource_schema_definition.go +++ b/openapi/openapi_spec_resource_schema_definition.go @@ -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