Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
UriTemplate中使用的Azure API管理模板参数必须在操作中定义,反之亦然_Azure_Swagger_Azure Functions_Azure Api Management - Fatal编程技术网

UriTemplate中使用的Azure API管理模板参数必须在操作中定义,反之亦然

UriTemplate中使用的Azure API管理模板参数必须在操作中定义,反之亦然,azure,swagger,azure-functions,azure-api-management,Azure,Swagger,Azure Functions,Azure Api Management,我有很多Azure函数,现在我想把Azure API管理放在前面 我已从我帐户中的2或3个其他功能应用中导入了所有功能,没有问题,但其中一个功能应用出现问题。此功能应用程序有6个功能,其中3个功能如果我特别选择,我可以很好地导入。其他3个函数中的某个函数抛出错误: 操作中必须定义UriTemplate中使用的所有模板参数,反之亦然。 下面是由Azure函数本身创建的我的Swagger api文档的相关部分: paths: '/api/api-keys/{customerId}':

我有很多Azure函数,现在我想把Azure API管理放在前面

我已从我帐户中的2或3个其他功能应用中导入了所有功能,没有问题,但其中一个功能应用出现问题。此功能应用程序有6个功能,其中3个功能如果我特别选择,我可以很好地导入。其他3个函数中的某个函数抛出错误:

操作中必须定义UriTemplate中使用的所有模板参数,反之亦然。

下面是由Azure函数本身创建的我的Swagger api文档的相关部分:

    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: []
通过查看,我已经验证了参数中的所有项都在路径中。我不确定我在这里是否遗漏了什么,但是在互联网上我没有看到太多关于这个问题的信息。

更新(10/1/18):问题已经解决。如果仍然可以复制,请清除浏览器缓存

函数应用程序导入目前根本不使用您为函数应用程序定义的OpenAPI规范。相反,它直接使用FunctionApp定义。这个问题是由函数具有带参数的路由引起的,比如/route/{param}。这将很快得到解决


现在应该可以了。

打开的api规范中有一个未定义的参数

因为Azure不会提供更多详细信息,所以您可以使用来验证您的规范。 编辑器将向您提供详细的错误消息:


另请参见

这些可能只是复制粘贴错误,但示例中的缩进看起来不正确。用于验证语法。@Helen是的,语法以前已验证过。缩进在复制/粘贴过程中出错。因此API管理层查找函数应用程序并尝试自己直接导入,但由于我的路径中有{params},它无法?当你说“很快”时,我们是在谈论周、月、季度等吗?此外,在短期内,唯一的方法是手动创建空白API并将其配置为设置路由和参数。试一试。谢谢,看起来导入已在最新版本的“API管理服务”中修复。这使它变得容易多了,尽管我已经设法从一个“空白API”手动构建了它,但为了让它正常工作,我不得不修改一些东西。例如,无法将后端Azure服务设置为功能应用程序(仅支持逻辑应用程序),而必须硬编码HTTPS端点。无论如何,感谢这些更新,函数应用程序导入现在对路由中带有参数的函数按预期工作。@VitaliyKurokhtin供参考:几分钟前,我使用了一个带有param
{param?}
的路由,而此特定函数的APIM导入失败。这已修复。如果仍然看不到修复,请清除浏览器缓存。