question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

4.3.x Custom resolvers are incompatible with `options.apiSpec` set to path.

See original GitHub issue

Related to #416

Describe the bug After upgrading to 4.3.x custom resolvers are incompatible with options.apiSpec set to path.

In 4.2.3 custom resolver was working with:

resolver: (basePath: string, route) => {
 const functionName = route.schema['operationId'];
 ...

In 4.3.x custom resolver had to be change to different approach because there is no longer .schema property in the route:

resolver: (basePath: string, route, apiDoc) => {
  const pathKey = route.openApiRoute.substring(route.basePath.length);
  const schema = apiDoc.paths[pathKey][route.method.toLowerCase()];
  const functionName = schema['operationId'];
  ...

But it relies on installOperationHandlers to send apiDoc always as an object, whereas per line https://github.com/cdimascio/express-openapi-validator/blob/ed7af2b02fa45c069c5bdedf5ccf1eff914e3610/src/openapi.validator.ts#L321 it sends whatever was defined in options (in my case, path to API description doc).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
aviskasecommented, Oct 27, 2020

yup, will do

1reaction
aviskasecommented, Oct 27, 2020

I found that apiDoc argument was introduced in #366 in version 3.17.x , so I think the are two problems here:

  • for some reason, route.schema is now undefined
  • apiDoc is better to be loaded into object before passing into resolver (for uniformity)
Read more comments on GitHub >

github_iconTop Results From Across the Web

apispec - Read the Docs
Custom Fields apispec maps standard marshmallow fields to OpenAPI types and formats. If your custom field subclasses a standard.
Read more >
Manage a LoadBalancer resource in Oracle Cloud Infrastructure
Key Key Returned load_balancer. complex load_balancer. complex on success backend_sets. complex backend_sets. complex on success backends. complex on success
Read more >
Custom Value Resolvers - AutoMapper documentation
MapFrom(aValueResolverInstance). In the below example, we'll use the first option, telling AutoMapper the custom resolver type through generics:.
Read more >
Chapter 13. Deploying installer-provisioned clusters on bare ...
Mirroring an image set in a partially disconnected environment ... Installing a cluster quickly on Alibaba Cloud" Collapse section "4.3.
Read more >
gatsby | Yarn - Package Manager
Important: This documentation covers modern versions of Yarn. For 1.x docs, see classic.yarnpkg.com. Yarn.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found