Skip to content

Issue #KN-000 fix: gcp schema fix#1102

Merged
pallakartheekreddy merged 2 commits intoSunbird-Knowlg:release-6.1.0from
aimansharief:schema-isssue
Jun 25, 2025
Merged

Issue #KN-000 fix: gcp schema fix#1102
pallakartheekreddy merged 2 commits intoSunbird-Knowlg:release-6.1.0from
aimansharief:schema-isssue

Conversation

@aimansharief
Copy link
Copy Markdown
Collaborator

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.

Type of change

Please choose appropriate options.

  • 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)
  • This change requires a documentation update

How Has This Been Tested?

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

  • Ran Test A
  • Ran Test B

Test Configuration:

  • Software versions: Java 11, scala-2.12, play-2.7.2
  • Hardware versions: 2 CPU/ 4GB RAM

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

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 addresses an issue with GCP schema processing by updating the way the JSON schema is read from the provided InputStream.

  • The method now reads the full stream into a byte array and wraps it in a ByteArrayInputStream before processing.
  • The method signature has been updated to declare that it throws Exception.

*/
protected JsonSchema readSchema(InputStream stream) {
try (JsonSchemaReader reader = schemaReaderFactory.createSchemaReader(stream)) {
protected JsonSchema readSchema(InputStream stream) throws Exception{
Copy link

Copilot AI May 27, 2025

Choose a reason for hiding this comment

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

Avoid throwing a generic 'Exception' in the method signature; consider specifying a more precise exception type that relates directly to JSON schema processing.

Copilot uses AI. Check for mistakes.
protected JsonSchema readSchema(InputStream stream) {
try (JsonSchemaReader reader = schemaReaderFactory.createSchemaReader(stream)) {
protected JsonSchema readSchema(InputStream stream) throws Exception{
byte[] bytes = stream.readAllBytes();
Copy link

Copilot AI May 27, 2025

Choose a reason for hiding this comment

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

Reading the entire InputStream into a byte array may impact performance and memory usage if the schema is large; consider using a buffered approach if large schemas are expected.

Copilot uses AI. Check for mistakes.
@pallakartheekreddy pallakartheekreddy merged commit 91f3562 into Sunbird-Knowlg:release-6.1.0 Jun 25, 2025
0 of 2 checks passed
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