Skip to content

Issue persist when trying to run with react native #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
FranDepascuali opened this issue Jan 20, 2023 · 6 comments · Fixed by #148
Closed

Issue persist when trying to run with react native #146

FranDepascuali opened this issue Jan 20, 2023 · 6 comments · Fixed by #148

Comments

@FranDepascuali
Copy link

FranDepascuali commented Jan 20, 2023

Thank you @anttiviljami for fixing the previous issue #140 I reported!

When I try, I still have errors regarding dependencies not supported in our node.js runtime due to json-schema-ref-parser.

imagen

Thank you!
Depa

@anttiviljami
Copy link
Member

anttiviljami commented Jan 20, 2023

Hi @FranDepascuali, you’ll still need to add the required polyfills in your build config. Take a look at the README for examples:

https://github.com/anttiviljami/openapi-client-axios#browser-usage

@FranDepascuali
Copy link
Author

It's really difficult to add a polyfill in react-native like that as it doesn't use a webpack setup.

Been reading into https://github.com/philikon/ReactNativify and https://github.com/tradle/rn-nodeify
but it sounds pretty complicated.

I will tell you if I had any luck.

Thanks!

@anttiviljami
Copy link
Member

This seems like a straightforward solution for rn. https://stackoverflow.com/a/41511414

There might be other polyfills you need too like util IIRC

@FranDepascuali
Copy link
Author

FranDepascuali commented Jan 22, 2023

Tried that lib
image

@FranDepascuali
Copy link
Author

FranDepascuali commented Jan 26, 2023

Update: I tried every possible way I could, using different polyfill implementation.

I couldn't make it work, there's always strange runtime errors when polyfilling.

I tried other alternatives to generate a typescript axios client (gonna list them later).
They work BUT this lib has two important aspects:

  1. Is used by our company frontend's, meaning that we have easier code reuse
  2. I really like the types paths objects. That would also allow to do type safe axios mocking via interceptors. Plus it provides better communication with the backend team.
    I couldn't find that typed paths property dictionary in other packages.

This lib seems awesome. I'll try other versions in the future to see if the errors change or it's available for us with react native.

Thanks you very much @anttiviljami !!

Depa

@anttiviljami
Copy link
Member

Hi @FranDepascuali. The issues come from the json-schema-ref-parser dependency used by this library.

Unfortunately this lib is no longer really maintained and causes multiple issues for us, including a bloated bundle size and difficulty in non Node.js environments.

I’ve asked my team at @epilot-dev to take a look at replacing with a simpler, more compatible implementation. A lot of the features from json-schema-ref-parser are not really necessary for openapi-client-axios

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants