Delen via


Bicep-fout/waarschuwingscode - BCP035

Deze fout/waarschuwing treedt op wanneer uw resourcedefinitie een vereiste eigenschap mist.

Fout-/waarschuwingsbeschrijving

The specified <date-type> declaration is missing the following required properties: <property-name>.

Oplossing

Voeg de ontbrekende eigenschap toe aan de resourcedefinitie.

Voorbeelden

In het volgende voorbeeld wordt de waarschuwing voor virtualNetworkGateway1 en virtualNetworkGateway2 weergegeven:

var networkConnectionName = 'testConnection'
var location = 'eastus'
var vnetGwAId = 'gatewayA'
var vnetGwBId = 'gatewayB'

resource networkConnection 'Microsoft.Network/connections@2023-11-01' = {
  name: networkConnectionName
  location: location
  properties: {
    virtualNetworkGateway1: {
      id: vnetGwAId
    }
    virtualNetworkGateway2: {
      id: vnetGwBId
    }

    connectionType: 'Vnet2Vnet' 
  }
}

De waarschuwing is:

The specified "object" declaration is missing the following required properties: "properties". If this is an inaccuracy in the documentation, please report it to the Bicep Team.

U kunt de ontbrekende eigenschappen controleren in de sjabloonreferentie. Als u de waarschuwing van Visual Studio Code ziet, plaatst u de cursor boven de symbolische naam van de resource en selecteert u Document weergeven om de sjabloonreferentie te openen.

U kunt het probleem oplossen door de ontbrekende eigenschappen toe te voegen:

var networkConnectionName = 'testConnection'
var location = 'eastus'
var vnetGwAId = 'gatewayA'
var vnetGwBId = 'gatewayB'

resource networkConnection 'Microsoft.Network/connections@2023-11-01' = {
  name: networkConnectionName
  location: location
  properties: {
    virtualNetworkGateway1: {
      id: vnetGwAId
      properties:{}
    }
    virtualNetworkGateway2: {
      id: vnetGwBId
      properties:{}
    }

    connectionType: 'Vnet2Vnet' 
  }
}

In het volgende voorbeeld wordt de fout voor outValue gegenereerd omdat de vereiste eigenschapswaarde ontbreekt:

@discriminator('type')
type taggedUnion = {type: 'foo', value: int} | {type: 'bar', value: bool}

output outValue taggedUnion = {type: 'foo'}

U kunt het probleem oplossen door de ontbrekende eigenschappen toe te voegen:

@discriminator('type')
type taggedUnion = {type: 'foo', value: int} | {type: 'bar', value: bool}

output outValue taggedUnion = {type: 'foo', value: 3}

Volgende stappen

Zie Bicep Core Diagnostics voor meer informatie over Bicep-fout- en waarschuwingscodes.