swagger-js icon indicating copy to clipboard operation
swagger-js copied to clipboard

react-native Error: Unable to resolve module @swagger-api/apidom-reference/configuration/empty

Open voydz opened this issue 3 months ago • 0 comments

Q&A (please complete the following information)

  • OS: macOS 14
  • Environment: react-native 0.73.6
  • Method of installation: npm
  • Swagger-Client version: >= 3.19.0
  • Swagger/OpenAPI version: Swagger 2.0

Content & configuration

Swagger/OpenAPI definition:

# take any example swagger 2.0 spec

Swagger-Client usage:

SwaggerClient({
  spec: './spec.json',
})

Describe the bug you're encountering

upon using newer versions of swagger-client >= 19 the following error will prevent the usage in react-native

Error: Unable to resolve module @swagger-api/apidom-reference/configuration/empty from <app>/node_modules/swagger-client/lib/resolver/apidom/reference/resolve/resolvers/http-swagger-client/index.js: @swagger-api/apidom-reference/configuration/empty could not be found within the project or in these directories:
  node_modules/swagger-client/node_modules

To reproduce...

Steps to reproduce the behavior: (setup of react-native is required)

  1. npx react-native@latest init SwaggerTest --pm npm --install-pods false
  2. npm i swagger-client
  3. import swagger client in App.tsx import SwaggerClient from 'swagger-client';
  4. add the following code block to the top of the App component
const client = new SwaggerClient({
    spec: 'https://petstore.swagger.io/v2/swagger.json',
  });
  1. start react-native npm start and launch any app i.e. by pressing 'a' in the react-native cli

Expected behavior

app should initialize swagger-client without error

Additional context or thoughts

issue may be related to #3136

voydz avatar Mar 18 '24 09:03 voydz