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

Scenarios does not support assert diagnostics #2924

Open
v-jiaodi opened this issue Nov 22, 2024 · 0 comments
Open

Scenarios does not support assert diagnostics #2924

v-jiaodi opened this issue Nov 22, 2024 · 0 comments
Assignees
Labels
HRLC P1 priority 1

Comments

@v-jiaodi
Copy link
Member

eg: https://github.com/Azure/autorest.typescript/blob/main/packages/typespec-ts/test/modularUnit/modelsGenerator.spec.ts#L2366
https://github.com/Azure/autorest.typescript/blob/main/packages/typespec-ts/test/modularUnit/operations.spec.ts#L90
https://github.com/Azure/autorest.typescript/blob/main/packages/typespec-ts/test/modularUnit/operations.spec.ts#L792

  it("should fail to handle model additional properties from spread record of int64 | string in non compatible mode", async () => {
    try {
      await emitModularModelsFromTypeSpec(
        `
      model Vegetables {
        ...Record<int64 | string>;
        carrots: int64;
        beans: int64;
      }
      op post(@body body: Vegetables): { @body body: Vegetables };
      `
      );
      assert.fail("Should throw diagnostic warnings");
    } catch (e) {
      const diagnostics = e as Diagnostic[];
      assert.equal(diagnostics.length, 1);
      assert.equal(
        diagnostics[0]?.code,
        "@azure-tools/typespec-ts/compatible-additional-properties"
      );
      assert.equal(diagnostics[0]?.severity, "warning");
    }
  });
@qiaozha qiaozha added HRLC P1 priority 1 labels Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HRLC P1 priority 1
Projects
None yet
Development

No branches or pull requests

3 participants