[go: up one dir, main page]

BsonContext rework

Since the start of the project, BsonContext has been the main entry-point. BsonContext was initially placed in :bson because it represented the concept of "creating a BSON document". Everything in :dsl and in the drivers uses BsonContext, so it also became the "configuration class".

In !80 (merged), ObjectIdGenerator was added to BsonContext, as it is a "configuration" that needs to be available from everywhere.

In !151 (merged), PropertyNameStrategy was added to BsonContext, as it is a "configuration" that needs to be available from everywhere.

However, this has a few downsides:

  • BsonContext originally had the single concern of "generating BSON documents". It now also acts as a service locator.
  • PropertyNameStrategy has nothing to do in :bson, and it would be much better in :dsl where it would have access to Path. However, since BsonContext is in :bson, it has to be there too.

This MR splits BsonContext into two:

  • BsonFactory remains in :bson and has the single concern of generation BSON documents & arrays.
  • BsonContext is moved to :dsl and has the single concern of holding services.

Additionally, PropertyNameStrategy is moved to :dsl and migrated to Path.

This refactor is quite big, but it shouldn't impact users of the high-level API other than maybe some imports renames.

Closes #95 (closed)

Edited by Ivan “CLOVIS” Canet

Merge request reports

Loading