Bicep is a declarative language for describing and deploying Azure resources
Just wanted to add some strawman syntax variations for comparison. To give a more complete example, each snippet describes the shape of the CertificateProperties
shape from Microsoft.AppPlatform@2022-12-01.
Based on the proposal in #9369
abstract type CertificateProperties = {
type: string
activateDate: string
dnsNames: string[]
expirationDate: string
issuedDate: string
issuer: string
provisioningState: 'Creating' | 'Deleting' | 'Failed' | 'Succeeded' | 'Updating'
subjectName: string
thumbprint: string
}
type ContentCertificateProperties extends CertificateProperties = {
type: 'ContentCertificate'
content: string
}
type KeyVaultCertificateProperties extends CertificateProperties = {
type: 'KeyVaultCertificate'
certVersion: string
excludePrivateKey: bool
keyVaultCertName: string
vaultUri: string
}
type ContentCertificateProperties = {
type: 'ContentCertificate'
activateDate: string
dnsNames: string[]
expirationDate: string
issuedDate: string
issuer: string
provisioningState: 'Creating' | 'Deleting' | 'Failed' | 'Succeeded' | 'Updating'
subjectName: string
thumbprint: string
content: string
}
type KeyVaultCertificateProperties = {
type: 'KeyVaultCertificate'
activateDate: string
dnsNames: string[]
expirationDate: string
issuedDate: string
issuer: string
provisioningState: 'Creating' | 'Deleting' | 'Failed' | 'Succeeded' | 'Updating'
subjectName: string
thumbprint: string
certVersion: string
excludePrivateKey: bool
keyVaultCertName: string
vaultUri: string
}
type CertificateProperties = ContentCertificateProperties | KeyVaultCertificateProperties;
&
)type CertificatePropertiesSharedProps = {
activateDate: string
dnsNames: string[]
expirationDate: string
issuedDate: string
issuer: string
provisioningState: 'Creating' | 'Deleting' | 'Failed' | 'Succeeded' | 'Updating'
subjectName: string
thumbprint: string
}
type ContentCertificateProperties = CertificatePropertiesSharedProps & {
type: 'ContentCertificate'
content: string
}
type KeyVaultCertificateProperties = CertificatePropertiesSharedProps & {
type: 'KeyVaultCertificate'
certVersion: string
excludePrivateKey: bool
keyVaultCertName: string
vaultUri: string
}
type CertificateProperties = ContentCertificateProperties | KeyVaultCertificateProperties;
type CertificateProperties = {
activateDate: string
dnsNames: string[]
expirationDate: string
issuedDate: string
issuer: string
provisioningState: 'Creating' | 'Deleting' | 'Failed' | 'Succeeded' | 'Updating'
subjectName: string
thumbprint: string
discriminator type: {
ContentCertificate: {
content: string
}
KeyVaultCertificate: {
certVersion: string
excludePrivateKey: bool
keyVaultCertName: string
vaultUri: string
}
}
}
Bicep version Bicep CLI version 0.15.31 (3ba6e06a8d)
Describe the bug
Recently this change was released #9454 which changes the syntax and it is explained how it should be changed. When using intellisense now these properties are marked as mandatory.
To Reproduce see above
Additional context Add any other context about the problem here.
Skip Required
label on nullable properties (#10242)
Ensure nullable properties are not labeled '(Required)' or included in 'required-properties' snippet
Add an IsRequired method to TypeHelper
Resolves #10239
This PR ensures that nullable properties are not labeled '(Required)' in the completion detail tooltip or included in the 'required-properties' completion snippet.
@Venkat2694 I can see that the compiled templates are different, but this was a deliberate change, and both versions should work.
Can you share the details of the error you are seeing?
Update Generated Types (#1459)
Generate types for https://github.com/Azure/azure-rest-api-specs/tree/969fd0c2634fbcc1975d7abe3749330a5145a97c
Generate types for https://github.com/Azure/azure-rest-api-specs/tree/969fd0c2634fbcc1975d7abe3749330a5145a97c
Generate types for https://github.com/Azure/azure-rest-api-specs/tree/969fd0c2634fbcc1975d7abe3749330a5145a97c