Skip to content

feat(core): add helper function for override schema of models#2284

Merged
a-ganguly merged 1 commit into
masterfrom
gh-86
Jul 4, 2025
Merged

feat(core): add helper function for override schema of models#2284
a-ganguly merged 1 commit into
masterfrom
gh-86

Conversation

@Tyagi-Sunny
Copy link
Copy Markdown
Contributor

add helper function for override schema of models

  • this function checks for new Model in old Model's metadata, and use it if it presents

gh-86

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Intermediate change (work in progress)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Checklist:

  • Performed a self-review of my own code
  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Any dependent changes have been merged and published in downstream modules

@Tyagi-Sunny Tyagi-Sunny requested a review from a team as a code owner June 17, 2025 06:35
@rohit-sourcefuse rohit-sourcefuse requested a review from Copilot June 17, 2025 06:56
Copy link
Copy Markdown

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 introduces a helper function to override model JSON schemas via metadata and exposes it in the core package.

  • Added a new build-schema module export in index.ts.
  • Defined OVERRIDE_MODEL_SCHEMA_KEY and implemented getModelSchemaRefSF in build-schema.ts to use override metadata when generating a model’s JSON schema reference.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/core/src/index.ts Exported the new build-schema module
packages/core/src/build-schema.ts Added metadata key and helper function to override model schemas
Comments suppressed due to low confidence (3)

packages/core/src/build-schema.ts:18

  • [nitpick] The function name getModelSchemaRefSF is ambiguous; consider renaming it to something more descriptive like getModelSchemaWithOverrideRef to clarify its purpose.
export function getModelSchemaRefSF<T extends object>(

packages/core/src/build-schema.ts:10

  • This comment refers to repository JSON schemas but the key is for overriding model schemas; please update it to accurately describe its intent.
* Metadata key used to set or retrieve repository JSON Schema

packages/core/src/build-schema.ts:18

  • Add unit tests for getModelSchemaRefSF to verify both default schema generation and the override behavior when metadata is present.
export function getModelSchemaRefSF<T extends object>(

Copy link
Copy Markdown
Contributor

@a-ganguly a-ganguly left a comment

Choose a reason for hiding this comment

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

Approved..

Comment thread packages/core/src/build-schema.ts
add helper function for override schema of models

gh-86
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jul 4, 2025

@a-ganguly a-ganguly merged commit 4424278 into master Jul 4, 2025
8 checks passed
@a-ganguly a-ganguly deleted the gh-86 branch July 4, 2025 10:07
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.

4 participants