Syntax for mocks
Different languages have ways of generating mock data. E.g., email address, person name, location.
Example fields in OpenAPI are useful for handwriting these.
With Arazzo the complexity could increase seriously, and one would need to trace ids through complex examples (e.g., pet name + adopter name leading to a trade to a new adopter then list all pets owned by that adopter).
One major use-case I see for Arazzo is generating tests + mocks for ones API.
What do you think about having a special syntax for defining mocks within Arrazo?
Off the top of my head, I feel like this is one area where the extension mechanism would be useful. Enforcing a specific syntax for mocks seems against the idea of allowing tool vendors/implementors their own ways to provide that. But perhaps I am missing some context with this as I've never been a big fan of mocks especially with the ease of using containers and such to provide services fairly easily.
@kevinduffey Sure but things can get very complicated very quickly. Say you wanted to document 🚩 reporting a reply-comment. The examples would need to demonstrate:
- Create >1 user
- Make >0 of them moderators
- Authenticate users, using their access-tokens to perform the following:
- Create >0 post by >0 user
- Create >0 comments-on-post by >0 user
- Create >0 reports on comments-on-post by >0 user where reporting user != user-who-posted-comment
That's a fairly reasonable thing to write tests for. And these tests would be applicable for both the frontend(s) and the backend(s). It's also a reasonable thing to expect to see examples for, and you could have some fancy documentation frontends which walk you through the example pipeline [Arazzo] of steps until you get to the report-on-comment stage. By additionally adding a layer of good-naming, the resulting documentation + mocks + tests become extremely readable and clean.