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

Access to OpenAPI 'operation' object in es2022 scripting. #621

Open
cooperaj opened this issue Sep 2, 2024 · 0 comments
Open

Access to OpenAPI 'operation' object in es2022 scripting. #621

cooperaj opened this issue Sep 2, 2024 · 0 comments

Comments

@cooperaj
Copy link

cooperaj commented Sep 2, 2024

I'm trying to do some slightly more complex mocking by using the '@imposter-js/types' library in a built index.js file but am finding that I don't have access to the context.operation object under the Graal interpreter.

Trying to log it out gives me 14:06:34 INFO s./opt/imposter/config/mock-responses - Operation function () { [native code] } - where 'Operation' is a string prefix on the log line. This tells me it's there but it does not behave as I'd expect as trying to use context.operation.operationId does not work.

It looks like the '@imposter-js/types' library does not natively export the context here annoyingly but in this case I think that just results in a lack of autocomplete when editing.

EDIT
I've just discovered that I can instead use the getOperationId() method (after editing my custom types) and this works.

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

1 participant