-
Notifications
You must be signed in to change notification settings - Fork 61
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
Promoted Schema Requests should use the PROMOTE REQUEST_OPERATION_TYPE #1546
Comments
Greetings! @aindriu-aiven I would like to work on this could you please provide the GitHub link to the file |
@Sadaf-A of course thanks for contributing! Here is the SchemaRegistryController Here is the SchemaRegistryControllerService Here is the SchemaRequestResponseModel Let me know if you have any questions. |
Hey @Sadaf-A At the moment in Klaw all requests are created with a State from this enum https://github.com/Aiven-Open/klaw/blob/main/core/src/main/java/io/aiven/klaw/model/enums/RequestOperationType.java however for schemas at the moment when a schema is promoted from a lower environment to a higher environment it uses the create value instead of the promote value. This is stored forever in the database as an audit trail. We would like to make sure that the audit trail is as accurate as possible by having that value set as PROMOTE which reflects the operation executed by the user and not a direct create onto a restricted environment. |
@aindriu-aiven Thanks, I'll try to open a PR as soon as possible |
No rush take your time to get used to the code base! |
What happened?
Promoted Schema Requests use the CREATE REQUEST_OPERATION_TYPE when promoting a schema from one environment to the next.
What did you expect to happen?
Schema Requests should use the PROMOTE REQUEST_OPERATION_TYPE when promoting an existing schema to a higher environment.
What else do we need to know?
This is a defect found in version 2.4.0 and affects all versions.
This defect requires one change in the Backend code in the SchemaRegistryControllerService.
In the SchemaRegistryController, the "/promote/schema/" rest api invokes the method upload schema. This method chould be updated to take a RequestOperationType parameter. uploadSchema is called from the rest endpoint "/uploadSchema" to create a new schema as well.
The rest endpoint can be set to always be CREATE for the uploadSchema endpoint and for the promote endpoint it can be always set to PROMOTE. Then in the uploadSchema method use the passed in variable to set the RequestOperationType.
Unit tests should be provided to ensure that the correct RequestOperationType is being set for both paths.
Also be sure to test the approval of the promoted schema using the PROMOTE request operation type!
To improve the openapi.yaml accuracy the SchemaRequestResponseModel should be updated to only show the CREATE and PROMOTE options. This can be done by overriding the BaseRequestsResponseModel by adding.
@Schema(
type = "string",
allowableValues = {"CREATE", "PROMOTE"})
@NotNull
private RequestOperationType requestOperationType;
The text was updated successfully, but these errors were encountered: