-
Notifications
You must be signed in to change notification settings - Fork 63
fix: Response body for post #484
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @VivekHub97 ,
Thanks a lot for the implementation.
Actually, this should be fixed in core [1] and [2] first and then at the Controller side, the return type here in [1] and [2] is void but it should be SubmodelElement, and then at the HttpController [3] and [4] respectively for Repo and Service, it should be like below:
@Override
public ResponseEntity<SubmodelElement> postSubmodelElementSubmodelRepo(Base64UrlEncodedIdentifier submodelIdentifier, @Valid SubmodelElement body) {
SubmodelElement createdSME = repository.createSubmodelElement(submodelIdentifier.getIdentifier(), body);
return new ResponseEntity<SubmodelElement>(createdSME, HttpStatus.CREATED);
}Inside SubmodelRepoHttpController [3] the method postSubmodelElementByPathSubmodelRepo is not fixed.
Following is the summary:
- Update interfaces of SubmodelRepository [1] and SubmodelService [2] for createSubmodelElement methods (there are multiple overloaded methods) such that the return type is SME instead of void.
- Then handle this appropriately wherever these interfaces are implemented possibly in all implementations (Crud*Repo) and all features.
- Update HTTP controllers for SMRepo [3] and SMService [4] like I defined above
- Update the test cases to additionally check the creation response wherever required. (Maybe do this first to achieve Test Driven Development).
[1] basyx-java-server-sdk/basyx.submodelrepository/basyx.submodelrepository-core/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/SubmodelRepository.java at main · eclipse-basyx/basyx-java-server-sdk (github.com)
[2] basyx-java-server-sdk/basyx.submodelservice/basyx.submodelservice-core/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/SubmodelService.java at main · eclipse-basyx/basyx-java-server-sdk (github.com)
[3] basyx-java-server-sdk/basyx.submodelrepository/basyx.submodelrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/http/SubmodelRepositoryApiHTTPController.java at main · eclipse-basyx/basyx-java-server-sdk (github.com)
[4] basyx-java-server-sdk/basyx.submodelservice/basyx.submodelservice-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/http/SubmodelServiceHTTPApiController.java at main · eclipse-basyx/basyx-java-server-sdk (github.com)
e7d1b97 to
52e3ab5
Compare
mdanish98
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no tests in the SubmodelServiceSuite. Please add them as well.
...in/java/org/eclipse/digitaltwin/basyx/submodelrepository/backend/CrudSubmodelRepository.java
Show resolved
Hide resolved
...in/java/org/eclipse/digitaltwin/basyx/submodelrepository/backend/CrudSubmodelRepository.java
Show resolved
Hide resolved
...va/org/eclipse/digitaltwin/basyx/submodelrepository/feature/mqtt/MqttSubmodelRepository.java
Outdated
Show resolved
Hide resolved
...va/org/eclipse/digitaltwin/basyx/submodelrepository/feature/mqtt/MqttSubmodelRepository.java
Outdated
Show resolved
Hide resolved
.../org/eclipse/digitaltwin/basyx/submodelrepository/feature/mqtt/TestMqttSubmodelObserver.java
Outdated
Show resolved
Hide resolved
...godb/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/MongoDBSubmodelService.java
Outdated
Show resolved
Hide resolved
...godb/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/MongoDBSubmodelService.java
Outdated
Show resolved
Hide resolved
...e-core/src/test/java/org/eclipse/digitaltwin/basyx/submodelservice/SubmodelServiceSuite.java
Show resolved
Hide resolved
...ain/java/org/eclipse/digitaltwin/basyx/submodelservice/feature/mqtt/MqttSubmodelService.java
Outdated
Show resolved
Hide resolved
...ain/java/org/eclipse/digitaltwin/basyx/submodelservice/feature/mqtt/MqttSubmodelService.java
Outdated
Show resolved
Hide resolved
This reverts commit 03405aa.
fix: Response body for posting in submodel repository and submodel service
Closes #398
Closes #457