zoubingwu / msw-auto-mock

A cli tool to generate random mock data from OpenAPI definition for msw.
287 stars 60 forks source link

Suggestions #7

Open asherccohen opened 2 years ago

asherccohen commented 2 years ago

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:

zoubingwu commented 2 years ago

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

asherccohen commented 2 years ago

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.