Skip to content

Commit

Permalink
#1299 PR updates: api/schema/topic -> api/schema/registry, scaladoc
Browse files Browse the repository at this point in the history
  • Loading branch information
dk1844 committed Jun 22, 2020
1 parent 11ef249 commit 8df37f6
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class SchemaController @Autowired()(
uploadSchemaToMenas(principal.getUsername, menasFile, sparkStruct, schemaType)
}

@PostMapping(Array("/topic"))
@PostMapping(Array("/registry"))
@ResponseStatus(HttpStatus.CREATED)
def handleTopicStem(@AuthenticationPrincipal principal: UserDetails,
@RequestParam topicStem: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class SchemaRegistryService @Autowired()() {

/**
* Loading the latest schema by a topicName (e.g. topic1-value), the url is constructed based on the [[schemaRegistryBaseUrl]]
* @param topicName topic name
* @return
* @param topicName topic name to load the Schema by
* @return `SchemaResponse` object containing the obtained schema.
*/
def loadSchemaByTopicName(topicName: String): SchemaResponse = {
val schemaUrl = SchemaRegistryService.getLatestSchemaUrl(schemaRegistryBaseUrl, topicName)
Expand All @@ -51,8 +51,8 @@ class SchemaRegistryService @Autowired()() {

/**
* Loading the schema by a full URL
* @param remoteUrl
* @return
* @param remoteUrl URL to for the Schema to be loaded from
* @return `SchemaResponse` object containing the obtained schema.
*/
def loadSchemaByUrl(remoteUrl: String): SchemaResponse = {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ class SchemaApiIntegrationSuite extends BaseRestApiTest with BeforeAndAfterAll {
}
}

s"POST $apiUrl/topic" should {
s"POST $apiUrl/registry" should {
def topicPath(topicName: String) = s"/subjects/$topicName/versions/latest/schema"

"return 201" when {
Expand All @@ -1022,7 +1022,7 @@ class SchemaApiIntegrationSuite extends BaseRestApiTest with BeforeAndAfterAll {

val params = HashMap[String, Any](
"name" -> schema.name, "version" -> schema.version, "format" -> "avro", "topicStem" -> "myTopic1", "mergeWithKey" -> false)
val responseRemoteLoaded = sendPostTopicName[Schema](s"$apiUrl/topic", params)
val responseRemoteLoaded = sendPostTopicName[Schema](s"$apiUrl/registry", params)
assertCreated(responseRemoteLoaded)

val actual = responseRemoteLoaded.getBody
Expand All @@ -1042,7 +1042,7 @@ class SchemaApiIntegrationSuite extends BaseRestApiTest with BeforeAndAfterAll {

val params = HashMap[String, Any](
"name" -> schema.name, "version" -> schema.version, "format" -> "avro", "topicStem" -> "myTopic1", "mergeWithKey" -> true)
val responseRemoteLoaded = sendPostTopicName[Schema](s"$apiUrl/topic", params)
val responseRemoteLoaded = sendPostTopicName[Schema](s"$apiUrl/registry", params)
assertCreated(responseRemoteLoaded)

val expectedSchema: StructType = DataType.fromJson(readTestResourceAsString(TestResourcePath.AvroCombining.expectedCombination)).asInstanceOf[StructType]
Expand Down
2 changes: 1 addition & 1 deletion menas/ui/components/schema/schemaDetail.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ sap.ui.define([
};

jQuery.ajax({
url: "api/schema/topic",
url: "api/schema/registry",
type: 'POST',
data: $.param(data),
contentType: 'application/x-www-form-urlencoded',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ object StringImplicits {
* "file:///" / "path" -> "file:///path",
* }}}
*
* @param another
* @return
* @param another the second string we are appending after the `/` separator
* @return this/another (this has stripped trailing / if present, another has leading / stripped if present)
*/
def /(another: String): String = { // scalastyle:ignore method.name
joinWithSingleSeparator(another, "/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,9 @@ object SchemaUtils {
/**
* Combines schemas into one. Wrapper for [[SchemaUtils#combineStructFieldLists]]
*
* @param firstType
* @param secondType
* @return
* @param firstType StructType to be combined with `secondType`
* @param secondType StructType to be combined with `firstType`
* @return combined `firstType` + `secondType` (`firstType`` will take precedence for non-combinable fields of the same name)
*/
def combineStructTypes(firstType: StructType, secondType: StructType): StructType =
StructType(combineStructFieldLists(firstType.fields, secondType.fields))
Expand All @@ -600,9 +600,9 @@ object SchemaUtils {
* Combines schemas into one. By-name duplicated struct fields are deep-combined, otherwise the field from `firstFields`
* takes precedence.
*
* @param firstFields
* @param secondFields
* @return
* @param firstFields fields to be combined with `secondFields`
* @param secondFields fields to be combined with `firstFields`
* @return combined `firstFields` + `secondFields` (`firstFields` will take precedence for non-combinable fields of the same name)
*/
def combineStructFieldLists(firstFields: Seq[StructField], secondFields: Seq[StructField]): Seq[StructField] = {
Seq(firstFields, secondFields).foreach{fields =>
Expand Down

0 comments on commit 8df37f6

Please sign in to comment.