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

fix: Fix quote issue in path pattern #4634

Merged
merged 9 commits into from
Apr 15, 2024
Merged

fix: Fix quote issue in path pattern #4634

merged 9 commits into from
Apr 15, 2024

Conversation

deekshas8
Copy link
Contributor

Closes SAP/cloud-sdk-backlog#4572

Fixes error in generating open api client. Api having path format /path('{param}')/{id} result in syntax error when client is generated. Generation fails with: ErrorWithCause: Could not write file...

@@ -15,7 +15,7 @@ import { serializeSchema } from './schema';
export function serializeOperation(operation: OpenApiOperation): string {
const requestBuilderParams = [
`'${operation.method}'`,
`'${operation.pathPattern}'`
`"${operation.pathPattern}"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Let me check if I understood this correctly:

  • there exist APIs that expect params to be passed like this: example.com/api/entities('5')/something
  • because we used single quotes for the string, the generated code looked like this 'test('{id}')', which is syntactically incorrect?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, correct

Copy link
Contributor

Choose a reason for hiding this comment

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

The ideas some API providers have... 😒

Copy link
Contributor

@mr-flannery mr-flannery left a comment

Choose a reason for hiding this comment

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

lgtm, as far as I can tell. Have you manually run this on the API the author of the issue found the problem on?

@deekshas8
Copy link
Contributor Author

lgtm, as far as I can tell. Have you manually run this on the API the author of the issue found the problem on?

Yes, it generates successfully now.

@deekshas8 deekshas8 merged commit b4bc9ad into main Apr 15, 2024
15 checks passed
@deekshas8 deekshas8 deleted the fix-openapi-error branch April 15, 2024 14:19
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.

[Due: Mar] openapi-generator fails to generate client
2 participants