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

fix!: deserialization of former required field #1885

Draft
wants to merge 211 commits into
base: master
Choose a base branch
from

Conversation

shumkov
Copy link
Member

@shumkov shumkov commented Jun 13, 2024

Issue being fixed or feature implemented

Data Contract Update functionality allows developers to make previously required fields optional. This is required for application model evolution in case a developer wants to deprecate an old field so clients don't need to provide a value for this field. For example, a developer needs to change the field type. He/she needs to create a new field with a new type and mark the old field as optional (not required).

Currently, document serialization logic doesn't use the marker of presence for fields that are marked as required. Since the required flag can be removed with the data contract update, such serialized data becomes invalid.

What was done?

  • Serialize all document fields with the marker of presence.
  • Expect a marker of presence during deserialization.

How Has This Been Tested?

  • Implemented a test when we serialize a document with the old schema, then update the schema and successfully deserialize the document.
  • Implemented an integration test when we create a contract with required system fields, create a document, then update a contract and the previously created document is correctly deserialized. Then we update the document created with previous contract with updated contract and it works correctly as well. Creation of a new document with updated contract works as expected.

Breaking Changes

Previously serialized documents with required fields won't be valid.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

lklimek and others added 30 commits November 27, 2023 12:53
Co-authored-by: Odysseas Gabrielides <[email protected]>
Co-authored-by: Ivan Shumkov <[email protected]>
Co-authored-by: Odysseas Gabrielides <[email protected]>
Co-authored-by: Ivan Shumkov <[email protected]>
QuantumExplorer and others added 20 commits May 21, 2024 10:53
@shumkov shumkov added this to the v1.0.0 milestone Jun 13, 2024
@QuantumExplorer
Copy link
Contributor

We decided to postpone this till after release, for now required fields can not change to optional.

@QuantumExplorer QuantumExplorer marked this pull request as draft July 1, 2024 13:54
@shumkov shumkov changed the base branch from v1.0-dev to master August 25, 2024 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants