0
votes

I'm reverse engineering a functioning API into an ARM template. A deployment with the ARM template fails at the moment due to missing schema definitions:

{
    "code": "ValidationError",
    "target": "operation 'DELETE'-'/{accountNumber}/addresses/{addressType}' response '200' 'application/json' representation schema 5ff73174ffb8c010d47f74fd",   
    "message": "Operation references schema that does not exist."
}

When I generate the full ARM template for my APIM instance using the Azure Portal, the type definitions are not there:

{
    "type": "Microsoft.ApiManagement/service/apis/schemas",
    "apiVersion": "2020-06-01-preview",
    ...
    "properties": {
        "contentType": "application/vnd.ms-azure-apim.swagger.definitions+json",
        "document": {
            "definitions": {}
        }
    }
}

What should the definitions element look like? I can't make it up from the documentation.

2

2 Answers

0
votes

I was able to copy the definitions from the OpenAPI specification view in the Azure portal.

enter image description here

0
votes

you can include it like this

"properties": {
    "contentType": "application/vnd.oai.openapi.components+json",
    "document": {
        "components": {
            "schemas": {
                "DefinitionXYZ": {
                    "type": "object",
                    "properties": {}
                }
            }
        }
    }
}