henrikingo commented on PR #93: URL: https://github.com/apache/otava/pull/93#issuecomment-3491383541
This question was in my emails, although it seem to have disappeared from github... > I have a question about the scope of this PR. Converting classes to Pydantic BaseModel requires changing the initialization syntax from positional arguments to keyword arguments. '''python Before Metric(1, 1.0) After (Pydantic) Metric(direction=1, scale=1.0) ''' > This affects: > Test code (which I can update) > External users who depend on otava > I want to make sure I'm following the intended migration path. Thanks! Hmm... Good catch ... Ok so testing and googling a little myself, I learn that if we want to preserve backward compatibility, maybe you should look into https://docs.pydantic.dev/1.10/usage/dataclasses/ Now that 0.7.0 release is already in the owen... Let me also repeat that if we just wait past that release, there's no need to maintain any backward compatibility. Instead, we can discuss about what is our preferred way to maintain these data models? For example, my personal view would be: * The main goal of this ticket is to get rid of the to_json() and from_json() methods and replace them with some standard utility class. * As of keeping Metric(1,1.0) working, I'm lazy, so less typing is welcome. * Speaking purely subjectively, I'm not a big fan of creating any classes for data that could have been just a dict. (The dict could of course be wrapped in a class that provides type information and get/set accessors.) But I assume this is a minority view so I'm not pushing it strongly. I'll now look into your other questions and re-review what changed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
