Problem
Parameter extraction (SchemaProperties.ExtractPrimitiveProperties) is intentionally
shallow: top-level scalars and scalar arrays only; nested complex types are skipped.
passwordProfile is the one hard-coded exception (SchemaProperties.HasPasswordProfile)
because Graph requires it to create a user — without the flattened -Password /
-ForceChangePasswordNextSignIn parameters, New-MgUser would be unusable. As the only
known required complex type it's a reasonable special case today, but if other types
need the same treatment, copying the pattern one-off each time becomes accidental
technical debt.
Possible path forward
- Survey Graph schemas for complex-type properties that are required (or required in
practice) on POST/PATCH bodies, to size the real problem before designing.
- Replace the hard-coded check with a data-driven mechanism — e.g. a checked-in table in
the style of NamingOverrides mapping type/property → flattened parameters, or a
general "flatten one level of a required complex type's scalar properties" rule.
- Define a collision rule for when a flattened name clashes with a top-level property.
Problem
Parameter extraction (
SchemaProperties.ExtractPrimitiveProperties) is intentionallyshallow: top-level scalars and scalar arrays only; nested complex types are skipped.
passwordProfileis the one hard-coded exception (SchemaProperties.HasPasswordProfile)because Graph requires it to create a user — without the flattened
-Password/-ForceChangePasswordNextSignInparameters,New-MgUserwould be unusable. As the onlyknown required complex type it's a reasonable special case today, but if other types
need the same treatment, copying the pattern one-off each time becomes accidental
technical debt.
Possible path forward
practice) on POST/PATCH bodies, to size the real problem before designing.
the style of
NamingOverridesmapping type/property → flattened parameters, or ageneral "flatten one level of a required complex type's scalar properties" rule.