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

Clarify model class fields interface regarding mandatory / optional / default values #44

Open
laurentg opened this issue Jun 15, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@laurentg
Copy link
Member

laurentg commented Jun 15, 2020

The model classes is our internal main reference regarding the specification of optional/mandatory fields. Currently we uses Optional<T> when a field is marked as optional in the specs, with another getter supplying by design a non-null value with a default. However Optional is better understood in language context, and since we are inside a validator, even mandatory value can be null.

We should clarify how to model the following:

  • Mandatory values:
    • that cannot be null by design, such as a mandatory ID in DAO scope. Example: stop time trip ID.
    • that can be null for invalid input data:
      • without a sensible default to use by a validator. Example: stop name
      • with a sensible default to use by a validator. Example: route type, in speed checks we can fallback on a default type to get the max speed
  • Optional values:
    • that have a default value provided by the specs. Example: timepoint, pickup/dropoff type, route colors...
    • that do not have a default value provided by the specs:
      • with a sensible default value that can be used by validators. Example: ?
      • without a sensible default value that can be used by validators. Here a null is valid. Example: route URL.
  • Conditionally required, for example stop name (where boarding areas or generic nodes make it optional), parent_station...

Maybe creating dedicated holders such as Optional<T>, for example Required<T> etc...

@laurentg laurentg added the enhancement New feature or request label Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant