You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I love prism, and being able to easily mock a server with some examples responses
it's also really useful that prism can automatically generate example data dynamically using faker
currently, when you have dynamic mode turned on, examples are not used by default
i would like a way to get the best of both worlds somehow
Context
i use prism to mock a schema from an open-api spec
i also use hey-api to automatically generate a typescript client for interacting with the server
the typescript client does not know about the Prefer header because this is not part of the real server's schema
i could add the Prefer header as a param to the spec, but this would only be for the sake of prism, as the real server does not actually care about this header (which would mean that the spec is actually wrong)
i can work around this issue by NOT using the automatically generated typescript client, but this seems a shame
Current Behavior
currently, when dynamic mode is turned off, prism will return the first listed example by default
any other examples are ignored unless you specifically request them using the Prefer header
when dynamic mode is turned on, all examples are ignored unless you use the Prefer header
when dynamic mode is turned on, auto-generated responses using faker are created for all endpoints regardless of if examples exist
the examples are only returned if you send a Prefer header
Expected Behavior
i would like a way to be able to get dynamically generated responses for the endpoints that don't have a Prefer header, and still get the hard-coded examples by default for endpoints that have examples defined
i don't want to have set a header that the real API doesn't know about (because then i can't use my automatically generated API client)
Possible Solution(s)
could add an extra flag, --use-examples, which only matters when dynamic mode is turned on
when this additional flag is set, you get an example by default if one is set
The text was updated successfully, but these errors were encountered:
Context
Prefer
header because this is not part of the real server's schemaPrefer
header as a param to the spec, but this would only be for the sake of prism, as the real server does not actually care about this header (which would mean that the spec is actually wrong)Current Behavior
Expected Behavior
Possible Solution(s)
--use-examples
, which only matters when dynamic mode is turned onThe text was updated successfully, but these errors were encountered: