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

Add proto name and fullName properties to MessageDescriptor #184

Merged
merged 5 commits into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [0.12.2] - Unreleased
## [0.13.0] - Unreleased

[0.12.2]: https://github.com/streem/pbandk/compare/v0.12.1...HEAD
[0.13.0]: https://github.com/streem/pbandk/compare/v0.12.1...HEAD

### Added

* **[BREAKING CHANGE]** Added `MessageDescriptor.fullName` and `MessageDescriptor.name` properties. All protobuf types have to be regenerated using this versio of `protoc-gen-pbandk`. These properties are currently `internal` but can be exposed publicly if there is a need/use case. (PR [#184])

### Changed

### Fixed

* Suppress warnings about deprecated fields used in generated code. (PR [#182], continues [#1])

[#182]: https://github.com/streem/pbandk/pull/182
[#184]: https://github.com/streem/pbandk/pull/184


## [0.12.1] - 2021-11-11
Expand Down
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Pbandk is a Kotlin code generator and runtime for [Protocol Buffers](https://developers.google.com/protocol-buffers/).
It is built to work across multiple Kotlin platforms.

**NOTE**: This is the documentation for the version of pbandk currently in development. **Documentation for the latest stable version** is available at https://github.com/streem/pbandk/blob/v0.12.2/README.md.
**NOTE**: This is the documentation for the version of pbandk currently in development. **Documentation for the latest stable version** is available at https://github.com/streem/pbandk/blob/v0.12.1/README.md.

**Features**

Expand Down Expand Up @@ -160,7 +160,8 @@ data class Person(
)
}
pbandk.MessageDescriptor(
messageClass = Person::class,
fullName = "tutorial.Person",
messageClass = tutorial.Person::class,
messageCompanion = this,
fields = fieldsList
)
Expand Down Expand Up @@ -219,9 +220,10 @@ data class Person(
)
)
}
pbandk.MessageDescriptor(
messageClass = Person.PhoneNumber::class,
messageCompanion = this,
pbandk.MessageDescriptor(
fullName = "tutorial.Person.PhoneNumber",
messageClass = tutorial.Person.PhoneNumber::class,
messageCompanion = this,
fields = fieldsList
)
}
Expand Down Expand Up @@ -254,7 +256,8 @@ data class AddressBook(
)
}
pbandk.MessageDescriptor(
messageClass = AddressBook::class,
fullName = "tutorial.AddressBook",
messageClass = tutorial.AddressBook::class,
messageCompanion = this,
fields = fieldsList
)
Expand Down Expand Up @@ -339,7 +342,7 @@ repositories {
dependencies {
// Can be used from the `common` sourceset in a Kotlin Multiplatform project,
// or from platform-specific JVM, Android, JS, or Native sourcesets/projects.
implementation("pro.streem.pbandk:pbandk-runtime:0.12.2-SNAPSHOT")
implementation("pro.streem.pbandk:pbandk-runtime:0.13.0-SNAPSHOT")
}
```

Expand Down Expand Up @@ -369,7 +372,7 @@ runtime:

```
dependencies {
compileOnly("pro.streem.pbandk:protoc-gen-pbandk-lib:0.12.2-SNAPSHOT")
compileOnly("pro.streem.pbandk:protoc-gen-pbandk-lib:0.13.0-SNAPSHOT")
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ data class FailureSet(
)
}
pbandk.MessageDescriptor(
fullName = "conformance.FailureSet",
messageClass = pbandk.conformance.pb.FailureSet::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -210,6 +211,7 @@ data class ConformanceRequest(
)
}
pbandk.MessageDescriptor(
fullName = "conformance.ConformanceRequest",
messageClass = pbandk.conformance.pb.ConformanceRequest::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -351,6 +353,7 @@ data class ConformanceResponse(
)
}
pbandk.MessageDescriptor(
fullName = "conformance.ConformanceResponse",
messageClass = pbandk.conformance.pb.ConformanceResponse::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -386,6 +389,7 @@ data class JspbEncodingConfig(
)
}
pbandk.MessageDescriptor(
fullName = "conformance.JspbEncodingConfig",
messageClass = pbandk.conformance.pb.JspbEncodingConfig::class,
messageCompanion = this,
fields = fieldsList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1358,6 +1358,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2",
messageClass = pbandk.conformance.pb.TestAllTypesProto2::class,
messageCompanion = this,
fields = fieldsList
Expand All @@ -1366,18 +1367,18 @@ data class TestAllTypesProto2(
}

sealed class NestedEnum(override val value: Int, override val name: String? = null) : pbandk.Message.Enum {
override fun equals(other: kotlin.Any?) = other is pbandk.conformance.pb.TestAllTypesProto2.NestedEnum && other.value == value
override fun equals(other: kotlin.Any?) = other is TestAllTypesProto2.NestedEnum && other.value == value
override fun hashCode() = value.hashCode()
override fun toString() = "pbandk.conformance.pb.TestAllTypesProto2.NestedEnum.${name ?: "UNRECOGNIZED"}(value=$value)"
override fun toString() = "TestAllTypesProto2.NestedEnum.${name ?: "UNRECOGNIZED"}(value=$value)"

object FOO : NestedEnum(0, "FOO")
object BAR : NestedEnum(1, "BAR")
object BAZ : NestedEnum(2, "BAZ")
object NEG : NestedEnum(-1, "NEG")
class UNRECOGNIZED(value: Int) : pbandk.conformance.pb.TestAllTypesProto2.NestedEnum(value)
class UNRECOGNIZED(value: Int) : NestedEnum(value)

companion object : pbandk.Message.Enum.Companion<pbandk.conformance.pb.TestAllTypesProto2.NestedEnum> {
val values: List<pbandk.conformance.pb.TestAllTypesProto2.NestedEnum> by lazy { listOf(FOO, BAR, BAZ, NEG) }
companion object : pbandk.Message.Enum.Companion<TestAllTypesProto2.NestedEnum> {
val values: List<TestAllTypesProto2.NestedEnum> by lazy { listOf(FOO, BAR, BAZ, NEG) }
override fun fromValue(value: Int) = values.firstOrNull { it.value == value } ?: UNRECOGNIZED(value)
override fun fromName(name: String) = values.firstOrNull { it.name == name } ?: throw IllegalArgumentException("No NestedEnum with name: $name")
}
Expand Down Expand Up @@ -1420,6 +1421,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.NestedMessage",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.NestedMessage::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -1465,6 +1467,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MapInt32Int32Entry",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MapInt32Int32Entry::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -1510,6 +1513,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MapInt64Int64Entry",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MapInt64Int64Entry::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -1555,6 +1559,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MapUint32Uint32Entry",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MapUint32Uint32Entry::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -1600,6 +1605,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MapUint64Uint64Entry",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MapUint64Uint64Entry::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -1645,6 +1651,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MapSint32Sint32Entry",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MapSint32Sint32Entry::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -1690,6 +1697,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MapSint64Sint64Entry",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MapSint64Sint64Entry::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -1735,6 +1743,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MapFixed32Fixed32Entry",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MapFixed32Fixed32Entry::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -1780,6 +1789,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MapFixed64Fixed64Entry",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MapFixed64Fixed64Entry::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -1825,6 +1835,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MapSfixed32Sfixed32Entry",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MapSfixed32Sfixed32Entry::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -1870,6 +1881,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MapSfixed64Sfixed64Entry",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MapSfixed64Sfixed64Entry::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -1915,6 +1927,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MapInt32FloatEntry",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MapInt32FloatEntry::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -1960,6 +1973,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MapInt32DoubleEntry",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MapInt32DoubleEntry::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -2005,6 +2019,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MapBoolBoolEntry",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MapBoolBoolEntry::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -2050,6 +2065,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MapStringStringEntry",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MapStringStringEntry::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -2095,6 +2111,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MapStringBytesEntry",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MapStringBytesEntry::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -2140,6 +2157,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MapStringNestedMessageEntry",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MapStringNestedMessageEntry::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -2185,6 +2203,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MapStringForeignMessageEntry",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MapStringForeignMessageEntry::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -2230,6 +2249,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MapStringNestedEnumEntry",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MapStringNestedEnumEntry::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -2275,6 +2295,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MapStringForeignEnumEntry",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MapStringForeignEnumEntry::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -2320,6 +2341,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.Data",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.Data::class,
messageCompanion = this,
fields = fieldsList
Expand All @@ -2346,6 +2368,7 @@ data class TestAllTypesProto2(
fieldsList.apply {
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MessageSetCorrect",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MessageSetCorrect::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -2380,6 +2403,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MessageSetCorrectExtension1",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MessageSetCorrectExtension1::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -2414,6 +2438,7 @@ data class TestAllTypesProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.TestAllTypesProto2.MessageSetCorrectExtension2",
messageClass = pbandk.conformance.pb.TestAllTypesProto2.MessageSetCorrectExtension2::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -2450,6 +2475,7 @@ data class ForeignMessageProto2(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.ForeignMessageProto2",
messageClass = pbandk.conformance.pb.ForeignMessageProto2::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -2529,6 +2555,7 @@ data class UnknownToTestAllTypes(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.UnknownToTestAllTypes",
messageClass = pbandk.conformance.pb.UnknownToTestAllTypes::class,
messageCompanion = this,
fields = fieldsList
Expand Down Expand Up @@ -2562,6 +2589,7 @@ data class UnknownToTestAllTypes(
)
}
pbandk.MessageDescriptor(
fullName = "protobuf_test_messages.proto2.UnknownToTestAllTypes.OptionalGroup",
messageClass = pbandk.conformance.pb.UnknownToTestAllTypes.OptionalGroup::class,
messageCompanion = this,
fields = fieldsList
Expand Down
Loading