swagger-js
swagger-js copied to clipboard
react-native Error: Unable to resolve module @swagger-api/apidom-reference/configuration/empty
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)
-
npx react-native@latest init SwaggerTest --pm npm --install-pods false
-
npm i swagger-client
- import swagger client in App.tsx
import SwaggerClient from 'swagger-client';
- add the following code block to the top of the App component
const client = new SwaggerClient({
spec: 'https://petstore.swagger.io/v2/swagger.json',
});
- 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