Skip to content

Commit

Permalink
[breaking] Renamed gRPC field `cc.arduino.cli.commands.v1.PlatformRel…
Browse files Browse the repository at this point in the history
…ease.type` to `types` (#2620)
  • Loading branch information
cmaglie committed May 30, 2024
1 parent 81d517b commit b72f5ca
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 92 deletions.
20 changes: 10 additions & 10 deletions commands/service_platform_search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestPlatformSearch(t *testing.T) {
Releases: map[string]*rpc.PlatformRelease{
"1.0.5": {
Name: "RK002",
Type: []string{"Contributed"},
Types: []string{"Contributed"},
Installed: false,
Version: "1.0.5",
Boards: []*rpc.Board{{Name: "RK002"}},
Expand All @@ -79,7 +79,7 @@ func TestPlatformSearch(t *testing.T) {
},
"1.0.6": {
Name: "RK002",
Type: []string{"Contributed"},
Types: []string{"Contributed"},
Installed: false,
Version: "1.0.6",
Boards: []*rpc.Board{{Name: "RK002"}},
Expand Down Expand Up @@ -110,7 +110,7 @@ func TestPlatformSearch(t *testing.T) {
Releases: map[string]*rpc.PlatformRelease{
"1.0.5": {
Name: "RK002",
Type: []string{"Contributed"},
Types: []string{"Contributed"},
Installed: false,
Version: "1.0.5",
Boards: []*rpc.Board{{Name: "RK002"}},
Expand All @@ -119,7 +119,7 @@ func TestPlatformSearch(t *testing.T) {
},
"1.0.6": {
Name: "RK002",
Type: []string{"Contributed"},
Types: []string{"Contributed"},
Installed: false,
Version: "1.0.6",
Boards: []*rpc.Board{{Name: "RK002"}},
Expand Down Expand Up @@ -150,7 +150,7 @@ func TestPlatformSearch(t *testing.T) {
Releases: map[string]*rpc.PlatformRelease{
"1.0.5": {
Name: "RK002",
Type: []string{"Contributed"},
Types: []string{"Contributed"},
Installed: false,
Version: "1.0.5",
Boards: []*rpc.Board{{Name: "RK002"}},
Expand All @@ -159,7 +159,7 @@ func TestPlatformSearch(t *testing.T) {
},
"1.0.6": {
Name: "RK002",
Type: []string{"Contributed"},
Types: []string{"Contributed"},
Installed: false,
Version: "1.0.6",
Boards: []*rpc.Board{{Name: "RK002"}},
Expand Down Expand Up @@ -190,7 +190,7 @@ func TestPlatformSearch(t *testing.T) {
Releases: map[string]*rpc.PlatformRelease{
"1.0.5": {
Name: "RK002",
Type: []string{"Contributed"},
Types: []string{"Contributed"},
Installed: false,
Version: "1.0.5",
Boards: []*rpc.Board{{Name: "RK002"}},
Expand All @@ -199,7 +199,7 @@ func TestPlatformSearch(t *testing.T) {
},
"1.0.6": {
Name: "RK002",
Type: []string{"Contributed"},
Types: []string{"Contributed"},
Installed: false,
Version: "1.0.6",
Boards: []*rpc.Board{{Name: "RK002"}},
Expand Down Expand Up @@ -230,7 +230,7 @@ func TestPlatformSearch(t *testing.T) {
Releases: map[string]*rpc.PlatformRelease{
"1.8.3": {
Name: "Arduino AVR Boards",
Type: []string{"Arduino"},
Types: []string{"Arduino"},
Installed: false,
Version: "1.8.3",
Boards: []*rpc.Board{
Expand Down Expand Up @@ -288,7 +288,7 @@ func TestPlatformSearch(t *testing.T) {
Releases: map[string]*rpc.PlatformRelease{
"1.8.3": {
Name: "Arduino AVR Boards",
Type: []string{"Arduino"},
Types: []string{"Arduino"},
Installed: false,
Version: "1.8.3",
Boards: []*rpc.Board{
Expand Down
2 changes: 1 addition & 1 deletion commands/utility_core.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func platformReleaseToRPC(platformRelease *cores.PlatformRelease) *rpc.PlatformR
Version: platformRelease.Version.String(),
Installed: platformRelease.IsInstalled(),
MissingMetadata: missingMetadata,
Type: []string{platformRelease.Category},
Types: []string{platformRelease.Category},
Deprecated: platformRelease.Deprecated,
Compatible: platformRelease.IsCompatible(),
}
Expand Down
36 changes: 36 additions & 0 deletions docs/UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,42 @@ func main() {

The `yaml` option of the `--format` flag is no more supported. Use `--format json` if machine parsable output is needed.

### gRPC: The `type` field has been renamed to `types` in the `cc.arduino.cli.commands.v1.PlatformRelease` message.

Rebuilding the gRPC bindings from the proto files requires to rename all access to `type` field as `types`.

By the way, the wire protocol is not affected by this change, existing clients should work fine without modification.

### The `type` field has been renamed to `types` in the JSON output including a platform release.

Since the `type` field may contain multiple values has been renamed to `types` to better express this aspect.

Previously:

```
$ arduino-cli core list --json | jq '.platforms[4].releases."1.8.13"'
{
"name": "Arduino SAMD (32-bits ARM Cortex-M0+) Boards",
"version": "1.8.13",
"type": [
"Arduino"
],
...
```

Now:

```
$ arduino-cli core list --json | jq '.platforms[4].releases."1.8.13"'
{
"name": "Arduino SAMD (32-bits ARM Cortex-M0+) Boards",
"version": "1.8.13",
"types": [
"Arduino"
],
...
```

### The gRPC `cc.arduino.cli.commands.v1.CompileRequest.export_binaries` changed type.

Previously the field `export_binaries` was a `google.protobuf.BoolValue`. We used this type because it expresses this
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/feedback/result/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func NewPlatformRelease(in *rpc.PlatformRelease) *PlatformRelease {
res := &PlatformRelease{
Name: in.GetName(),
Version: in.GetVersion(),
Type: in.GetType(),
Types: in.GetTypes(),
Installed: in.GetInstalled(),
Boards: boards,
Help: help,
Expand All @@ -132,7 +132,7 @@ func NewPlatformRelease(in *rpc.PlatformRelease) *PlatformRelease {
type PlatformRelease struct {
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
Type []string `json:"type,omitempty"`
Types []string `json:"types,omitempty"`
Installed bool `json:"installed,omitempty"`
Boards []*Board `json:"boards,omitempty"`
Help *HelpResource `json:"help,omitempty"`
Expand Down
Loading

0 comments on commit b72f5ca

Please sign in to comment.