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

Serialiser_Engine: Fix issue with classmaps of inner generic types #2724

Merged

Conversation

IsakNaslundBh
Copy link
Contributor

@IsakNaslundBh IsakNaslundBh commented Jan 5, 2022

Issues addressed by this PR

Closes #2722

Adding ClassMapConvetion to correctly set properties of class maps registered outside the compute method.

See issue for more details as to why this is required.

Could also have a think if we should change how those settings are handled in general by removing all the settings in the compute method RegisterClassMap and change it so that all objects make use of this added ClassMapConvention instead, to ensure that all objects get these settings, independent on what registered their class map.

Would be a quite small change code wise, but tried to disrupt as little as possible with this PR.

@adecler if you have any other suggestion for how this can be handled better, I would be up to changing what ever is needed.

EDIT: After chat with @adecler decided that updating the code so the convention is applied to every single class map gives a cleaner solution. By doing this, the same calls made in the compute method is now redundant and has hence been removed.

Test files

https://burohappold.sharepoint.com/:f:/s/BHoM/EkaZJA6Qzr1Krl472i5JiWEB0wzyDhfPmrKhI200c0EFvQ?e=Jgm5LR

Changelog

  • Add convention for handling settings of all BSONClassMaps

Additional comments

🤦‍♂️ forgot the issue number in the branch name. If this is a problem I will re-raise..

@IsakNaslundBh IsakNaslundBh added the type:bug Error or unexpected behaviour label Jan 5, 2022
@IsakNaslundBh IsakNaslundBh self-assigned this Jan 5, 2022
Copy link
Member

@adecler adecler left a comment

Choose a reason for hiding this comment

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

I am happy with the solution proposed here. Fixes the problem nicely without creating other issues (that I could find).

Only thing I would change is the name of the class from BHoMDefaultClassMapConvention to something like GenericClassMapConvention to make it clearer what it does.

@IsakNaslundBh
Copy link
Contributor Author

I am happy with the solution proposed here. Fixes the problem nicely without creating other issues (that I could find).

Only thing I would change is the name of the class from BHoMDefaultClassMapConvention to something like GenericClassMapConvention to make it clearer what it does.

Yes, happy to change to that. Called it something like that first, but change the name when I realised that this really could be applied to all classes, but agree that with current setup that name is better. Will update!

Need to find a more proper way of testing this that ensures the reversed order of classmap serialisation is guarantiued to always work.
UnitTest is to fragile and might give a false sense of security
Changing strategy to use the new BHoMDefaultClassMapConvention for all classmaps and puting it in the default BHoM pack. The settings are also removed from the compute method and now handled by the convention for all cases instead.
@IsakNaslundBh
Copy link
Contributor Author

@BHoMBot check serialisation
@BHoMBot check versioning

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 7, 2022

@IsakNaslundBh to confirm, the following checks are now queued:

  • serialisation
  • versioning

@IsakNaslundBh
Copy link
Contributor Author

@adecler found some issues with some objects, namely the system DataTable class on the BHoM Table class when I applied the class map to everything. Hence added in the class map convention that it should only be applied to IObjects.

Let me know if you think this is not enough.

What we can do is to keep this new class map convention as is, but also keep the settings in the compute class. It will ofc be doubling up things, but might be a way out.

I am also happy to revert this PR to what it was initially, just fixing the inner generic types, if you think that is better.

@IsakNaslundBh
Copy link
Contributor Author

@BHoMBot check serialisation
@BHoMBot check versioning

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 7, 2022

@IsakNaslundBh to confirm, the following checks are now queued:

  • serialisation
  • versioning

@adecler
Copy link
Member

adecler commented Jan 10, 2022

@IsakNaslundBh , let have another catch-up on this.

Problem seem to stem from different versions of DataTable used by Engine and Test_Toolkit (netstandard vs framework 4.7.2) and does not have anything to do with Serialisation of the objects themselves. Need to find a proper fix for it, and that is not to filter by IObject here.
@IsakNaslundBh
Copy link
Contributor Author

@BHoMBot check serialisation
@BHoMBot check versioning

