Skip to content

key-visibility-required

Full name
@azure-tools/typespec-azure-core/key-visibility-required

Key properties need to have an explicit Lifecycle visibility setting. Use the @visibility decorator to specify the appropriate visibility for key properties. Without explicit visibility, the key property uses default visibility which may not match the intended behavior.

Key property without explicit visibility:

model Foo {
@key
name: string;
}

Key property with explicit Lifecycle.Read visibility:

model Foo {
@key
@visibility(Lifecycle.Read)
name: string;
}