aleksandryackovlev/openapi-mock-express-middleware

Example will always override JSF options

zergeborg opened this issue · 2 comments

Description on the bug

If the OpenAPI schema contains examples, the middleware will ALWAYS return it as part of the response. This very much prevents using the JSF library as intended. Even if I pass {useExamplesValue: false} to JSF, the middleware still uses the examples.

Expected Behavior

If I pass {useExamplesValue: false} to JSF, the middleware should honor this setting.

Actual Behavior

If I pass {useExamplesValue: false} to JSF, the middleware ignores it and it outputs the examples anyway.

Code

app.use(
  '/api', // root path for the mock server
  createMockMiddleware({
    spec: '/Users/openapi-en.yaml',
    options: {
        useExamplesValue: false,
    },
    configure: (jsf) => {
        jsf.option({
            useExamplesValue: false,
        });
    }
  }),
);

How Do We Reproduce?

See above

Fixed in release #48