Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 957
Kyle Briggs Avatar asked Sep 10 '18 19:09

Kyle Briggs


People also ask

What is OCP Apim trace?

On the Message tab, the ocp-apim-trace-location header shows the location of the trace data stored in Azure blob storage. If needed, go to this location to retrieve the trace. Trace data can be accessed for up to 24 hours.

What is Azure API management developer portal?

The developer portal is an automatically generated, fully customizable website with the documentation of your APIs. It is where API consumers can discover your APIs, learn how to use them, and request access.

What is Apim?

APIM may refer to: API Management (Computer Science); a way to create API (application programming interface) gateways for back-end services using products such as Apigee, Azure API Management, TIBCO Mashery, Mulesoft, WSO2, AWS API Gateway.


1 Answers

There is an undefined parameter in your open api specifications.

Because Azure won't give you more details, you can use the swagger editor to validate your specifications. The editor will give you a detailed error message: enter image description here

See also https://jamesradley.co.uk/2020/04/16/azure-api-management-template-parameters-used-in-the-uritemplate-must-be-defined-in-the-operation-and-vice-versa/

like image 89
Matthias M Avatar answered Oct 19 '22 17:10

Matthias M