Skip to content
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

Suggestions #7

Open
asherccohen opened this issue Jul 18, 2022 · 2 comments
Open

Suggestions #7

asherccohen opened this issue Jul 18, 2022 · 2 comments

Comments

@asherccohen
Copy link

hey, I really like this idea and I have thought of something that could improve it:

I have a scenario where I also have to replicate functional business logic, so it would be nice if:

  • mocked responses were not inlined in each handlers,
  • mocked responses were exported so they could be mutate or used in @msw/data
  • handlers were generated with createHandler function that could take a mocked response as a param
@zoubingwu
Copy link
Owner

Good ideas! Let me think about how we can acheive this.

@asherccohen
Copy link
Author

I had the opportunity to work more with the tool.

I think it has a lot of potential, like I mentioned above being able to work together with @msw/data would improve it even further.

By doing so though there's an important concept to take care of: models don't map 1-1 with yaml response definitions.

Models are created like in typical ORM tools, they let you represent a database.
Endpoint response definitions instead could be an aggregation of different DB entries, or have a completely different shape.

So it would be nice to understand how you could create models from openapi components, but then offer responses based on the endpoint definitions.

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

No branches or pull requests

2 participants