排除在 Azure autorest 中生成的方法
Exclude method from generating in Azure autorest
尝试使用 Azure Autorest 为该规范生成 C# 代码时:
https://github.com/blend/blend-api-specs/blob/master/version_4/v4.2.0_stable.openapi_spec.yaml
我收到以下错误:
warning | Interpretations | Generating 'operationId' to 'Home Lending - Applications' for 'get' operation on path '/home-lending/applications/{id}/assignees'
warning | Interpretations | Generating 'operationId' to 'Home Lending - Applications' for 'patch' operation on path '/home-lending/applications/{id}/assignees'
warning | Interpretations | Generating 'operationId' to 'Home Lending - Applications' for 'put' operation on path '/home-lending/applications/{id}/assignees'
warning | Modeler/MissingType | The schema 'paths·bz6x3r·home_lending-applications-id·patch·requestbody·content·application-json·schema·properties·loanamount·allof·1' has no type or format information whatsoever. Location:
file:///home/XX/code/XX-platform/poc/integrations/providers/Blend.autorest/spec/v4.2.0stable.openapi_spec.yaml#/components/schemas/paths·bz6x3r·homelending-applications-id·patch·requestbody·content·application-json·schema·properties·loanamount·allof·1
error | DuplicateOperation | Duplicate Operation '' > 'HomeLendingApplications' detected(This is most likely due to 2 operation using the same 'operationId' or 'tags'). Duplicates have those paths:
- /home-lending/applications/{id}/assignees
- /home-lending/applications/{id}/assignees
- /home-lending/applications/{id}/assignees
fatal | Error: 1 errors occured -- cannot continue.
fatal | Process() cancelled due to failure
Error: Plugin checker reported failure.
由于我无法修改 YAML 文件(它是一个 public API),有没有办法避免生成或忽略有问题的部分?也许使用指令?
在 Autorest github 问题板上询问后,我被建议使用指令,它允许即时预处理规范。
directive:
- from: openapi-document
where: '$.paths["/home-lending/applications/{id}/assignees"].get'
debug: true
transform: |
$["operationId"] = "lending-assignees-get";
- from: openapi-document
where: '$.paths["/home-lending/applications/{id}/assignees"].put'
debug: true
transform: |
$["operationId"] = "lending-assignees-put";
此特定规范仍包含导致 autorest c# 生成器失败的其他问题,但这些指令确实解决了原始问题。
尝试使用 Azure Autorest 为该规范生成 C# 代码时:
https://github.com/blend/blend-api-specs/blob/master/version_4/v4.2.0_stable.openapi_spec.yaml
我收到以下错误:
warning | Interpretations | Generating 'operationId' to 'Home Lending - Applications' for 'get' operation on path '/home-lending/applications/{id}/assignees'
warning | Interpretations | Generating 'operationId' to 'Home Lending - Applications' for 'patch' operation on path '/home-lending/applications/{id}/assignees'
warning | Interpretations | Generating 'operationId' to 'Home Lending - Applications' for 'put' operation on path '/home-lending/applications/{id}/assignees'
warning | Modeler/MissingType | The schema 'paths·bz6x3r·home_lending-applications-id·patch·requestbody·content·application-json·schema·properties·loanamount·allof·1' has no type or format information whatsoever. Location:
file:///home/XX/code/XX-platform/poc/integrations/providers/Blend.autorest/spec/v4.2.0stable.openapi_spec.yaml#/components/schemas/paths·bz6x3r·homelending-applications-id·patch·requestbody·content·application-json·schema·properties·loanamount·allof·1
error | DuplicateOperation | Duplicate Operation '' > 'HomeLendingApplications' detected(This is most likely due to 2 operation using the same 'operationId' or 'tags'). Duplicates have those paths:
- /home-lending/applications/{id}/assignees
- /home-lending/applications/{id}/assignees
- /home-lending/applications/{id}/assignees
fatal | Error: 1 errors occured -- cannot continue.
fatal | Process() cancelled due to failure
Error: Plugin checker reported failure.
由于我无法修改 YAML 文件(它是一个 public API),有没有办法避免生成或忽略有问题的部分?也许使用指令?
在 Autorest github 问题板上询问后,我被建议使用指令,它允许即时预处理规范。
directive:
- from: openapi-document
where: '$.paths["/home-lending/applications/{id}/assignees"].get'
debug: true
transform: |
$["operationId"] = "lending-assignees-get";
- from: openapi-document
where: '$.paths["/home-lending/applications/{id}/assignees"].put'
debug: true
transform: |
$["operationId"] = "lending-assignees-put";
此特定规范仍包含导致 autorest c# 生成器失败的其他问题,但这些指令确实解决了原始问题。