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

Prevent mutating $type in the schema while processing requests #1238

Merged
merged 2 commits into from May 1, 2024

Conversation

simhnna
Copy link
Contributor

@simhnna simhnna commented Apr 26, 2024

I'm relying on the wsdl for typechecking and requests mutate $type.

I don't really understand much about the code, but with my change $type is no longer changed and all tests still pass.

This behavior was introduced with an old commit and I would consider changing the schema during request processing to be a bad habit. Ideally the namespaces would be set initially during schema parsing and not touched later.

assert.deepEqual(err.root, responseJSON);
} else {
// assert.deepEqual(json, responseJSON);
assert.equal(JSON.stringify(typeof json === 'undefined' ? null : json), JSON.stringify(responseJSON));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering what was the reason to use stringify and equal instead of deepEqueal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's shamelessly copied from the request/response tests...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it work with the deepEqual?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@simhnna simhnna force-pushed the do-not-change-schema-on-request branch from d9c13e9 to 1c97613 Compare April 30, 2024 06:56
@w666 w666 merged commit aef5e92 into vpulim:master May 1, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants