You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have some polymorphic discriminator properties in our typespec. One of the examples beloe
// Polymorphic Source
@discriminator("type")
@doc("The type of backing data source")
model Source {
@doc("Type of the Storage Connector – Bucket. Not mutable once the Storage Connector is created.")
type?: SourceType;
}
// Bucket source extends source
@doc("The properties of the backing data store.")
model BucketSource extends Source {
@visibility("read")
type: SourceType.Bucket;
@doc("Details for how to connect to the backing data store.")
connection: Connection;
@doc("Details for how to authenticate to the backing data store.")
authProperties: AuthProperties;
@doc("The host to use when computing the signature for requests to the backing data store. If not provided, defaults to what is provided in the endpoint for the connection.")
hostOverride?: string;
}
// The actual connector properties
@doc("Details of the Storage Connector.")
model ConnectorProperties {
@visibility("read", "create")
@doc("System-generated identifier for the Storage Connector. Not a valid input parameter when creating.")
uniqueId?: string;
@doc("State – Enabled or Disabled. Whether or not the Storage Connector should start as enabled (default: Enabled) (While set to false on the Storage Connector, all data plane requests using this Storage Connector fail, and this Storage Connector is not billed if it would be otherwise.)")
state?: State = State.Enabled;
@visibility("read", "create")
@doc("System-generated creation time for the Storage Connector. Not a valid input parameter when creating.")
creationTime?: string;
@doc("Arbitrary description of this Storage Connector. Max 250 characters.")
@maxLength(250)
description?: string;
@doc("Information about how to communicate with and authenticate to the backing data store.")
source: Source;
@visibility("read")
@doc("The status of the last operation.")
provisioningState?: ProvisioningState;
}
// Conenctor resource as tarcked resource
@doc("A Connector is a tracked ARM resource modeled as a sub-resource of a Storage Account")
model Connector is TrackedResource<ConnectorProperties> {
@doc("The name of the connector")
@pattern("^[a-zA-Z0-9-]{3,24}$")
@key("connectorName")
@segment("connectors")
@path
name: string;
}
When adding a update patch method for this resource -
@armResourceOperations(Connector)
interface Connectors {
@doc("Get the specified Storage Connector.")
get is ArmResourceRead<Connector>;
@doc("Create or update a Storage Connector.")
createOrReplace is ArmResourceCreateOrReplaceAsync<Connector>;
@doc("Update a Storage Connector.")
update is ArmCustomPatchAsync<
Connector,
ConnectorProperties
>;
}
We see an error from swagger Lint DIff validation stating that all properties of a patch resource should be optional.
Typespec does not allow us to have optional discriminator values
Is there a way we can model this in typespec for patch api?
Reproduction
Model the above in typesepc with ARM patch sync to reproduce this error
Describe the bug
We have some polymorphic discriminator properties in our typespec. One of the examples beloe
We see an error from swagger Lint DIff validation stating that all properties of a patch resource should be optional.
Typespec does not allow us to have optional discriminator values
Is there a way we can model this in typespec for patch api?
Reproduction
Model the above in typesepc with ARM patch sync to reproduce this error
Checklist
The text was updated successfully, but these errors were encountered: