Azure API Management Template parameters used in the UriTemplate must be defined in the Operation, and vice-versa

Viewed 6930

I have a number of Azure functions, that I would like to now put Azure API Management in front of.

I have imported all the functions from 2 or 3 of my other function apps in my account with no issues, but I am having issues with one of the function apps. This function app has 6 functions, 3 of which I can import fine if I select the specifically. Something within the other 3 functions is throwing an error:

All template parameters used in the UriTemplate must be defined in the Operation, and vice-versa.

Here the the relevant part of my Swagger api document created by the Azure Function itself:

    paths:
'/api/api-keys/{customerId}':
    delete:
    operationId: '/api/api-keys/{customerId}/delete'
    produces: []
    consumes: []
    parameters:
        - name: customerId
        in: path
        required: true
        type: string
    description: >-
        Replace with Operation Object
        #http://swagger.io/specification/#operationObject
    responses:
        '200':
        description: Success operation
    security:
        - apikeyQuery: []
'/api/api-keys/{customerId}/{apiKeyId}':
    delete:
    operationId: '/api/api-keys/{customerId}/{apiKeyId}/delete'
    produces: []
    consumes: []
    parameters:
        - name: customerId
        in: path
        required: true
        type: string
        - name: apiKeyId
        in: path
        required: true
        type: string
    description: >-
        Replace with Operation Object
        #http://swagger.io/specification/#operationObject
    responses:
        '200':
        description: Success operation
    security:
        - apikeyQuery: []
'/api/password-hashes/{customerId}/{prefix}':
    get:
    operationId: '/api/hashes/{customerId}/{prefix}/get'
    produces: []
    consumes: []
    parameters:
        - name: customerId
        in: path
        required: true
        type: string
        - name: prefix
        in: path
        required: true
        type: string
    description: >-
        Replace with Operation Object
        #http://swagger.io/specification/#operationObject
    responses:
        '200':
        description: Success operation
    security:
        - apikeyQuery: []

Looking through this, I have verified that all items in the parameters are in the paths. I am not sure if there is anything I am missing here, but looking around on the internet I did not see much regarding the issue.

2 Answers

Update (10/1/18): The issue is fixed. Clear browser cache if still reproducible.

Function App import at the moment does not use OpenAPI spec you've defined for Function App at all. Instead it consumes FunctionApp definition directly. The problem is caused by your functions having routes with parameters, like /route/{param}. This will be fixed shortly.

This should work now.

Related