orval icon indicating copy to clipboard operation
orval copied to clipboard

feat(msw): split polymorphic mocks into its own functions

Open AffeJonsson opened this issue 9 months ago • 4 comments

Status

READY

Description

Fixes #1318 This splits response mocks where the response contains objects that have a base object. The specification in the linked issue is an example of a response mock that will get split. image

Todos

  • [ ] Tests
  • [ ] Documentation
  • [ ] Changelog Entry (unreleased)

Steps to Test or Reproduce

  1. Generate using a specification that contains a allOf prop, e.g. the one in the linked issue.
  2. Notice that the response mock contains calls to functions that has been generated above.
  3. Notice that no errors exists

AffeJonsson avatar May 13 '24 07:05 AffeJonsson

@AffeJonsson

A conflict occurred when I merged the following PR. Could you please check again and correct it?

https://github.com/anymaniax/orval/pulls?q=is%3Apr+is%3Aclosed

soartec-lab avatar May 14 '24 10:05 soartec-lab

@AffeJonsson

A conflict occurred when I merged the following PR. Could you please check again and correct it?

https://github.com/anymaniax/orval/pulls?q=is%3Apr+is%3Aclosed

Merged master and did a small update to make overrideResponse param Partial<name>, just like the new overrideResponse code

AffeJonsson avatar May 14 '24 11:05 AffeJonsson

Maybe wait with this until #1199 is complete? I assume we might need to change this when it is completed anyway

AffeJonsson avatar May 14 '24 19:05 AffeJonsson

@AffeJonsson

No, they says it will take time, so we unnecessary wait. And. I'll share it to they. I would like to check this PR, but please forgive me if it takes a little more time.

soartec-lab avatar May 14 '24 23:05 soartec-lab

it would make sense to regenerate samples

example in screenshot has overrideResponse twice 🤔

...overrideResponse
// some faker
...overrideResponse

karlismelderis-mckinsey avatar May 15 '24 12:05 karlismelderis-mckinsey

it would make sense to regenerate samples

example in screenshot has overrideResponse twice 🤔

...overrideResponse
// some faker
...overrideResponse

This is no longer the case after your PR was merged, only one overrideResponse is now present

AffeJonsson avatar May 15 '24 13:05 AffeJonsson

Seems I broke tests with this, fixing...

AffeJonsson avatar May 16 '24 10:05 AffeJonsson

@AffeJonsson Please let me know when this is ready for me to review 👍

soartec-lab avatar May 19 '24 03:05 soartec-lab

@AffeJonsson Please let me know when this is ready for me to review 👍

It's ready!

AffeJonsson avatar May 19 '24 05:05 AffeJonsson