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

[Bug]: visibility discrepancy between Swagger and TypeSpec defined UserAssignedIdentity #931

Closed
4 tasks done
XiaofeiCao opened this issue May 29, 2024 · 1 comment
Closed
4 tasks done
Assignees
Labels
bug Something isn't working lib:azure-resource-manager Issues for @azure-tools/typespec-azure-core library
Milestone

Comments

@XiaofeiCao
Copy link
Contributor

XiaofeiCao commented May 29, 2024

Describe the bug

TypeSpec:

model UserAssignedIdentity {
@doc("The active directory client identifier for this principal.")
clientId?: string;
@doc("The active directory identifier for this principal.")
principalId?: string;
}

Swagger:

"UserAssignedIdentity": {
  "type": "object",
  "description": "User assigned identity properties",
  "properties": {
    "principalId": {
      "description": "The principal ID of the assigned identity.",
      "format": "uuid",
      "type": "string",
      "readOnly": true
    },
    "clientId": {
      "description": "The client ID of the assigned identity.",
      "format": "uuid",
      "type": "string",
      "readOnly": true
    }
  }
}

The model is used in both input and output.
For input, user sends something like:

{
  "userAssignedIdentities": {
    "00000000-0000-0000-0000-000000000000": {}
  }
}

For output, service will reply:

{
  "userAssignedIdentities": {
    "00000000-0000-0000-0000-000000000000": {
      "principalId": <some-principal-id>,
      "tenantId": <some-tenant-id>
    }
  }
}

If not defined with @visibility("read"), unnecessary setter methods will be generated for Java.

Reproduction

See above

Checklist

  • Follow our Code of Conduct
  • Check that this issue is about the Azure libraries for typespec. For bug in the typespec language or core libraries file it in the TypeSpec repo
  • Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.
@allenjzhang
Copy link
Member

fixed in pending PR #945

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lib:azure-resource-manager Issues for @azure-tools/typespec-azure-core library
Projects
None yet
Development

No branches or pull requests

3 participants