[PR #1549] [MERGED] refactor: CLibcurl Generator. #3386

Closed
opened 2026-03-17 01:00:25 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/1549
Author: @JayceDugan
Created: 3/20/2021
Status: Merged
Merged: 3/20/2021
Merged by: @liyasthomas

Base: refactor/codegenHead: refactor/generators/c-libcurl


📝 Commits (2)

  • cd203fb refactor: CLibcurl Generator.
  • 1a180e4 refactor: CLibcurl Generator.

📊 Changes

3 files changed (+145 additions, -51 deletions)

View changed files

📝 helpers/codegen/codegen.js (+1 -1)
📝 helpers/codegen/generators/c-libcurl.js (+79 -50)
helpers/codegen/generators/generator.js (+65 -0)

📄 Description

Overview:

This PR provides the following:

  • New generic Generator class to be used in ongoing refactoring for generators. (helpers/codegen/generators/generator.js)
  • Refactoring and isolation of methods of the CLibcurl generator found in (helpers/codegen/generators/c-libcurl.js)

Squashed Commits:

feat: New Generator class to serve as parent class for generators.

refactor: c-libcurl.js export to class instance & isolated methods.

fix: Refactor for CLIBcurlCodegen import to expect default export.

fix: Default generator properties added and reset by generator().

When calling a generator multiple times during testing, because the generator is only
instantiated on export, ie "export default new CLibCurlCodeGen()", any properties assigned to
"this" live past a single generator instance.

The default export new CLibCurlCodeGen() is implemented to reduce additional changes or conditional
logic around old or new generators, so resetting these properties provides a nice abstraction to
ensure properties are fresh when generator() is called.

refactor: Common getters from c-libcurl to base Generator class instance.

resolves #1548


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/1549 **Author:** [@JayceDugan](https://github.com/JayceDugan) **Created:** 3/20/2021 **Status:** ✅ Merged **Merged:** 3/20/2021 **Merged by:** [@liyasthomas](https://github.com/liyasthomas) **Base:** `refactor/codegen` ← **Head:** `refactor/generators/c-libcurl` --- ### 📝 Commits (2) - [`cd203fb`](https://github.com/hoppscotch/hoppscotch/commit/cd203fb99e67a15816600a88f80eaea20738d7bc) refactor: CLibcurl Generator. - [`1a180e4`](https://github.com/hoppscotch/hoppscotch/commit/1a180e49aed798a4a9c3ae36c14f1f0b948b6dab) refactor: CLibcurl Generator. ### 📊 Changes **3 files changed** (+145 additions, -51 deletions) <details> <summary>View changed files</summary> 📝 `helpers/codegen/codegen.js` (+1 -1) 📝 `helpers/codegen/generators/c-libcurl.js` (+79 -50) ➕ `helpers/codegen/generators/generator.js` (+65 -0) </details> ### 📄 Description #### Overview: This PR provides the following: - New generic `Generator` class to be used in ongoing refactoring for generators. (`helpers/codegen/generators/generator.js`) - Refactoring and isolation of methods of the CLibcurl generator found in (`helpers/codegen/generators/c-libcurl.js`) #### Squashed Commits: ``` feat: New Generator class to serve as parent class for generators. refactor: c-libcurl.js export to class instance & isolated methods. fix: Refactor for CLIBcurlCodegen import to expect default export. fix: Default generator properties added and reset by generator(). When calling a generator multiple times during testing, because the generator is only instantiated on export, ie "export default new CLibCurlCodeGen()", any properties assigned to "this" live past a single generator instance. The default export new CLibCurlCodeGen() is implemented to reduce additional changes or conditional logic around old or new generators, so resetting these properties provides a nice abstraction to ensure properties are fresh when generator() is called. refactor: Common getters from c-libcurl to base Generator class instance. ``` resolves #1548 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 01:00:25 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#3386
No description provided.