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

Adding a fix for nil pointer issue in converter. #5742

Merged
merged 4 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ func DaprInvokeHttpRouteDataModelFromVersioned(content []byte, version string) (
return nil, err
}
dm, err := am.ConvertTo()
if err != nil {
return nil, err
}
return dm.(*datamodel.DaprInvokeHttpRoute), err

default:
Expand Down
3 changes: 3 additions & 0 deletions pkg/linkrp/datamodel/converter/daprsecretstore_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ func DaprSecretStoreDataModelFromVersioned(content []byte, version string) (*dat
return nil, err
}
dm, err := am.ConvertTo()
if err != nil {
return nil, err
}
return dm.(*datamodel.DaprSecretStore), err

default:
Expand Down
3 changes: 3 additions & 0 deletions pkg/linkrp/datamodel/converter/extender_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ func ExtenderDataModelFromVersioned(content []byte, version string) (*datamodel.
return nil, err
}
dm, err := am.ConvertTo()
if err != nil {
return nil, err
}
return dm.(*datamodel.Extender), err

default:
Expand Down
3 changes: 3 additions & 0 deletions pkg/linkrp/datamodel/converter/mongodatabase_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ func MongoDatabaseDataModelFromVersioned(content []byte, version string) (*datam
return nil, err
}
dm, err := versioned.ConvertTo()
if err != nil {
return nil, err
}
return dm.(*datamodel.MongoDatabase), err

default:
Expand Down
3 changes: 3 additions & 0 deletions pkg/linkrp/datamodel/converter/rabbitmq_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ func RabbitMQMessageQueueDataModelFromVersioned(content []byte, version string)
return nil, err
}
dm, err := versioned.ConvertTo()
if err != nil {
return nil, err
}
return dm.(*datamodel.RabbitMQMessageQueue), err

default:
Expand Down
3 changes: 3 additions & 0 deletions pkg/linkrp/datamodel/converter/rediscache_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ func RedisCacheDataModelFromVersioned(content []byte, version string) (*datamode
return nil, err
}
dm, err := versioned.ConvertTo()
if err != nil {
return nil, err
}
return dm.(*datamodel.RedisCache), err

default:
Expand Down
3 changes: 3 additions & 0 deletions pkg/linkrp/datamodel/converter/sqldatabase_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ func SqlDatabaseDataModelFromVersioned(content []byte, version string) (*datamod
return nil, err
}
dm, err := am.ConvertTo()
if err != nil {
return nil, err
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for checking the others. I was about to ask.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have tests that cover these cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for pointing this out, the invalid tests we had were not covering this case. added tests for this case

return dm.(*datamodel.SqlDatabase), err

default:
Expand Down