I want to use the OAS Validation Policy. Unfortunately, the policy fails since the API Proxy and OAS base paths are different. Is there a way to use the OAS Validation Policy if the API Proxy and OAS base path is different? Any suggestions?
Hmmm
The documentation for the policy states that the policy “Validates the basepath defined by the API proxy; ignores the basepath specified in the OpenAPI Specification.”
So what you are describing… shouldn’t happen?
Do you have a small proxy that reproduces this? Something that includes a small (super simple) OAS and a proxy with a different basepath and maybe one conditional flow? If so , can you attach it here?
Thank you very much for your quick reply.
The problem is that the request path (minus the basepath) matches none of the path patterns defined in the OpenAPI Specification.
The basepath specified in the Open API specification is:
https://sandbox.api.ato.gov.au/super/v1
The basepath specified in the API Proxy specification is:
https://sandbox.api.ato.gov.au/super/v1/clients/ABN/{abn_payer}/payees/TFN/{tfn_payee}/stapledSuperFund
The request path is:
https://sandbox.api.ato.gov.au/super/v1/clients/ABN/{abn_payer}/payees/TFN/{tfn_payee}/stapledSuperFund
Open API specification:
https://apiportal.ato.gov.au/apis/106/specification
Because of internal routing rules, it is not possible to change the basepath specified in the API Proxy. What is the best way to face this problem? For e.g. is there a way to suppress the error message?
You ever find a solution?
I know this is super old, but… maybe an answer now will help future readers.
The current behavior of the OASValidation policy is to validate against proxy.pathsuffix. Therefore it does not matter what your BasePath is in the proxy, nor does it matter what the server.url is in the spec.
The policy simply looks at the proxy.pathsuffix and matches it against entries in the paths array in the spec.
To solve your problem then, I think you need to modify the original spec so that it aligns with that constraint. It could be you have a canonical spec, and then during deployment of the spec to Apigee, you modify it to remove any proxy.basepath from each of the paths entries.