Skip to content

Commit 5484043

Browse files
authored
fix: add required type for AppConfig (#583)
1 parent f553419 commit 5484043

File tree

9 files changed

+50
-33
lines changed

9 files changed

+50
-33
lines changed

.generator/okta-management-APIs-oasv3-noEnums-inheritance.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30023,6 +30023,8 @@ components:
3002330023
type:
3002430024
type: string
3002530025
$ref: '#/components/schemas/AppConfigType'
30026+
required:
30027+
- type
3002630028
discriminator:
3002730029
propertyName: type
3002830030
mapping:

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22
Running changelog of releases since `2.0.0-rc.4`
33

4+
## v6.1.2
5+
- Fix AppConfig by adding required type param. Thanks [@pranav-okta](https://github.com/pranav-okta)
6+
47
## v6.1.1
58
- Fix ListPolicies 200 response. Thanks [@pranav-okta](https://github.com/pranav-okta)
69

okta/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Allows customers to easily access the Okta Management APIs
66
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.
77

88
- API version: 5.1.0
9-
- Package version: 6.1.1
9+
- Package version: 6.1.2
1010
- Build package: org.openapitools.codegen.languages.GoClientCodegen
1111
For more information, please visit [https://developer.okta.com/](https://developer.okta.com/)
1212

okta/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48363,6 +48363,8 @@ components:
4836348363
type: string
4836448364
x-okta-known-values:
4836548365
- ACTIVE_DIRECTORY
48366+
required:
48367+
- type
4836648368
type: object
4836748369
AppConfigActiveDirectory:
4836848370
allOf:

okta/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ var (
6868
)
6969

7070
const (
71-
VERSION = "6.1.0"
71+
VERSION = "6.1.2"
7272
AccessTokenCacheKey = "OKTA_ACCESS_TOKEN"
7373
DpopAccessTokenNonce = "DPOP_OKTA_ACCESS_TOKEN_NONCE"
7474
DpopAccessTokenPrivateKey = "DPOP_OKTA_ACCESS_TOKEN_PRIVATE_KEY"

okta/configuration.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ type Configuration struct {
165165
func NewConfiguration(conf ...ConfigSetter) (*Configuration, error) {
166166
cfg := &Configuration{
167167
DefaultHeader: make(map[string]string),
168-
UserAgent: fmt.Sprintf("okta-sdk-golang/%s golang/%s %s/%s", "6.1.0", runtime.Version(), runtime.GOOS, runtime.GOARCH),
168+
UserAgent: fmt.Sprintf("okta-sdk-golang/%s golang/%s %s/%s", "6.1.2", runtime.Version(), runtime.GOOS, runtime.GOARCH),
169169
Debug: false,
170170
Servers: ServerConfigurations{
171171
{

okta/docs/AppConfig.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
7-
**Type** | Pointer to **string** | The type of the app configuration | [optional]
7+
**Type** | **string** | The type of the app configuration |
88

99
## Methods
1010

1111
### NewAppConfig
1212

13-
`func NewAppConfig() *AppConfig`
13+
`func NewAppConfig(type_ string, ) *AppConfig`
1414

1515
NewAppConfig instantiates a new AppConfig object
1616
This constructor will assign default values to properties that have it defined,
@@ -44,11 +44,6 @@ and a boolean to check if the value has been set.
4444

4545
SetType sets Type field to given value.
4646

47-
### HasType
48-
49-
`func (o *AppConfig) HasType() bool`
50-
51-
HasType returns a boolean if a field has been set.
5247

5348

5449
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

okta/model_app_config.go

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ package okta
2525

2626
import (
2727
"encoding/json"
28+
"fmt"
2829
)
2930

3031
// checks if the AppConfig type satisfies the MappedNullable interface at compile time
@@ -33,7 +34,7 @@ var _ MappedNullable = &AppConfig{}
3334
// AppConfig Additional app configuration for group push mappings. Currently only required for Active Directory.
3435
type AppConfig struct {
3536
// The type of the app configuration
36-
Type *string `json:"type,omitempty"`
37+
Type string `json:"type"`
3738
AdditionalProperties map[string]interface{}
3839
}
3940

@@ -43,8 +44,9 @@ type _AppConfig AppConfig
4344
// This constructor will assign default values to properties that have it defined,
4445
// and makes sure properties required by API are set, but the set of arguments
4546
// will change when the set of required properties is changed
46-
func NewAppConfig() *AppConfig {
47+
func NewAppConfig(type_ string) *AppConfig {
4748
this := AppConfig{}
49+
this.Type = type_
4850
return &this
4951
}
5052

@@ -56,36 +58,28 @@ func NewAppConfigWithDefaults() *AppConfig {
5658
return &this
5759
}
5860

59-
// GetType returns the Type field value if set, zero value otherwise.
61+
// GetType returns the Type field value
6062
func (o *AppConfig) GetType() string {
61-
if o == nil || IsNil(o.Type) {
63+
if o == nil {
6264
var ret string
6365
return ret
6466
}
65-
return *o.Type
67+
68+
return o.Type
6669
}
6770

68-
// GetTypeOk returns a tuple with the Type field value if set, nil otherwise
71+
// GetTypeOk returns a tuple with the Type field value
6972
// and a boolean to check if the value has been set.
7073
func (o *AppConfig) GetTypeOk() (*string, bool) {
71-
if o == nil || IsNil(o.Type) {
74+
if o == nil {
7275
return nil, false
7376
}
74-
return o.Type, true
75-
}
76-
77-
// HasType returns a boolean if a field has been set.
78-
func (o *AppConfig) HasType() bool {
79-
if o != nil && !IsNil(o.Type) {
80-
return true
81-
}
82-
83-
return false
77+
return &o.Type, true
8478
}
8579

86-
// SetType gets a reference to the given string and assigns it to the Type field.
80+
// SetType sets field value
8781
func (o *AppConfig) SetType(v string) {
88-
o.Type = &v
82+
o.Type = v
8983
}
9084

9185
func (o AppConfig) MarshalJSON() ([]byte, error) {
@@ -98,9 +92,7 @@ func (o AppConfig) MarshalJSON() ([]byte, error) {
9892

9993
func (o AppConfig) ToMap() (map[string]interface{}, error) {
10094
toSerialize := map[string]interface{}{}
101-
if !IsNil(o.Type) {
102-
toSerialize["type"] = o.Type
103-
}
95+
toSerialize["type"] = o.Type
10496

10597
for key, value := range o.AdditionalProperties {
10698
toSerialize[key] = value
@@ -110,6 +102,27 @@ func (o AppConfig) ToMap() (map[string]interface{}, error) {
110102
}
111103

112104
func (o *AppConfig) UnmarshalJSON(data []byte) (err error) {
105+
// This validates that all required properties are included in the JSON object
106+
// by unmarshalling the object into a generic map with string keys and checking
107+
// that every required field exists as a key in the generic map.
108+
requiredProperties := []string{
109+
"type",
110+
}
111+
112+
allProperties := make(map[string]interface{})
113+
114+
err = json.Unmarshal(data, &allProperties)
115+
116+
if err != nil {
117+
return err
118+
}
119+
120+
for _, requiredProperty := range requiredProperties {
121+
if _, exists := allProperties[requiredProperty]; !exists {
122+
return fmt.Errorf("no value given for required property %v", requiredProperty)
123+
}
124+
}
125+
113126
varAppConfig := _AppConfig{}
114127

115128
err = json.Unmarshal(data, &varAppConfig)

okta/model_app_config_active_directory.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ type _AppConfigActiveDirectory AppConfigActiveDirectory
5353
// This constructor will assign default values to properties that have it defined,
5454
// and makes sure properties required by API are set, but the set of arguments
5555
// will change when the set of required properties is changed
56-
func NewAppConfigActiveDirectory(distinguishedName string, groupScope string, groupType string, samAccountName string) *AppConfigActiveDirectory {
56+
func NewAppConfigActiveDirectory(distinguishedName string, groupScope string, groupType string, samAccountName string, type_ string) *AppConfigActiveDirectory {
5757
this := AppConfigActiveDirectory{}
58+
this.Type = type_
5859
return &this
5960
}
6061

@@ -201,6 +202,7 @@ func (o *AppConfigActiveDirectory) UnmarshalJSON(data []byte) (err error) {
201202
"groupScope",
202203
"groupType",
203204
"samAccountName",
205+
"type",
204206
}
205207

206208
allProperties := make(map[string]interface{})

0 commit comments

Comments
 (0)