[SERVER-34882] Support creating instances with all required fields in IDL Created: 08/May/18  Updated: 29/Oct/23  Resolved: 14/Sep/18

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 4.1.4

Type: New Feature Priority: Major - P3
Reporter: Siyuan Zhou Assignee: Mark Benvenuto
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Security 2018-09-10, Security 2018-09-24
Participants:

 Description   

IDL enforces required fields to be present when serializing into BSON. However IDL is also used internally without serialization. Developers usually want to enforce all required fields are specified when creating an instance. Currently, we have functions to enforce them manually. OplogEntry is an example. Otherwise, we forgot some fields sometimes. It would be nice if the IDL can provide a way to enforce that. It could be either a constructor or a static factory function.



 Comments   
Comment by Githook User [ 14/Sep/18 ]

Author:

{'name': 'Mark Benvenuto', 'email': 'mark.benvenuto@mongodb.com', 'username': 'markbenvenuto'}

Message: SERVER-34882 Support creating instances with all required fields in IDL
Branch: master
https://github.com/mongodb/mongo/commit/5603a0812eb64c8009a514a3c59182f7f7134b9e

Comment by Siyuan Zhou [ 30/Aug/18 ]

FWIW, we will need to build an IDL instance progressively in SERVER-36570, so an alternative / relevant solution is to add a validation function, which will be implemented for OplogEntry by SERVER-36570 anyway.

Generated at Thu Feb 08 04:38:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.