Skip to content

Update feature definition returned from ConfigurationFeatureDefinitionProvider to allow determining if properties have been specifically configured #559

@brental

Description

@brental

I am looking at creating a decorator for IFeatureDefinitionProvider that will apply defaults for a feature if it's feature definition is not contained in configuration or if it is configured but does not have certain properties (such as telemetry) set in its configuration. The ConfigurationFeatureDefinitionProvider currently returns null if the feature is not configured which allows applying defaults in that case. However, if it is in configuration but does not contain values for certain properties those properties are still set. This makes it hard to apply defaults in those cases.

As an example, if the configuration for a feature does not contain telemetry configuration then the Telemetry property is still initialised to a non null. This makes it impossible to tell whether telemetry was specifically configured or just had default values once the decorator has got the feature definition from the ConfigurationFeatureDefinitionProvider. So, would it be possible to update the ConfigurationFeatureDefinitionProvider to not set properties if they arent configured? The feature manager classes seem to handle nulls on nullable feature definition properties so it shouldnt break that functionality, but the change could be done based on a new ConfigurationFeatureDefinitionProviderOption to avoid any breaking changes in behaviour (make it opt in).

The properties that would potentially be useful to set to null if not configured are:

  • Allocation (although this looks like it is already null if not configured)
  • Variants (currently defaults to empty list)
  • Telemetry (currently non null and has default values for each property)

This obviously wouldnt guarantee that behaviour for all IFeatureDefinitionProvider implementations, but we would only be decorating the ConfigurationFeatureDefinitionProvider implementation at the moment. We could also make it clear on the expected behaviour of decorated IFeatureDefinitionProvider implementations when using the decorator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions