Skip to content

refactor(core): enhance class implementations and documentation #162

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

J3m5
Copy link
Contributor

@J3m5 J3m5 commented Jul 22, 2025

  • 🔄 Refactored core classes (Api, Field, Operation, Resource) to implement their respective options interfaces.

  • 🧹 Removed the assignSealed utility function and replaced it with Object.assign for property assignment.

  • 📜 Improved JSDoc comments for better clarity and type annotations.

  • 📦 Updated package.json to include exports for core module types and adjusted linting commands.

  • 🗑️ Cleaned up unused Oxlint and Unicorn rules in the configuration.

J3m5 added 7 commits July 23, 2025 00:53
…erfaces

- Updated .oxlintrc.json to enable @typescript-eslint/no-unsafe-declaration-merging rule
- Updated Api, Field, Operation, and Resource classes to implement their respective options interfaces.
- Declare all the fields in the classes instead of relying on interface declaration merging
- Update openapi3 test to take new fields order

Signed-off-by: J3m5 <5523410+J3m5@users.noreply.github.com>
- Removed assignSealed utility function.
- Updated constructors in Api, Field, Operation, and Resource classes to use Object.assign for property assignment.

Signed-off-by: J3m5 <5523410+J3m5@users.noreply.github.com>
- Edit .oxlintrc.json to enable jsdoc plugin
- Added parameter and return type annotations in buildEnumObject, getType, fetchJsonLd, parseHydraDocumentation, and handleJson functions.

Signed-off-by: J3m5 <5523410+J3m5@users.noreply.github.com>
Signed-off-by: J3m5 <5523410+J3m5@users.noreply.github.com>
…ntation

Signed-off-by: J3m5 <5523410+J3m5@users.noreply.github.com>
…ormat

- Changed lint:fix command to include --fix-suggestions
- Updated runtime version format to include a space

Signed-off-by: J3m5 <5523410+J3m5@users.noreply.github.com>
Signed-off-by: J3m5 <5523410+J3m5@users.noreply.github.com>
@J3m5 J3m5 self-assigned this Jul 22, 2025
Copy link

github-actions bot commented Jul 22, 2025

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 70.63% (🎯 70%) 279 / 395
🟢 Statements 70.6% (🎯 70%) 281 / 398
🟢 Functions 70.31% (🎯 70%) 45 / 64
🟢 Branches 58.51% (🎯 58%) 220 / 376
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/core/Api.ts 100% 100% 100% 100%
src/core/Field.ts 100% 100% 100% 100%
src/core/Operation.ts 100% 100% 100% 100%
src/core/Resource.ts 100% 100% 100% 100%
src/core/utils/buildEnumObject.ts 100% 83.33% 100% 100%
src/core/utils/getType.ts 80% 60% 100% 80% 19
src/hydra/fetchJsonLd.ts 100% 95% 100% 100%
src/hydra/parseHydraDocumentation.ts 87.12% 77.87% 90.9% 87.12% 39, 69-71, 77, 85-87, 91-93, 121-127, 133, 140-142, 221, 236, 297, 308-313, 398
src/openapi3/handleJson.ts 90.47% 65.62% 92.85% 90.36% 39, 58, 123, 174, 181, 195, 205, 216
Generated in workflow #277 for commit 40afd16 by the Vitest Coverage Report Action

@J3m5 J3m5 requested review from a team and Copilot July 22, 2025 22:59
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors core classes to implement their options interfaces directly, removes a custom utility function in favor of native JavaScript, and improves JSDoc documentation consistency. The changes focus on making the codebase more maintainable while enhancing type safety and documentation quality.

  • Refactored Api, Field, Operation, and Resource classes to implement their options interfaces with explicit property declarations
  • Replaced the custom assignSealed utility with native Object.assign for property assignment
  • Standardized JSDoc comments to use proper type annotations and parameter descriptions

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/core/Api.ts Implements ApiOptions interface with explicit property declarations and Object.assign
src/core/Field.ts Implements FieldOptions interface with explicit property declarations and Object.assign
src/core/Operation.ts Implements OperationOptions interface with explicit property declarations and Object.assign
src/core/Resource.ts Implements ResourceOptions interface with explicit property declarations and Object.assign
src/core/utils/assignSealed.ts Removes the custom assignSealed utility function
src/core/utils/index.ts Removes export of assignSealed function
src/core/index.ts Adds export for types module
package.json Adds core module exports and updates linting command
.oxlintrc.json Updates linting rules configuration
src/core/utils/getType.ts Standardizes JSDoc parameter and return type annotations
src/core/utils/buildEnumObject.ts Standardizes JSDoc parameter and return type annotations
src/hydra/fetchJsonLd.ts Adds JSDoc parameter and return type annotations
src/hydra/parseHydraDocumentation.ts Adds comprehensive JSDoc documentation with type annotations
src/openapi3/handleJson.ts Adds return type annotation and standardizes JSDoc
src/openapi3/handleJson.test.ts Reorders test data structure (parameters moved after operations)

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.

1 participant