-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new get schema id endpoint
- Loading branch information
Showing
5 changed files
with
258 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
.../io/confluent/kafka/schemaregistry/client/rest/entities/requests/FindSchemaIdRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
* Copyright 2018 Confluent Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.confluent.kafka.schemaregistry.client.rest.entities.requests; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
import io.confluent.kafka.schemaregistry.client.rest.entities.Schema; | ||
import io.confluent.kafka.schemaregistry.client.rest.entities.SchemaTypeConverter; | ||
import io.confluent.kafka.schemaregistry.utils.JacksonMapper; | ||
import java.io.IOException; | ||
import java.util.Objects; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@io.swagger.v3.oas.annotations.media.Schema(description = "Find schema id request") | ||
public class FindSchemaIdRequest { | ||
|
||
private String schemaType; | ||
private String schema; | ||
|
||
public FindSchemaIdRequest() { | ||
} | ||
|
||
public static FindSchemaIdRequest fromJson(String json) throws IOException { | ||
return JacksonMapper.INSTANCE.readValue(json, FindSchemaIdRequest.class); | ||
} | ||
|
||
@io.swagger.v3.oas.annotations.media.Schema(description = Schema.TYPE_DESC) | ||
@JsonProperty("schemaType") | ||
@JsonSerialize(converter = SchemaTypeConverter.class) | ||
public String getSchemaType() { | ||
return this.schemaType; | ||
} | ||
|
||
@JsonProperty("schemaType") | ||
public void setSchemaType(String schemaType) { | ||
this.schemaType = schemaType; | ||
} | ||
|
||
@io.swagger.v3.oas.annotations.media.Schema(description = Schema.SCHEMA_DESC) | ||
@JsonProperty("schema") | ||
public String getSchema() { | ||
return this.schema; | ||
} | ||
|
||
@JsonProperty("schema") | ||
public void setSchema(String schema) { | ||
this.schema = schema; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
FindSchemaIdRequest that = (FindSchemaIdRequest) o; | ||
return Objects.equals(schemaType, that.schemaType) | ||
&& Objects.equals(schema, that.schema); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(schemaType, schema); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder buf = new StringBuilder(); | ||
buf.append("{"); | ||
buf.append("schemaType=").append(this.schemaType).append(", "); | ||
buf.append("schema=").append(schema).append("}"); | ||
return buf.toString(); | ||
} | ||
|
||
public String toJson() throws IOException { | ||
return JacksonMapper.INSTANCE.writeValueAsString(this); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters