From 45c579af63ff9100811bacbefb739331d14872a6 Mon Sep 17 00:00:00 2001 From: Raghd Hamzeh Date: Fri, 13 Oct 2023 12:26:59 -0400 Subject: [PATCH 1/2] chore: cleanup models --- model_assertion.go | 8 ++------ model_authorization_model.go | 4 +--- model_check_request.go | 4 +--- model_contextual_tuple_keys.go | 4 +--- model_create_store_request.go | 4 +--- model_difference.go | 8 ++------ model_expand_request.go | 4 +--- model_list_objects_request.go | 12 +++--------- model_relation_reference.go | 4 +--- model_tuple_keys.go | 4 +--- model_type_definition.go | 4 +--- model_write_assertions_request.go | 4 +--- model_write_authorization_model_request.go | 4 +--- 13 files changed, 17 insertions(+), 51 deletions(-) diff --git a/model_assertion.go b/model_assertion.go index 1239cf9..80e8b64 100644 --- a/model_assertion.go +++ b/model_assertion.go @@ -91,12 +91,8 @@ func (o *Assertion) SetExpectation(v bool) { func (o Assertion) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if true { - toSerialize["tuple_key"] = o.TupleKey - } - if true { - toSerialize["expectation"] = o.Expectation - } + toSerialize["tuple_key"] = o.TupleKey + toSerialize["expectation"] = o.Expectation return json.Marshal(toSerialize) } diff --git a/model_authorization_model.go b/model_authorization_model.go index d8ea6d1..ec3aa2d 100644 --- a/model_authorization_model.go +++ b/model_authorization_model.go @@ -134,9 +134,7 @@ func (o AuthorizationModel) MarshalJSON() ([]byte, error) { if o.Id != nil { toSerialize["id"] = o.Id } - if true { - toSerialize["schema_version"] = o.SchemaVersion - } + toSerialize["schema_version"] = o.SchemaVersion if o.TypeDefinitions != nil { toSerialize["type_definitions"] = o.TypeDefinitions } diff --git a/model_check_request.go b/model_check_request.go index 78f5326..0918e12 100644 --- a/model_check_request.go +++ b/model_check_request.go @@ -165,9 +165,7 @@ func (o *CheckRequest) SetTrace(v bool) { func (o CheckRequest) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if true { - toSerialize["tuple_key"] = o.TupleKey - } + toSerialize["tuple_key"] = o.TupleKey if o.ContextualTuples != nil { toSerialize["contextual_tuples"] = o.ContextualTuples } diff --git a/model_contextual_tuple_keys.go b/model_contextual_tuple_keys.go index 7a36ed4..e9e4302 100644 --- a/model_contextual_tuple_keys.go +++ b/model_contextual_tuple_keys.go @@ -65,9 +65,7 @@ func (o *ContextualTupleKeys) SetTupleKeys(v []TupleKey) { func (o ContextualTupleKeys) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if true { - toSerialize["tuple_keys"] = o.TupleKeys - } + toSerialize["tuple_keys"] = o.TupleKeys return json.Marshal(toSerialize) } diff --git a/model_create_store_request.go b/model_create_store_request.go index b5b0395..7814527 100644 --- a/model_create_store_request.go +++ b/model_create_store_request.go @@ -65,9 +65,7 @@ func (o *CreateStoreRequest) SetName(v string) { func (o CreateStoreRequest) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if true { - toSerialize["name"] = o.Name - } + toSerialize["name"] = o.Name return json.Marshal(toSerialize) } diff --git a/model_difference.go b/model_difference.go index 1306106..8875a82 100644 --- a/model_difference.go +++ b/model_difference.go @@ -91,12 +91,8 @@ func (o *Difference) SetSubtract(v Userset) { func (o Difference) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if true { - toSerialize["base"] = o.Base - } - if true { - toSerialize["subtract"] = o.Subtract - } + toSerialize["base"] = o.Base + toSerialize["subtract"] = o.Subtract return json.Marshal(toSerialize) } diff --git a/model_expand_request.go b/model_expand_request.go index 3a77915..c054b79 100644 --- a/model_expand_request.go +++ b/model_expand_request.go @@ -98,9 +98,7 @@ func (o *ExpandRequest) SetAuthorizationModelId(v string) { func (o ExpandRequest) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if true { - toSerialize["tuple_key"] = o.TupleKey - } + toSerialize["tuple_key"] = o.TupleKey if o.AuthorizationModelId != nil { toSerialize["authorization_model_id"] = o.AuthorizationModelId } diff --git a/model_list_objects_request.go b/model_list_objects_request.go index 8c0d51c..e80e3b1 100644 --- a/model_list_objects_request.go +++ b/model_list_objects_request.go @@ -186,15 +186,9 @@ func (o ListObjectsRequest) MarshalJSON() ([]byte, error) { if o.AuthorizationModelId != nil { toSerialize["authorization_model_id"] = o.AuthorizationModelId } - if true { - toSerialize["type"] = o.Type - } - if true { - toSerialize["relation"] = o.Relation - } - if true { - toSerialize["user"] = o.User - } + toSerialize["type"] = o.Type + toSerialize["relation"] = o.Relation + toSerialize["user"] = o.User if o.ContextualTuples != nil { toSerialize["contextual_tuples"] = o.ContextualTuples } diff --git a/model_relation_reference.go b/model_relation_reference.go index 2d901b1..e3ac5da 100644 --- a/model_relation_reference.go +++ b/model_relation_reference.go @@ -131,9 +131,7 @@ func (o *RelationReference) SetWildcard(v map[string]interface{}) { func (o RelationReference) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if true { - toSerialize["type"] = o.Type - } + toSerialize["type"] = o.Type if o.Relation != nil { toSerialize["relation"] = o.Relation } diff --git a/model_tuple_keys.go b/model_tuple_keys.go index 3a1aedd..f2b8dd1 100644 --- a/model_tuple_keys.go +++ b/model_tuple_keys.go @@ -65,9 +65,7 @@ func (o *TupleKeys) SetTupleKeys(v []TupleKey) { func (o TupleKeys) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if true { - toSerialize["tuple_keys"] = o.TupleKeys - } + toSerialize["tuple_keys"] = o.TupleKeys return json.Marshal(toSerialize) } diff --git a/model_type_definition.go b/model_type_definition.go index 611e90d..b09752d 100644 --- a/model_type_definition.go +++ b/model_type_definition.go @@ -131,9 +131,7 @@ func (o *TypeDefinition) SetMetadata(v Metadata) { func (o TypeDefinition) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if true { - toSerialize["type"] = o.Type - } + toSerialize["type"] = o.Type if o.Relations != nil { toSerialize["relations"] = o.Relations } diff --git a/model_write_assertions_request.go b/model_write_assertions_request.go index 1e848f8..52c0435 100644 --- a/model_write_assertions_request.go +++ b/model_write_assertions_request.go @@ -65,9 +65,7 @@ func (o *WriteAssertionsRequest) SetAssertions(v []Assertion) { func (o WriteAssertionsRequest) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if true { - toSerialize["assertions"] = o.Assertions - } + toSerialize["assertions"] = o.Assertions return json.Marshal(toSerialize) } diff --git a/model_write_authorization_model_request.go b/model_write_authorization_model_request.go index b25570d..84f04a7 100644 --- a/model_write_authorization_model_request.go +++ b/model_write_authorization_model_request.go @@ -98,9 +98,7 @@ func (o *WriteAuthorizationModelRequest) SetSchemaVersion(v string) { func (o WriteAuthorizationModelRequest) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if true { - toSerialize["type_definitions"] = o.TypeDefinitions - } + toSerialize["type_definitions"] = o.TypeDefinitions if o.SchemaVersion != nil { toSerialize["schema_version"] = o.SchemaVersion } From 9a204b361538e0c221aa8ac834a5f8cd672e89cf Mon Sep 17 00:00:00 2001 From: Raghd Hamzeh Date: Fri, 13 Oct 2023 12:27:27 -0400 Subject: [PATCH 2/2] release(v0.2.3): with various client fixes --- CHANGELOG.md | 12 ++++++++++++ configuration.go | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fc7cbd..cbc0cd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## v0.2.3 + +### [0.2.3](https://github.com/openfga/go-sdk/compare/v0.2.2...v0.2.3) (2023-10-13) + +- fix: allow setting user agent +- fix(client): resolve null pointer exceptions when getting auth model id +- fix(client): allow read to contain empty fields +- fix(client): require auth model id and store id to be ulids +- fix(client): resolve cases where req options was not respected +- fix: add retry logic to oauth +- chore: target go1.21.3 and upgrade dependencies + ## v0.2.2 ### [0.2.2](https://github.com/openfga/go-sdk/compare/v0.2.1...v0.2.2) (2023-04-21) diff --git a/configuration.go b/configuration.go index 71d54f2..5047324 100644 --- a/configuration.go +++ b/configuration.go @@ -20,9 +20,9 @@ import ( ) const ( - SdkVersion = "0.2.2" + SdkVersion = "0.2.3" - defaultUserAgent = "openfga-sdk go/0.2.2" + defaultUserAgent = "openfga-sdk go/0.2.3" ) // RetryParams configures configuration for retry in case of HTTP too many request