Skip to content

PQA032 — Property type does not resolve to a known type

A property type: names something that is neither a primitive, a device type of this adapter, nor a public enum.

A property type is resolved by name. The generator tries, in order: a primitive (int, string, host, …), a type_id declared in the same adapter (which makes the property a device reference), and a public enum reachable from the project. When none of them matches, the property is emitted as object.

connection_mode:
  type: ConnectionMod        # the enum is ConnectionMode
  default: "Server"
// what the generator emits
public object? ConnectionMode { get; set; }

Why the build refuses this

An object property is unusable, and nothing says so. The YAML looks right, the build is green, and the first sign of trouble is a type error somewhere else entirely — in hand-written code that assigned the property to its real type, two files away from the typo.

Name-based binding needs a name check. A closed set of values is expressed as a C# enum referenced by name from YAML. That binding has no compiler behind it: nothing else in the build compares the two sides. This diagnostic is that comparison.

The usual causes are invisible on inspection. A misspelling, an enum declared internal rather than public, or an enum living in a project this adapter does not reference — all three read as correct YAML.

How to fix it

Declare the enum as public and spell the type exactly as in C#.

namespace MyAdapter.Definitions;

/// <summary>
/// Connection mode.
/// </summary>
public enum ConnectionMode
{
    /// <summary>
    /// Adapter connects to the panel.
    /// </summary>
    Server,

    /// <summary>
    /// Panel connects to the adapter.
    /// </summary>
    Client,
}
connection_mode:
  type: ConnectionMode
  default: Server

Namespace is not part of the reference — the generator searches the whole compilation plus the framework assembly for a public enum of that name.

What is not reported

type: enum with a values: list. It generates a string, which is a real type. It belongs to access profile fields, where no adapter C# type backs the value; device properties use a named enum.

A device reference. A type matching a type_id of this adapter resolves to that Thing class, single (Door) or array (Partition[]).

Semantic string types. card_format and holiday_calendar carry framework meaning and store as strings.

If you disagree with a report

Do not suppress it. A wrong report is a bug in the check — report it with the YAML that triggered it.