Comments (11)
Hello, sorry for your problem. With version 5, orval support multi-files when I read the other files I also try to resolve them as open API files. Which cause a problem in your case. I updated your specification to solve the problem (spec). I will think about a better solution in the future but at the moment it's the only solution sorry :(.
from orval.
@anymaniax, thank you for your response. It does generate the file now. However, I have not used it yet. I am going to try now to thank you first for your work. Is it possible to make it work with fetch
instead of axios
?
from orval.
Hello, sure. You can use a mutator checkout the doc here and example
from orval.
Thank you @anymaniax , I will take a look
from orval.
Hello @anymaniax , I tried using it again with configuration file, and now it fails with the following error. I used the same files that you added to GitHub gist earlier.
➜ mock-service-worker-rest git:(openapi3) ✗ npx [email protected] --config ./orval.config.js
🍻 Start orval v5.2.0 - A swagger client generator for typescript
TypeError: Cannot read property 'components' of undefined
The latest code is available on the branch https://github.com/hhimanshu/rapid-front-end-development/tree/openapi3
Have I missed something?
from orval.
And if I use it without 5.2.0
version, I see other errors
➜ mock-service-worker-rest git:(openapi3) ✗ npx orval --config ./orval.config.js
🍻 Start orval v4.2.1 - A swagger client generator for typescript
Error: Every path must have a operationId - No operationId set for get /api/businesses
➜ mock-service-worker-rest git:(openapi3) ✗ npx orval --config ./orval.config.js
🍻 Start orval v4.2.1 - A swagger client generator for typescript
Error: This library only resolve $ref that are include into `#/components/*` for now
My intention is to generate TypeScript code with react-query and msw at this time. Let me know if I have missed something. Thanks
from orval.
Can you try with the 5.3.0
was a bug with the mock generation when you have multiple files specification
from orval.
Hey @anymaniax , thanks for the fix. It now generates methods. I have been able to use them as well. One oddity that I found was that it did not honor the config to create a file of my choice
module.exports = {
businesses: {
output: {
mode: 'tags-split',
target: 'src/openapi/generated/interface.ts',
schemas: 'src/openapi/generated/model',
client: 'react-query',
mock: true,
},
input: {
target: './src/openapi/spec.yaml',
},
},
};
In config, I mentioned I want name of 'src/openapi/generated/interface.ts'
- reference, but it created file called default.ts
in a default
named directory - reference.
Do you know if I am missing something?
Also, how does msw
act here? Currently, my own handlers are intercepting the request, how do I make use of the ones created by orval
?
Thanks. much again!
from orval.
I figured how to use fake data using msw
, however, it is not closer to my domain model so I will leave it for now. When you get a chance, please let me know how to honor the name of the output.target
file instead of using default/default.ts
. Thank you
from orval.
Hello, it's because you use the mode tags-split. You maybe want the default mode 'single'? or 'split' depending on if you are using the mock.
from orval.
Thank you @anymaniax, with mode: single
, I was able to generate a single file. reference
from orval.
Related Issues (20)
- Support for Svelte Query v5 HOT 1
- Node16 or bundler module resolution causes TS2742 error HOT 1
- Missing import of enum const in generated mock when using split mode HOT 5
- Mock TypeError custom override HOT 7
- Possibility of TS2563 error for mock generation HOT 5
- TS2300 Duplicate identifier: duplicated imports when `mock` enabled HOT 7
- Allow overriding entire handler function in generated MSW handlers, not just response object
- Invalid typescript generation for empty schema HOT 4
- msw generation does not import used models HOT 1
- Mock generation doesn't guarantee the required property mocking
- Is possible ignore the changes in the line of OpenAPI spec version ? HOT 2
- Another duplicate export edge case
- Specify mock property overrides for a specific schema HOT 2
- Support replacing types with custom ones when transforming the input HOT 5
- React Query: Regression in 6.25.0 caused by #1207 HOT 5
- Is possible ignore the changes in the line of OpenAPI spec version ?
- Orval generates wrong import paths in ESM-only package HOT 3
- Pass an additional option object in fetcher function when using custom axios instance HOT 4
- usePrefetch+useSuspenseQuery incorrectly generates prefetchSuspenseQuery calls
- bug: readonly fields missing from mutation function input types
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orval.