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

init commit to create PR #4

Open
wants to merge 86 commits into
base: typeset_base
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
5475cb6
init commit to create PR
instaclustr-wenbodu Nov 30, 2023
dcf3b6c
add set into terraform schema, be able to convert yaml array+ignore o…
instaclustr-wenbodu Nov 30, 2023
0d0b612
update openapi spec to include typeSet
instaclustr-wenbodu Nov 30, 2023
936da83
update with typeset
instaclustr-wenbodu Dec 4, 2023
958bc47
update with typeset
instaclustr-wenbodu Dec 4, 2023
f4c0816
update with typeset add some logs
instaclustr-wenbodu Dec 5, 2023
d274cb9
update with typeset add some logs
instaclustr-wenbodu Dec 5, 2023
6693154
update with typeset add some logs
instaclustr-wenbodu Dec 5, 2023
5e2e091
update with typeset add some logs
instaclustr-wenbodu Dec 5, 2023
0fa67b2
update with typeset add some logs
instaclustr-wenbodu Dec 5, 2023
db5456a
update with typeset add some logs
instaclustr-wenbodu Dec 5, 2023
90f7105
update to have a hash function
instaclustr-wenbodu Dec 6, 2023
15d1268
update to have a hash function
instaclustr-wenbodu Dec 6, 2023
07104e4
update to have a hash function
instaclustr-wenbodu Dec 6, 2023
c0bde65
update to have a hash function
instaclustr-wenbodu Dec 6, 2023
161dfdf
update to have a hash function
instaclustr-wenbodu Dec 6, 2023
8dd8429
update to have a hash function
instaclustr-wenbodu Dec 6, 2023
37ada4d
update to have a hash function
instaclustr-wenbodu Dec 6, 2023
c563fb3
introduce TypeSet
instaclustr-wenbodu Dec 12, 2023
f29f955
introduce TypeSet
instaclustr-wenbodu Dec 12, 2023
2e44bd5
introduce TypeSet
instaclustr-wenbodu Dec 12, 2023
06a264b
introduce TypeSet
instaclustr-wenbodu Dec 12, 2023
c859a20
introduce TypeSet
instaclustr-wenbodu Dec 12, 2023
71a03cc
introduce TypeSet
instaclustr-wenbodu Dec 12, 2023
28bbc16
introduce TypeSet
instaclustr-wenbodu Dec 12, 2023
2a9f4b7
introduce TypeSet
instaclustr-wenbodu Dec 12, 2023
ec26911
introduce TypeSet
instaclustr-wenbodu Dec 12, 2023
5090a3c
introduce TypeSet
instaclustr-wenbodu Dec 12, 2023
4b4e99e
introduce TypeSet
instaclustr-wenbodu Dec 12, 2023
8155cf4
introduce TypeSet
instaclustr-wenbodu Dec 13, 2023
22f5601
introduce TypeSet
instaclustr-wenbodu Dec 13, 2023
4b77bbd
update
instaclustr-wenbodu Dec 13, 2023
59391b1
update
instaclustr-wenbodu Dec 14, 2023
4c741f3
update
instaclustr-wenbodu Dec 14, 2023
1041f17
update
instaclustr-wenbodu Dec 14, 2023
b641ee0
update
instaclustr-wenbodu Dec 14, 2023
c50c876
update
instaclustr-wenbodu Dec 14, 2023
d120c80
update
instaclustr-wenbodu Dec 14, 2023
e5bcdb3
update
instaclustr-wenbodu Dec 14, 2023
ce1422f
update
instaclustr-wenbodu Dec 14, 2023
b190124
update
instaclustr-wenbodu Dec 14, 2023
fa4c8c0
update
instaclustr-wenbodu Dec 14, 2023
5ef2c2a
update
instaclustr-wenbodu Dec 14, 2023
305ed98
update
instaclustr-wenbodu Dec 14, 2023
9d75dcb
update
instaclustr-wenbodu Dec 14, 2023
361f32e
update
instaclustr-wenbodu Dec 14, 2023
83ad582
update
instaclustr-wenbodu Dec 15, 2023
4b91d8f
update
instaclustr-wenbodu Dec 15, 2023
bb28070
update
instaclustr-wenbodu Dec 15, 2023
bf3a4de
update
instaclustr-wenbodu Dec 17, 2023
9da8981
update
instaclustr-wenbodu Dec 18, 2023
4a1b30a
update
instaclustr-wenbodu Dec 18, 2023
2c70c6e
update
instaclustr-wenbodu Dec 18, 2023
73e944e
update
instaclustr-wenbodu Dec 18, 2023
b1947a2
update a bit
instaclustr-wenbodu Dec 18, 2023
6c0185d
update a bit
instaclustr-wenbodu Dec 18, 2023
7139f93
update a bit
instaclustr-wenbodu Dec 18, 2023
c696efc
update a bit
instaclustr-wenbodu Dec 18, 2023
48768ef
update a bit
instaclustr-wenbodu Dec 18, 2023
0ca9082
update a bit
instaclustr-wenbodu Dec 18, 2023
8538266
update a bit
instaclustr-wenbodu Dec 18, 2023
9c7aa90
update a bit
instaclustr-wenbodu Dec 19, 2023
3127bd3
update a bit
instaclustr-wenbodu Dec 19, 2023
ebea793
update a bit
instaclustr-wenbodu Dec 19, 2023
295c205
update a bit
instaclustr-wenbodu Dec 19, 2023
c6359dc
update a bit
instaclustr-wenbodu Dec 19, 2023
e24548b
update a bit
instaclustr-wenbodu Dec 19, 2023
8ac7ab6
update a bit
instaclustr-wenbodu Dec 19, 2023
2fcd28d
update a bit
instaclustr-wenbodu Dec 19, 2023
e89a50e
update a bit
instaclustr-wenbodu Dec 19, 2023
d06338c
update a bit
instaclustr-wenbodu Dec 19, 2023
8e523f7
update a bit
instaclustr-wenbodu Dec 19, 2023
03d2e12
update a bit
instaclustr-wenbodu Dec 19, 2023
cc5c929
update a bit
instaclustr-wenbodu Dec 19, 2023
a8beb19
update a bit
instaclustr-wenbodu Dec 19, 2023
84814ba
update a bit
instaclustr-wenbodu Dec 19, 2023
4012274
update a bit
instaclustr-wenbodu Dec 19, 2023
c6c4d92
update a bit
instaclustr-wenbodu Dec 19, 2023
acdfe3e
update a bit
instaclustr-wenbodu Dec 19, 2023
b52d8b8
update a bit
instaclustr-wenbodu Dec 19, 2023
fc0938d
update a bit
instaclustr-wenbodu Dec 19, 2023
f706f0c
update a bit
instaclustr-wenbodu Dec 19, 2023
d1a0f28
update a bit
instaclustr-wenbodu Dec 22, 2023
78c259b
introduce typeSet
instaclustr-wenbodu Jan 7, 2024
681091d
introduce typeSet
instaclustr-wenbodu Jan 7, 2024
a0cc970
introduce typeSet
instaclustr-wenbodu Jan 7, 2024
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
Prev Previous commit
Next Next commit
update a bit
  • Loading branch information
instaclustr-wenbodu committed Dec 18, 2023
commit c696efcbd5c0662c4a646b49c23bf9f02e247c6d
1 change: 1 addition & 0 deletions openapi/common.go
Original file line number Diff line number Diff line change
@@ -555,6 +555,7 @@ func convertObjectToLocalStateData(property *SpecSchemaDefinitionProperty, prope
// setResourceDataProperty sets the expectedValue for the given schemaDefinitionPropertyName using the terraform compliant property name
func setResourceDataProperty(schemaDefinitionProperty SpecSchemaDefinitionProperty, value interface{}, resourceLocalData *schema.ResourceData) error {
log.Printf("[INFO] lastValue: %s", value)
log.Printf("[INFO] lastLocalValue: %s", value)
return resourceLocalData.Set(schemaDefinitionProperty.GetTerraformCompliantPropertyName(), value)
}

11 changes: 11 additions & 0 deletions openapi/openapi_spec_resource_schema_definition_property.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package openapi

import (
"bytes"
"fmt"
"github.com/hashicorp/go-cty/cty"
"github.com/hashicorp/terraform-plugin-sdk/helper/hashcode"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"reflect"

@@ -290,6 +292,7 @@ func (s *SpecSchemaDefinitionProperty) terraformSchema() (*schema.Schema, error)
return nil, err
}
terraformSchema.Elem = objectSchema
terraformSchema.Set =

case TypeList:
if isListOfPrimitives, elemSchema := s.isTerraformListOfSimpleValues(); isListOfPrimitives {
@@ -311,6 +314,7 @@ func (s *SpecSchemaDefinitionProperty) terraformSchema() (*schema.Schema, error)
return nil, err
}
terraformSchema.Elem = objectSchema
terraformSchema.Set = hashObject
}
}

@@ -355,6 +359,13 @@ func (s *SpecSchemaDefinitionProperty) terraformSchema() (*schema.Schema, error)
return terraformSchema, nil
}

func hashObject(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
buf.WriteString(fmt.Sprintf("%s-", m["name"].(string)))
return hashcode.String(buf.String())
}

func (s *SpecSchemaDefinitionProperty) validateDiagFunc() schema.SchemaValidateDiagFunc {
return func(v interface{}, p cty.Path) diag.Diagnostics {
_, errs := s.validateFunc()(v, "") // it's not clear what would be the value of k with the new schema.SchemaValidateDiagFunc and whether it can be extracted from the cty.Path