NCIOCPL / drug-dictionary-api

NCI Drug Dictionary API
0 stars 3 forks source link

Enabler: Review use of properties in models #58

Closed blairlearn closed 1 year ago

blairlearn commented 3 years ago

Review all models to make sure serialized values are exposed as properties instead of fields.

Review the classes in src/NCI.OCPL.Api.DrugDictionary/Models. All values intended to be serialized out should be written as properties with getters and setters, not as public fields.

This is right

    public class Poco
    {
        public string StringProp { get; set; }
        public int IntProp { get; set; }
    }

This is wrong

    public class MyClass
    {
        public string StringProp;
        public int IntProp;
    }

The difference (aside from best practices) is that System.Text.Json doesn't serialize public fields. This will eventually hurt us.

ESTIMATE TBD

Resources:

Prerequisites

Sub-Tasks

Notes