Comments (15)
@Priddles is it just a matter of looping over the responses array and generating for each?
Yes, I'd say so.
Some level of deduplication would be good, but definitiely a nice-to-have.
from orval.
Ok assigned the ticket to you.
from orval.
Yes @TommoLeedsy PR would be great.
from orval.
Let me find out
from orval.
Similar to this issue: #1280
from orval.
Isn't this https://orval.dev/reference/configuration/output#generateeachhttpstatus
The setting to generate for each HTTP status?
from orval.
@melloware That is a config option for the mocks, and it does not affect zod generation as far as I can tell.
from orval.
Reopened i thought it did it for mocks and zod. I see now its just mocks.
from orval.
You are right the code is only doing 200
const response = spec?.[verb]?.responses?.['200'] as
| ResponseObject
| ReferenceObject;
from orval.
@Priddles is it just a matter of looping over the responses array and generating for each?
from orval.
@melloware I have a fix for this locally and will put a PR in tomorrow.
from orval.
@melloware @TommoLeedsy Thanks for the quick turnaround!
I saw it got released so I tried it out, but having some issues. Wasn't sure whether to open a new issue or not so putting it here.
I have a minimal reproducible example here.
The issues are:
- It seems to be reading the config from the wrong object.
- It generates a lot of MSW and Faker related code that has nothing to do with Zod.
from orval.
I would open a new ticket.
from orval.
@Priddles Sorry yeah that's my mistake, I didn't realise I needed to add a new config option and just used an existing one instead. I have now added generateEachHttpStatus
to the zod
options. This should sort it. I can put a PR in today?
from orval.
@melloware Do you know when the fix might be released?
from orval.
Related Issues (20)
- React Query keys no longer exported? HOT 3
- Setting delay to false generates invalid function
- Polymorphic mocks are not split when subclass is allOf instead of type: object
- Transformer function not outputting the desired type name HOT 4
- 'vue-query' generated query key getter code is inaccurate
- [Regression in 0.30] Using useQuery: true for POST request generates code that does not compile HOT 2
- Duplicate mock and MSW handler for status 200 when using generateEachHttpStatus=true HOT 2
- Schema compilation fails when using bun as package manager HOT 7
- Missing import for enum with MSW mock generation
- Can not create examples with ref for mock HOT 1
- A better way to manage dynamic API url for Angular HTTP Client HOT 3
- File extension not applied to schemas generated files HOT 9
- Add the ability to import query hooks from a custom path HOT 1
- Use unknown instead of any for additional properties type HOT 3
- How to handle error response codes with fetch? HOT 4
- Vue Query: generates code that doesn't compile for vue-query HOT 4
- Docs incorrect for suppressReadonlyModifier
- mock does not generate correct bigint type HOT 3
- Provide mutator an option to get the original path or operation id
- Zod generate big files HOT 3
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.