Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutators/Realm issues with decorator that check the list of registered items in the map #5836

Open
timotheeguerin opened this issue Feb 2, 2025 · 0 comments
Labels
compiler:core Issues for @typespec/compiler design:needed A design request has been raised that needs a proposal needs-area triaged:core
Milestone

Comments

@timotheeguerin
Copy link
Member

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.

@markcowl markcowl added design:needed A design request has been raised that needs a proposal compiler:core Issues for @typespec/compiler labels Feb 3, 2025
@markcowl markcowl added this to the Backlog milestone Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:core Issues for @typespec/compiler design:needed A design request has been raised that needs a proposal needs-area triaged:core
Projects
None yet
Development

No branches or pull requests

2 participants