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

Dynamic mock data for mockResponseForOperation #318

Open
ansar opened this issue Feb 9, 2022 · 1 comment
Open

Dynamic mock data for mockResponseForOperation #318

ansar opened this issue Feb 9, 2022 · 1 comment

Comments

@ansar
Copy link

ansar commented Feb 9, 2022

In our OpeApi specification, we don't have any examples.

I am assuming the below would generate the dynamic mock thanks to mockResponseForOperation. But I don't get any response. The data/mock is empty {}(in our case).

api.register('notImplemented', async (c, res, ctx) => {
const { status, mock } = await api.mockResponseForOperation(c.operation.operationId);
return res(ctx.status(status), ctx.json(mock));
});

Also i tried api.mockResponseForOperation('OperationId'); it return no mock data(dynamic generated mock). So my questions is it something openapi-backend support or possible?

@Fetchinator7
Copy link
Contributor

Fetchinator7 commented Feb 12, 2022

Sounds like you're hitting the default mock. It works for me and the project is setup to use a mocking library so your schema probably isn't being provided correctly.

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