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

Escape special characters in codegen #734

Conversation

aman-v-singh
Copy link
Contributor

  • Escape special characters to preserve their literal meaning within double quotes

@VShingala
Copy link
Member

@aman-v-singh Tests are failing. Can you fix them and request review?

Copy link
Member

@VShingala VShingala left a comment

Choose a reason for hiding this comment

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

@aman-v-singh Can we add unit/newman tests cases related to this change?

Copy link
Member

@VShingala VShingala left a comment

Choose a reason for hiding this comment

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

@aman-v-singh Since previous fix that we did also addresses other coddegens (see list in below PR), can we make sure that changes made to sanitize function is also addressed in other codegens?

#289

@aman-v-singh aman-v-singh changed the title Escape special characters for curl codegen Escape special characters in codegen Apr 23, 2024
Copy link
Member

@VShingala VShingala left a comment

Choose a reason for hiding this comment

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

We're missing unit test for powershell changes. Let's also add test for it.

@@ -293,8 +293,8 @@ function convert (request, options, callback) {
`${request.method}' -Headers $headers`;
}
else {
codeSnippet += `$response = Invoke-RestMethod '${request.url.toString()}' -CustomMethod ` +
`'${request.method}' -Headers $headers`;
codeSnippet += `$response = Invoke-RestMethod '${request.url.toString().replace(/'/g, '\'\'')}' -CustomMethod ` +
Copy link
Member

Choose a reason for hiding this comment

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

Let's separate out this .replace logic to a common function and utilise it instead of direct logic.

@aman-v-singh aman-v-singh merged commit b5116c1 into develop Apr 26, 2024
1 check failed
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

Successfully merging this pull request may close these issues.

None yet

2 participants