Skip to content

[http-client-java] mgmt, refine resource categorization logic #8743

Description

Context

spec

Keyvault has something like https://github.com/Azure/azure-rest-api-specs/blob/ca3e917fb791170fca9ffc11f5f2a7bb19783053/specification/keyvault/KeyVault.Management/Vault.tsp#L17

modelVaultextendsAzure.ResourceManager.Legacy.TrackedResourceWithOptionalLocation<
VaultProperties,
false
> {
}
modelTrackedResourceWithOptionalLocation<
Propertiesextends {},
PropertiesOptionalextendsvalueofboolean = true
> extendsResource {
properties?:Properties;
tags?:Record<string>;
location?:string;
}
modelResource {
id:string,
name:string,
type:string
}

Issue

template model TrackedResourceWithOptionalLocation's additional properties(e.g. tags, location) will be populated into Vault.

Our current logic won't check Vault for additional resource properties. Vault will extend ProxyResource instead of Resource, since parent class doesn't have tags, location.

How do we specify that Vault should extend Resource instead of ProxyResource?

Proposals

  1. Check leaf class for resource properties as well. This will only involve at most two levels(root, leaf).
  2. Customization, enable customization-class in mgmt.
  3. Additional JavaSettings to specify the base resource, e.g.
base-resource:
Vault: ResourceManagedHsm: Resource

Prefer 1. Though for 1, another potential logic optimization will affect it -> we should also consider resource property's optionality/visibility.
For this, maybe an additional JavaSettings, e.g. resource-property-match-name-only: true(by default false) to help.

We may need another way to replace ProxyResource with Resource for servicebus case:
https://github.com/chunyu3/azure-rest-api-specs/blob/bd5305d1b18e78d4b0294cb75996b6663e792619/specification/servicebus/ServiceBus.Management/SBAuthorizationRule.tsp#L20

Metadata

Metadata

Labels

emitter:client:javaIssue for the Java client emitter: @typespec/http-client-java

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions