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

Two model properties both have only one property and they have the same name #5165

Open
Tracked by #5164
pshao25 opened this issue Nov 20, 2024 · 0 comments
Open
Tracked by #5164

Comments

@pshao25
Copy link
Member

pshao25 commented Nov 20, 2024

Take compute as an example:

"ScheduledEventsPolicy": {
  "properties": {
    "userInitiatedRedeploy": {
      "$ref": "#/definitions/UserInitiatedRedeploy",
      "description": "The configuration parameters used while creating userInitiatedRedeploy scheduled event setting creation."
    },
    "userInitiatedReboot": {
      "$ref": "#/definitions/UserInitiatedReboot",
      "description": "The configuration parameters used while creating userInitiatedReboot scheduled event setting creation."
    }
}
"UserInitiatedRedeploy": {
  "properties": {
    "automaticallyApprove": {
      "type": "boolean",
      "description": "Specifies Redeploy Scheduled Event related configurations."
    }
  }
}
"UserInitiatedReboot": {
  "properties": {
    "automaticallyApprove": {
      "type": "boolean",
      "description": "Specifies Reboot Scheduled Event related configurations."
    }
  }
}

These two property models both have only one property called automaticallyApprove. If there is only one property, we will flatten this property out. Now there will be two properties called automaticallyApprove.

Current solution is, in .net autorest.md, we have

# Add a dummy property because generator tries to flatten automaticallyApprove in both UserInitiatedRedeploy and UserInitiatedReboot
  - from: computeRPCommon.json
    where: $.definitions.UserInitiatedRedeploy.properties
    transform: >
      $.dummyProperty = {
        "type": "string",
        "description": "This is a dummy property to prevent flattening."
      }; 

Now the problem is, when we migrate to TypeSpec, how we are going to add this configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant