Skip to content

Commit

Permalink
importer-msgraph-metadata: fix bug that generated constant fields wit…
Browse files Browse the repository at this point in the history
…hout first checking for array
  • Loading branch information
manicminer committed Aug 14, 2024
1 parent c3a1f02 commit 7f663b6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tools/importer-msgraph-metadata/components/parser/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,6 @@ type ModelField struct {
}

func (f ModelField) DataApiSdkObjectDefinition(models Models) (*sdkModels.SDKObjectDefinition, error) {
if f.ConstantName != nil {
return &sdkModels.SDKObjectDefinition{
Nullable: f.Nullable,
ReferenceName: f.ConstantName,
Type: sdkModels.ReferenceSDKObjectDefinitionType,
}, nil
}

if f.Type == nil {
return nil, fmt.Errorf("field %q has no Type", f.Title)
}
Expand Down Expand Up @@ -251,6 +243,14 @@ func (f ModelField) DataApiSdkObjectDefinition(models Models) (*sdkModels.SDKObj
return nil, nil
}

if f.ConstantName != nil {
return &sdkModels.SDKObjectDefinition{
Nullable: f.Nullable,
ReferenceName: f.ConstantName,
Type: sdkModels.ReferenceSDKObjectDefinitionType,
}, nil
}

return &sdkModels.SDKObjectDefinition{
Nullable: f.Nullable,
Type: f.Type.DataApiSdkObjectDefinitionType(),
Expand Down

0 comments on commit 7f663b6

Please sign in to comment.