Skip to content

Add the schema admin api #4800

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

Merged
merged 3 commits into from
Jul 30, 2019
Merged

Add the schema admin api #4800

merged 3 commits into from
Jul 30, 2019

Conversation

congbobo184
Copy link
Contributor

Motivation

Continue the issues of #4782

Verifying this change

Add the tests for it

Does this pull request potentially affect one of the following parts:
If yes was chosen, please highlight the changes

Dependencies (does it add or upgrade a dependency): (no)
The public API: (no)
The schema: (yes)
The default values of configurations: (no)
The wire protocol: (no)
The rest endpoints: (no)
The admin cli options: (no)
Anything that affects deployment: (no)

Documentation

Does this pull request introduce a new feature? (yes / no)
If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
If a feature is not applicable for documentation, explain why?
If a feature is not documented yet in this PR, please create a followup issue for adding the documentation

@congbobo184
Copy link
Contributor Author

run Integration Tests

@congbobo184
Copy link
Contributor Author

run Integration Tests

1 similar comment
@congbobo184
Copy link
Contributor Author

run Integration Tests

Copy link
Member

@sijie sijie left a comment

Choose a reason for hiding this comment

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

overall looks good. can you add tests for these endpoints?

@ApiResponse(code = 401, message = "Client is not authorized or Don't have admin permission"),
@ApiResponse(code = 403, message = "Client is not authenticated"),
@ApiResponse(code = 404, message = "Tenant or Namespace or Topic doesn't exist; or Schema is not found for this topic"),
@ApiResponse(code = 412, message = "Failed to find the ownership for the topic"),
Copy link
Member

Choose a reason for hiding this comment

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

does this method return 500?

if (isNull(schemas)) {
response.resume(Response.status(Response.Status.NOT_FOUND).build());
} else if (schemas.size() == 0) {
response.resume(Response.status(Response.Status.NOT_FOUND).build());
Copy link
Member

Choose a reason for hiding this comment

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

should we return ok with an empty list? or do you have any thought about returning NOT_FOUND?

Response.ok()
.encoding(MediaType.APPLICATION_JSON)
.entity(GetAllVersionsSchemaResponse.builder().getSchemaResponses(
schemas.stream().map(schemaAndMetadata -> GetSchemaResponse.builder()
Copy link
Member

Choose a reason for hiding this comment

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

Can you extract the schemaAndMetadata to GetSchemaResponse transformation into a common method? I think it should be reused across this class.


String schemaId = buildSchemaId(tenant, namespace, topic);

SchemaCompatibilityStrategy schemaCompatibilityStrategy =SchemaCompatibilityStrategy
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
SchemaCompatibilityStrategy schemaCompatibilityStrategy =SchemaCompatibilityStrategy
SchemaCompatibilityStrategy schemaCompatibilityStrategy = SchemaCompatibilityStrategy

@congbobo184
Copy link
Contributor Author

overall looks good. can you add tests for these endpoints?

OK, I will add tests and fix these problems from your comment

@congbobo184
Copy link
Contributor Author

run Integration Tests

Copy link
Member

@jiazhai jiazhai left a comment

Choose a reason for hiding this comment

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

+1

@sijie sijie merged commit 8d19575 into apache:master Jul 30, 2019
@wolfstudy wolfstudy modified the milestones: 2.5.0, 2.4.2 Nov 14, 2019
@wolfstudy
Copy link
Member

Change the Milestone to 2.4.2, because of conflict.

wolfstudy pushed a commit that referenced this pull request Nov 20, 2019
### Motivation
Continue the issues of #4782

### Verifying this change
Add the tests for it

(cherry picked from commit 8d19575)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants