Skip to content

Adds ContentType to setFileValue#791

Merged
aaronzi merged 1 commit intoeclipse-basyx:mainfrom
aaronzi:main
Jun 27, 2025
Merged

Adds ContentType to setFileValue#791
aaronzi merged 1 commit intoeclipse-basyx:mainfrom
aaronzi:main

Conversation

@aaronzi
Copy link
Copy Markdown
Member

@aaronzi aaronzi commented Jun 27, 2025

Description of Changes

This PR adds the contentType parameter to the setFileValue method, allowing it to automatically set the content type when using the attachment endpoint. The implementation follows the same pattern as setThumbnail in the AAS Service.

@aaronzi aaronzi requested a review from Copilot June 27, 2025 21:23
Copy link
Copy Markdown
Contributor

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 enhances the file upload functionality by adding a new contentType parameter to the setFileValue method so that file uploads can automatically include MIME type information. The changes span service interfaces, controller endpoints, client APIs, backend operations, and tests to update method signatures and documentation accordingly.

  • Updated service and repository interfaces to include a contentType parameter.
  • Modified controllers and client APIs to pass along the content type.
  • Revised tests and documentation to verify the new behavior.

Reviewed Changes

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

Show a summary per file
File Description
basyx.submodelservice-http/SubmodelServiceHTTPApiController.java Updated controller to pass file.getContentType() to setFileValue.
basyx.submodelservice-feature-operation-dispatching/AbstractSubmodelServiceDecorator.java Propagated contentType parameter in decorator method.
basyx.submodelservice-feature-mqtt/MqttSubmodelService.java Updated method signature to include contentType.
basyx.submodelservice-feature-authorization/AuthorizedSubmodelService.java Adjusted setFileValue to forward contentType after permission check.
basyx.submodelservice-core/SubmodelServiceSuite.java Modified tests to pass a MIME type alongside file streams.
basyx.submodelservice/SubmodelService.java Updated interface and Javadoc to include contentType.
basyx.submodelservice-client/SubmodelServiceApi.java & ConnectedSubmodelService.java Updated client API to build multipart requests with a provided contentType.
basyx.submodelservice-backend/SubmodelFileOperations.java & CrudSubmodelService.java Updated file persistence logic to use the new contentType when creating FileMetadata and FileBlobValue.
basyx.submodelrepository (and submodules) Updated repository methods, API controllers, and tests to include contentType for file operations.
basyx.aasenvironment-core/DefaultAASEnvironment.java Adjusted method for setting file content to pass a default contentType string.
Comments suppressed due to low confidence (2)

basyx.submodelservice/basyx.submodelservice-client/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/client/internal/SubmodelServiceApi.java:1199

  • Consider adding error handling to manage cases where ContentType.parse(contentType) might throw an exception on invalid MIME type strings.
			ContentType fileContentType = contentType != null ? ContentType.parse(contentType) : ContentType.DEFAULT_BINARY;

basyx.submodelservice/basyx.submodelservice-core/src/test/java/org/eclipse/digitaltwin/basyx/submodelservice/SubmodelServiceSuite.java:432

  • Consider adding tests to cover edge cases for the contentType parameter, such as null or invalid MIME type values, to ensure robust handling.
		submodelService.setFileValue(idShortPathPropertyInSmeCol, "jsonFile1.json", "application/json", getInputStreamOfDummyFile(DUMMY_JSON_1));

Copy link
Copy Markdown
Member

@FriedJannik FriedJannik left a comment

Choose a reason for hiding this comment

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

Seal Of Approval Thumbs Up GIF

@aaronzi aaronzi merged commit 7945de5 into eclipse-basyx:main Jun 27, 2025
51 of 52 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.

3 participants