microsoft / microsoft/typespec
Mutators/Realm issues with decorator that check the list of registered items in the map
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
```ts
export const $armProviderNamespace: ArmProviderNamespaceDecorator = (
context: DecoratorContext,
entity: Namespace,
armProviderNamespace?: string,
) => {
const { program } = context;
const override = isArmNamespaceOverride(program, entity);
const namespaceCount = program.stateMap(ArmStateKeys.armProviderNamespaces).size;
if (namespaceCount > 0 && !override) {
reportDiagnostic(program, {
code: "single-arm-provider",
target: context.decoratorTarget,
});
return;
}
}
```
with a decorator like that when it runs again in the mutated subgraph it will fail because it already finds one, the decorator doesn't take into account the current realm.
Contributor guide
Assessment
This issue has not been assessed yet.