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

Customize path parameter for a resource operation changes its resource type #2043

Open
pshao25 opened this issue Jan 7, 2025 · 0 comments
Open
Assignees

Comments

@pshao25
Copy link
Member

pshao25 commented Jan 7, 2025

Use this Employee example, the only change I made is adding a path parameter to listByResourceGroup like

listByResourceGroup is ArmResourceListByParent<Employee,
  Parameters = {
    /** doc */
    @path
    @segment("locations")
    location: string;
  }>;

Now you will see the route becomes /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContosoProviderHub/locations/{location}/employees

Please correct me if I'm wrong:
I assume the resource type for this route is Microsoft.ContosoProviderHub/locations/employees, which is different from the other operations, whose resource type is Microsoft.ContosoProviderHub/employees
I assume getArmResources will return all of the operations including listByResourceGroup for resource model Employee right? Something like

operations:
    - resourceType: "Microsoft.ContosoProviderHub/employees"
      operations: [get, update, delete, ...]
    - resourceType: "Microsoft.ContosoProviderHub/locations/employees"
      operations: [listByResourceGroup]

If that is the case, we implicitly add a new resource with another resource type, I feel like that not what TypeSpec should do.

Currently, .net SDK's behavior (swagger input) is listByResourceGroup operation doesn't belongs to Employee resource model.

The real case is from this operation.

@pshao25 pshao25 changed the title Customize path parameter for a resource operation Customize path parameter for a resource operation changes its resource type Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants