Skip to content
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

Closed
aindriu-aiven opened this issue Jul 31, 2023 · 5 comments · Fixed by #1569
Closed

Promoted Schema Requests should use the PROMOTE REQUEST_OPERATION_TYPE #1546

aindriu-aiven opened this issue Jul 31, 2023 · 5 comments · Fixed by #1569
Assignees
Labels
Backend Backend tasks bug Something isn't working good first issue Good for newcomers java Pull requests that update Java code

Comments

@aindriu-aiven
Copy link
Contributor

aindriu-aiven commented Jul 31, 2023

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;

@aindriu-aiven aindriu-aiven added bug Something isn't working good first issue Good for newcomers help wanted Backend Backend tasks java Pull requests that update Java code labels Jul 31, 2023
@Sadaf-A
Copy link
Contributor

Sadaf-A commented Aug 4, 2023

Greetings! @aindriu-aiven I would like to work on this could you please provide the GitHub link to the file

@aindriu-aiven
Copy link
Contributor Author

aindriu-aiven commented Aug 4, 2023

@aindriu-aiven
Copy link
Contributor Author

Hey @Sadaf-A
To elaborate a little further on this issue.
One of the nice features Klaw has is that it allows governance by only allowing users to promote from a lowest environment (like dev) to a higher env (test/prod/etc) this means that mistakes are less likely as they move from a tested environment to the next environment.

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.

@Sadaf-A
Copy link
Contributor

Sadaf-A commented Aug 4, 2023

@aindriu-aiven Thanks, I'll try to open a PR as soon as possible

@aindriu-aiven
Copy link
Contributor Author

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend Backend tasks bug Something isn't working good first issue Good for newcomers java Pull requests that update Java code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants