jeskew
Repos
40
Followers
137

Bicep is a declarative language for describing and deploying Azure resources

2758
656

Bicep type definitions for ARM resources

56
18

Shared libraries for reading and writing Bicep type definitions

4
5

Lazy sequence operators for JavaScript backed by async iterators.

Events

issue comment
Tagged union type declarations

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.

Unions via inheritance

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
}

TypeScript-style discriminated unions

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;

TypeScript-style discriminated union (but with structural inheritance via &)

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;

Inspired by Rust enums

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
    }
  }
}
Created at 5 hours ago
delete branch
jeskew delete branch jeskew/mark-nullable-props-as-optional-in-lang-server
Created at 11 hours ago
closed issue
User-defined types - Non-mandatory properties are visible as mandatory

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. image

image

To Reproduce see above

Additional context Add any other context about the problem here.

Created at 11 hours ago

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

Created at 11 hours ago
pull request closed
Skip `Required` label on nullable properties

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.

Microsoft Reviewers: Open in CodeFlow
Created at 11 hours ago
issue comment
API Version append after converting Bicep to ARM JSON

@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?

Created at 1 day ago

Update Generated Types (#1459)

Generate types for https://github.com/Azure/azure-rest-api-specs/tree/969fd0c2634fbcc1975d7abe3749330a5145a97c

Created at 1 day ago
delete branch
jeskew delete branch autogenerate-badb9674e
Created at 1 day ago
pull request closed
Update Generated Types

Generate types for https://github.com/Azure/azure-rest-api-specs/tree/969fd0c2634fbcc1975d7abe3749330a5145a97c

Created at 1 day ago
pull request opened
Update Generated Types

Generate types for https://github.com/Azure/azure-rest-api-specs/tree/969fd0c2634fbcc1975d7abe3749330a5145a97c

Created at 1 day ago
delete branch
jeskew delete branch autogenerate-41e2d495f
Created at 1 day ago
delete branch
jeskew delete branch autogenerate-5a2f773e9
Created at 1 day ago
delete branch
jeskew delete branch autogenerate-21fcdd8d5
Created at 1 day ago
delete branch
jeskew delete branch autogenerate-6c95712b7
Created at 1 day ago
delete branch
jeskew delete branch autogenerate-c5438c425
Created at 1 day ago
delete branch
jeskew delete branch autogenerate-3ca899c1d
Created at 1 day ago
delete branch
jeskew delete branch autogenerate-1d74adbc
Created at 1 day ago
delete branch
jeskew delete branch autogenerate-f80bcf2d
Created at 1 day ago
delete branch
jeskew delete branch autogenerate-0e3d2960
Created at 1 day ago
delete branch
jeskew delete branch jeskew/ignore-paths-that-ARM-cannot-call-typegen
Created at 1 day ago
delete branch
jeskew delete branch jeskew/union-base-property-exclusion-refinement-typegen
Created at 1 day ago
delete branch
jeskew delete branch jeskew/path-regex-fixup-typegen
Created at 1 day ago