1 similar comment
@IsakNaslundBh
Copy link
Contributor Author

@BHoMBot check serialisation
@BHoMBot check versioning

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 10, 2022

@IsakNaslundBh to confirm, the following checks are now queued:

  • serialisation
  • versioning

There are 25 requests in the queue ahead of you.

@IsakNaslundBh
Copy link
Contributor Author

@BHoMBot check required

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 10, 2022

@IsakNaslundBh to confirm, the following checks are now queued:

  • code-compliance
  • documentation-compliance
  • project-compliance
  • core
  • null-handling
  • serialisation
  • installer
  • versioning

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 10, 2022

The check serialisation has already been run previously and recorded as a successful check. This check has not been run again at this time.

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 10, 2022

The check versioning has already been run previously and recorded as a successful check. This check has not been run again at this time.

@FraserGreenroyd
Copy link
Contributor

@BHoMBot check copyright-compliance
@BHoMBot check dataset-compliance

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 10, 2022

@FraserGreenroyd to confirm, the following checks are now queued:

  • copyright-compliance
  • dataset-compliance

There are 3 requests in the queue ahead of you.

Copy link
Contributor

@FraserGreenroyd FraserGreenroyd left a comment

Choose a reason for hiding this comment

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

From my understanding of discussion with @IsakNaslundBh this is ok to merge today to unblock work on migrating stuff from Reflection_Engine to Base_Engine, following this mornings conversation between @IsakNaslundBh and @adecler .

The checks are happy with this PR on serialisation, so further eyes will be kept out on changes there. @adecler if you could check over the files changed from @IsakNaslundBh last commit, and if there are any issues with them, please raise new issues so they can be tackled ASAP.

Thanks both!

@FraserGreenroyd
Copy link
Contributor

@BHoMBot check ready-to-merge

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 10, 2022

@FraserGreenroyd to confirm, the following checks are now queued:

  • ready-to-merge

There are 7 requests in the queue ahead of you.

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 10, 2022

FAO: @FraserGreenroyd
@FraserGreenroyd is seeking dispensation on this Pull Request to skip a required check. Please can you provide authorisation for the check to be skipped, or provide assistance as appropriate.

The check they wish to have dispensation on is documentation-compliance.

If you are providing dispensation on this occasion, please reply with:

@BHoMBot this is a DevOps instruction. I am authorising dispensation to be granted on check ref. 4760430000

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 10, 2022

FAO: @FraserGreenroyd
@FraserGreenroyd is seeking dispensation on this Pull Request to skip a required check. Please can you provide authorisation for the check to be skipped, or provide assistance as appropriate.

The check they wish to have dispensation on is code-compliance.

If you are providing dispensation on this occasion, please reply with:

@BHoMBot this is a DevOps instruction. I am authorising dispensation to be granted on check ref. 4760429546

@FraserGreenroyd
Copy link
Contributor

FraserGreenroyd commented Jan 10, 2022

@BHoMBot this is a DevOps instruction. I am authorising dispensation to be granted on check ref. 4760430000

@FraserGreenroyd
Copy link
Contributor

@BHoMBot this is a DevOps instruction. I am authorising dispensation to be granted on check ref. 4760429546

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 10, 2022

@FraserGreenroyd I have now provided a passing check on reference 4760429546 as requested.

@bhombot-ci
Copy link

bhombot-ci bot commented Jan 10, 2022

@FraserGreenroyd I have now provided a passing check on reference 4760430000 as requested.

@FraserGreenroyd FraserGreenroyd merged commit 5d921c3 into main Jan 10, 2022
@FraserGreenroyd FraserGreenroyd deleted the Serialiser_Engine-FixClassMapsOfInnerGenericObejcts branch January 10, 2022 11:42
@adecler
Copy link
Member

adecler commented Jan 11, 2022

@adecler if you could check over the files changed from @IsakNaslundBh last commit, and if there are any issues with them, please raise new issues so they can be tackled ASAP.

@FraserGreenroyd , I am happy with the last commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Error or unexpected behaviour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serialiser_Engine: Issue with classmaps of Generic types
3 participants