From d5521de9e5141991d2ce0318353a837cb9cc532b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jefferson=20Gir=C3=A3o?= Date: Fri, 7 Feb 2020 10:31:20 +0100 Subject: [PATCH] refactor: move facts into entity --- backend/identity/go.mod | 3 + backend/inventory/app/server.go | 6 +- backend/inventory/app/server_test.go | 8 +- backend/proto/inventory/v1/inventory.pb.go | 92 ++++---- docker-compose.yaml | 10 + .../generated/inventory/v1/inventory_pb.d.ts | 26 +-- .../generated/inventory/v1/inventory_pb.js | 199 +++++++----------- proto/inventory/v1/inventory.proto | 5 +- 8 files changed, 147 insertions(+), 202 deletions(-) diff --git a/backend/identity/go.mod b/backend/identity/go.mod index 28d0ae93b3..1c379c4819 100644 --- a/backend/identity/go.mod +++ b/backend/identity/go.mod @@ -7,5 +7,8 @@ replace github.com/spotify/backstage/proto => ../proto require ( github.com/golang/mock v1.1.1 github.com/spotify/backstage/proto v0.0.0-00010101000000-000000000000 + golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 // indirect + golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 // indirect google.golang.org/grpc v1.27.0 + honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc // indirect ) diff --git a/backend/inventory/app/server.go b/backend/inventory/app/server.go index 419836b677..eb5850c4b2 100644 --- a/backend/inventory/app/server.go +++ b/backend/inventory/app/server.go @@ -22,7 +22,7 @@ func (s *Server) ListEntities(ctx context.Context, req *pb.ListEntitiesRequest) return nil, status.Error(codes.Internal, "could not list entities") } - var result []*pb.GetEntityReply + var result []*pb.Entity for _, entity := range entities { var facts []*pb.Fact factTuples, err := s.Storage.GetFacts(entity) @@ -32,7 +32,7 @@ func (s *Server) ListEntities(ctx context.Context, req *pb.ListEntitiesRequest) for key, value := range factTuples { facts = append(facts, &pb.Fact{Name: key, Value: value}) } - result = append(result, &pb.GetEntityReply{Entity: &pb.Entity{Uri: entity}, Facts: facts}) + result = append(result, &pb.Entity{Uri: entity, Facts: facts}) } return &pb.ListEntitiesReply{Entities: result}, nil @@ -63,7 +63,7 @@ func (s *Server) GetEntity(ctx context.Context, req *pb.GetEntityRequest) (*pb.G for key, value := range factTuples { facts = append(facts, &pb.Fact{Name: key, Value: value}) } - return &pb.GetEntityReply{Entity: &pb.Entity{Uri: entityUri}, Facts: facts}, nil + return &pb.GetEntityReply{Entity: &pb.Entity{Uri: entityUri, Facts: facts}}, nil } func (s *Server) SetFact(ctx context.Context, req *pb.SetFactRequest) (*pb.SetFactReply, error) { diff --git a/backend/inventory/app/server_test.go b/backend/inventory/app/server_test.go index f1ad4b8ff0..7584170c0d 100644 --- a/backend/inventory/app/server_test.go +++ b/backend/inventory/app/server_test.go @@ -34,8 +34,8 @@ func TestServer(t *testing.T) { if len(list.GetEntities()) != 1 { t.Errorf("ServerTest(ListEntities) expected %v items, got %v", 1, len(list.GetEntities())) } - if list.GetEntities()[0].GetEntity().GetUri() != entityURI { - t.Errorf("ServerTest(ListEntities) expected uri %v, got %v", "boss://test/test", list.GetEntities()[0].GetEntity().GetUri()) + if list.GetEntities()[0].GetUri() != entityURI { + t.Errorf("ServerTest(ListEntities) expected uri %v, got %v", "boss://test/test", list.GetEntities()[0].GetUri()) } expectedFacts := []*pb.Fact{{Name: "test-name", Value: "test-value"}} if !reflect.DeepEqual(list.GetEntities()[0].GetFacts(), expectedFacts) { @@ -83,8 +83,8 @@ func TestServer(t *testing.T) { t.Errorf("ServerTest(GetEntity) returned nil") } expectedFacts := []*pb.Fact{{Name: "test-name", Value: "test-value"}} - if !reflect.DeepEqual(resp.GetFacts(), expectedFacts) { - t.Errorf("ServerTest(GetEntity) got %v, wanted %v", resp.GetFacts(), expectedFacts) + if !reflect.DeepEqual(resp.GetEntity().GetFacts(), expectedFacts) { + t.Errorf("ServerTest(GetEntity) got %v, wanted %v", resp.GetEntity().GetFacts(), expectedFacts) } }) t.Run("Set fact for existing entity", func(t *testing.T) { diff --git a/backend/proto/inventory/v1/inventory.pb.go b/backend/proto/inventory/v1/inventory.pb.go index 7eedf84f76..8866bba87a 100644 --- a/backend/proto/inventory/v1/inventory.pb.go +++ b/backend/proto/inventory/v1/inventory.pb.go @@ -64,10 +64,10 @@ func (m *ListEntitiesRequest) GetUriPrefix() string { } type ListEntitiesReply struct { - Entities []*GetEntityReply `protobuf:"bytes,1,rep,name=entities,proto3" json:"entities,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Entities []*Entity `protobuf:"bytes,1,rep,name=entities,proto3" json:"entities,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ListEntitiesReply) Reset() { *m = ListEntitiesReply{} } @@ -95,7 +95,7 @@ func (m *ListEntitiesReply) XXX_DiscardUnknown() { var xxx_messageInfo_ListEntitiesReply proto.InternalMessageInfo -func (m *ListEntitiesReply) GetEntities() []*GetEntityReply { +func (m *ListEntitiesReply) GetEntities() []*Entity { if m != nil { return m.Entities } @@ -104,7 +104,6 @@ func (m *ListEntitiesReply) GetEntities() []*GetEntityReply { type GetEntityRequest struct { Entity *Entity `protobuf:"bytes,1,opt,name=entity,proto3" json:"entity,omitempty"` - IncludeFacts []string `protobuf:"bytes,2,rep,name=include_facts,json=includeFacts,proto3" json:"include_facts,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -142,16 +141,8 @@ func (m *GetEntityRequest) GetEntity() *Entity { return nil } -func (m *GetEntityRequest) GetIncludeFacts() []string { - if m != nil { - return m.IncludeFacts - } - return nil -} - type GetEntityReply struct { Entity *Entity `protobuf:"bytes,1,opt,name=entity,proto3" json:"entity,omitempty"` - Facts []*Fact `protobuf:"bytes,2,rep,name=facts,proto3" json:"facts,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -189,13 +180,6 @@ func (m *GetEntityReply) GetEntity() *Entity { return nil } -func (m *GetEntityReply) GetFacts() []*Fact { - if m != nil { - return m.Facts - } - return nil -} - type CreateEntityRequest struct { Entity *Entity `protobuf:"bytes,1,opt,name=entity,proto3" json:"entity,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -456,6 +440,7 @@ func (m *GetFactReply) GetFact() *Fact { type Entity struct { Uri string `protobuf:"bytes,1,opt,name=uri,proto3" json:"uri,omitempty"` + Facts []*Fact `protobuf:"bytes,2,rep,name=facts,proto3" json:"facts,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -493,6 +478,13 @@ func (m *Entity) GetUri() string { return "" } +func (m *Entity) GetFacts() []*Fact { + if m != nil { + return m.Facts + } + return nil +} + type Fact struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` @@ -558,36 +550,34 @@ func init() { func init() { proto.RegisterFile("inventory/v1/inventory.proto", fileDescriptor_70be9028e322f9d8) } var fileDescriptor_70be9028e322f9d8 = []byte{ - // 459 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x41, 0x8f, 0x93, 0x40, - 0x14, 0x0e, 0x85, 0xad, 0xf2, 0xe8, 0x6e, 0x76, 0x67, 0x3d, 0x90, 0x66, 0x63, 0x9a, 0xd1, 0x98, - 0x1e, 0x0c, 0x5b, 0xe8, 0xc5, 0x78, 0xf0, 0x50, 0xa3, 0xa8, 0xf1, 0x60, 0x68, 0x9a, 0x18, 0x2f, - 0x0d, 0xad, 0xd3, 0x66, 0x62, 0x0b, 0x15, 0x06, 0x94, 0xff, 0xe0, 0x4f, 0xf2, 0xc7, 0x99, 0x19, - 0xe8, 0x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72, 0x5b, 0x12, 0x55, 0xc7, - 0x78, 0x72, 0xf9, 0xcd, 0x90, 0xc9, 0xd4, 0x5e, 0x74, 0xc5, 0xdf, 0xc7, 0xf8, 0x5f, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x4c, 0xd9, 0x78, 0x44, 0x5e, 0x06, 0x00, 0x00, + // 428 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4f, 0x6b, 0xe2, 0x40, + 0x14, 0x27, 0x1a, 0xdd, 0xcd, 0xd3, 0x15, 0x1d, 0xf7, 0x10, 0x44, 0x16, 0x09, 0xcb, 0xe2, 0x61, + 0x89, 0x46, 0x2f, 0xcb, 0x1e, 0x7a, 0xb0, 0xb4, 0x69, 0xa1, 0x07, 0x89, 0xd8, 0x96, 0xde, 0xa2, + 0x8c, 0x32, 0x54, 0x13, 0x9b, 0x4c, 0x42, 0xf3, 0xdd, 0xfa, 0xe1, 0xca, 0x4c, 0xe2, 0x18, 0x5b, + 0x69, 0x22, 0x7a, 0xcb, 0xbc, 0x37, 0xbf, 0x3f, 0xf3, 0x66, 0x7e, 0x04, 0xda, 0xc4, 0x09, 0xb1, + 0x43, 0x5d, 0x2f, 0xea, 0x85, 0x46, 0x4f, 0x2c, 0xf4, 0x8d, 0xe7, 0x52, 0x17, 0xfd, 0xf2, 0x37, + 0x2e, 0x25, 0x8b, 0x48, 0x9f, 0xd9, 0xf3, 0x67, 0x9f, 0xda, 0x4b, 0xac, 0xef, 0xb6, 0x84, 0x86, + 0x36, 0x84, 0xe6, 0x1d, 0xf1, 0xe9, 0x95, 0x43, 0x09, 0x25, 0xd8, 0xb7, 0xf0, 0x4b, 0x80, 0x7d, + 0x8a, 0xda, 0xa0, 0x04, 0x1e, 0x19, 0x7b, 0x78, 0x41, 0x5e, 0x55, 0xa9, 0x23, 0x75, 0x15, 0x6b, + 0x57, 0xd0, 0x1e, 0xa0,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x2d, 0x1d, 0x0a, 0xa1, 0x9a, 0x0e, + 0x1d, 0x1a, 0x66, 0x89, 0x1f, 0xc8, 0x75, 0xcb, 0x38, 0x0e, 0xc4, 0x26, 0xb9, 0x06, 0x45, 0xe4, + 0x07, 0xf5, 0xb3, 0xf0, 0x1f, 0xe3, 0xdb, 0xd2, 0x8f, 0x40, 0x30, 0xb9, 0x10, 0xaa, 0xe9, 0x14, + 0x64, 0x1f, 0xf3, 0x40, 0x14, 0xb3, 0x8f, 0xf9, 0x39, 0x68, 0x4b, 0xf8, 0x96, 0x3c, 0x67, 0x94, + 0x69, 0x79, 0x3f, 0x51, 0xad, 0xbf, 0xb9, 0xf7, 0x27, 0x42, 0x66, 0x5e, 0x21, 0xf3, 0x48, 0xa1, + 0x74, 0x04, 0x46, 0x3f, 0x9e, 0x2a, 0xa2, 0x19, 0x1a, 0xb3, 0x32, 0xff, 0x21, 0x0c, 0xdf, 0x03, + 0x00, 0x00, 0xff, 0xff, 0xce, 0x45, 0x7f, 0xc5, 0x30, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/docker-compose.yaml b/docker-compose.yaml index 76f8f4f1c7..2e81bfe1f2 100755 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -21,6 +21,16 @@ services: volumes: - ./backend/identity/identity-data.json:/app/identity-data.json + identity: + container_name: boss-inventory + build: + context: backend + args: + service: inventory + restart: unless-stopped + volumes: + - ./backend/inventory/inventory-data.json:/app/inventory-data.json + builds: container_name: boss-builds build: diff --git a/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.d.ts b/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.d.ts index 65bd236016..69aa89e8af 100644 --- a/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.d.ts +++ b/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.d.ts @@ -19,10 +19,10 @@ export namespace ListEntitiesRequest { } export class ListEntitiesReply extends jspb.Message { - getEntitiesList(): Array; - setEntitiesList(value: Array): void; + getEntitiesList(): Array; + setEntitiesList(value: Array): void; clearEntitiesList(): void; - addEntities(value?: GetEntityReply, index?: number): GetEntityReply; + addEntities(value?: Entity, index?: number): Entity; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): ListEntitiesReply.AsObject; @@ -34,7 +34,7 @@ export class ListEntitiesReply extends jspb.Message { export namespace ListEntitiesReply { export type AsObject = { - entitiesList: Array, + entitiesList: Array, } } @@ -44,11 +44,6 @@ export class GetEntityRequest extends jspb.Message { hasEntity(): boolean; clearEntity(): void; - getIncludeFactsList(): Array; - setIncludeFactsList(value: Array): void; - clearIncludeFactsList(): void; - addIncludeFacts(value: string, index?: number): void; - serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): GetEntityRequest.AsObject; static toObject(includeInstance: boolean, msg: GetEntityRequest): GetEntityRequest.AsObject; @@ -60,7 +55,6 @@ export class GetEntityRequest extends jspb.Message { export namespace GetEntityRequest { export type AsObject = { entity?: Entity.AsObject, - includeFactsList: Array, } } @@ -70,11 +64,6 @@ export class GetEntityReply extends jspb.Message { hasEntity(): boolean; clearEntity(): void; - getFactsList(): Array; - setFactsList(value: Array): void; - clearFactsList(): void; - addFacts(value?: Fact, index?: number): Fact; - serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): GetEntityReply.AsObject; static toObject(includeInstance: boolean, msg: GetEntityReply): GetEntityReply.AsObject; @@ -86,7 +75,6 @@ export class GetEntityReply extends jspb.Message { export namespace GetEntityReply { export type AsObject = { entity?: Entity.AsObject, - factsList: Array, } } @@ -222,6 +210,11 @@ export class Entity extends jspb.Message { getUri(): string; setUri(value: string): void; + getFactsList(): Array; + setFactsList(value: Array): void; + clearFactsList(): void; + addFacts(value?: Fact, index?: number): Fact; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Entity.AsObject; static toObject(includeInstance: boolean, msg: Entity): Entity.AsObject; @@ -233,6 +226,7 @@ export class Entity extends jspb.Message { export namespace Entity { export type AsObject = { uri: string, + factsList: Array, } } diff --git a/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.js b/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.js index abf0fd6a3b..a48e412334 100644 --- a/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.js +++ b/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.js @@ -76,7 +76,7 @@ if (goog.DEBUG && !COMPILED) { * @constructor */ proto.spotify.backstage.inventory.v1.GetEntityRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.spotify.backstage.inventory.v1.GetEntityRequest.repeatedFields_, null); + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.spotify.backstage.inventory.v1.GetEntityRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { @@ -97,7 +97,7 @@ if (goog.DEBUG && !COMPILED) { * @constructor */ proto.spotify.backstage.inventory.v1.GetEntityReply = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.spotify.backstage.inventory.v1.GetEntityReply.repeatedFields_, null); + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.spotify.backstage.inventory.v1.GetEntityReply, jspb.Message); if (goog.DEBUG && !COMPILED) { @@ -244,7 +244,7 @@ if (goog.DEBUG && !COMPILED) { * @constructor */ proto.spotify.backstage.inventory.v1.Entity = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); + jspb.Message.initialize(this, opt_data, 0, -1, proto.spotify.backstage.inventory.v1.Entity.repeatedFields_, null); }; goog.inherits(proto.spotify.backstage.inventory.v1.Entity, jspb.Message); if (goog.DEBUG && !COMPILED) { @@ -442,7 +442,7 @@ proto.spotify.backstage.inventory.v1.ListEntitiesReply.prototype.toObject = func proto.spotify.backstage.inventory.v1.ListEntitiesReply.toObject = function(includeInstance, msg) { var f, obj = { entitiesList: jspb.Message.toObjectList(msg.getEntitiesList(), - proto.spotify.backstage.inventory.v1.GetEntityReply.toObject, includeInstance) + proto.spotify.backstage.inventory.v1.Entity.toObject, includeInstance) }; if (includeInstance) { @@ -480,8 +480,8 @@ proto.spotify.backstage.inventory.v1.ListEntitiesReply.deserializeBinaryFromRead var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.spotify.backstage.inventory.v1.GetEntityReply; - reader.readMessage(value,proto.spotify.backstage.inventory.v1.GetEntityReply.deserializeBinaryFromReader); + var value = new proto.spotify.backstage.inventory.v1.Entity; + reader.readMessage(value,proto.spotify.backstage.inventory.v1.Entity.deserializeBinaryFromReader); msg.addEntities(value); break; default: @@ -518,35 +518,35 @@ proto.spotify.backstage.inventory.v1.ListEntitiesReply.serializeBinaryToWriter = writer.writeRepeatedMessage( 1, f, - proto.spotify.backstage.inventory.v1.GetEntityReply.serializeBinaryToWriter + proto.spotify.backstage.inventory.v1.Entity.serializeBinaryToWriter ); } }; /** - * repeated GetEntityReply entities = 1; - * @return {!Array} + * repeated Entity entities = 1; + * @return {!Array} */ proto.spotify.backstage.inventory.v1.ListEntitiesReply.prototype.getEntitiesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.spotify.backstage.inventory.v1.GetEntityReply, 1)); + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.spotify.backstage.inventory.v1.Entity, 1)); }; -/** @param {!Array} value */ +/** @param {!Array} value */ proto.spotify.backstage.inventory.v1.ListEntitiesReply.prototype.setEntitiesList = function(value) { jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * @param {!proto.spotify.backstage.inventory.v1.GetEntityReply=} opt_value + * @param {!proto.spotify.backstage.inventory.v1.Entity=} opt_value * @param {number=} opt_index - * @return {!proto.spotify.backstage.inventory.v1.GetEntityReply} + * @return {!proto.spotify.backstage.inventory.v1.Entity} */ proto.spotify.backstage.inventory.v1.ListEntitiesReply.prototype.addEntities = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.spotify.backstage.inventory.v1.GetEntityReply, opt_index); + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.spotify.backstage.inventory.v1.Entity, opt_index); }; @@ -559,13 +559,6 @@ proto.spotify.backstage.inventory.v1.ListEntitiesReply.prototype.clearEntitiesLi -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.spotify.backstage.inventory.v1.GetEntityRequest.repeatedFields_ = [2]; - if (jspb.Message.GENERATE_TO_OBJECT) { @@ -597,8 +590,7 @@ proto.spotify.backstage.inventory.v1.GetEntityRequest.prototype.toObject = funct */ proto.spotify.backstage.inventory.v1.GetEntityRequest.toObject = function(includeInstance, msg) { var f, obj = { - entity: (f = msg.getEntity()) && proto.spotify.backstage.inventory.v1.Entity.toObject(includeInstance, f), - includeFactsList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f + entity: (f = msg.getEntity()) && proto.spotify.backstage.inventory.v1.Entity.toObject(includeInstance, f) }; if (includeInstance) { @@ -640,10 +632,6 @@ proto.spotify.backstage.inventory.v1.GetEntityRequest.deserializeBinaryFromReade reader.readMessage(value,proto.spotify.backstage.inventory.v1.Entity.deserializeBinaryFromReader); msg.setEntity(value); break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.addIncludeFacts(value); - break; default: reader.skipField(); break; @@ -681,13 +669,6 @@ proto.spotify.backstage.inventory.v1.GetEntityRequest.serializeBinaryToWriter = proto.spotify.backstage.inventory.v1.Entity.serializeBinaryToWriter ); } - f = message.getIncludeFactsList(); - if (f.length > 0) { - writer.writeRepeatedString( - 2, - f - ); - } }; @@ -724,45 +705,6 @@ proto.spotify.backstage.inventory.v1.GetEntityRequest.prototype.hasEntity = func }; -/** - * repeated string include_facts = 2; - * @return {!Array} - */ -proto.spotify.backstage.inventory.v1.GetEntityRequest.prototype.getIncludeFactsList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); -}; - - -/** @param {!Array} value */ -proto.spotify.backstage.inventory.v1.GetEntityRequest.prototype.setIncludeFactsList = function(value) { - jspb.Message.setField(this, 2, value || []); -}; - - -/** - * @param {string} value - * @param {number=} opt_index - */ -proto.spotify.backstage.inventory.v1.GetEntityRequest.prototype.addIncludeFacts = function(value, opt_index) { - jspb.Message.addToRepeatedField(this, 2, value, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - */ -proto.spotify.backstage.inventory.v1.GetEntityRequest.prototype.clearIncludeFactsList = function() { - this.setIncludeFactsList([]); -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.spotify.backstage.inventory.v1.GetEntityReply.repeatedFields_ = [2]; @@ -795,9 +737,7 @@ proto.spotify.backstage.inventory.v1.GetEntityReply.prototype.toObject = functio */ proto.spotify.backstage.inventory.v1.GetEntityReply.toObject = function(includeInstance, msg) { var f, obj = { - entity: (f = msg.getEntity()) && proto.spotify.backstage.inventory.v1.Entity.toObject(includeInstance, f), - factsList: jspb.Message.toObjectList(msg.getFactsList(), - proto.spotify.backstage.inventory.v1.Fact.toObject, includeInstance) + entity: (f = msg.getEntity()) && proto.spotify.backstage.inventory.v1.Entity.toObject(includeInstance, f) }; if (includeInstance) { @@ -839,11 +779,6 @@ proto.spotify.backstage.inventory.v1.GetEntityReply.deserializeBinaryFromReader reader.readMessage(value,proto.spotify.backstage.inventory.v1.Entity.deserializeBinaryFromReader); msg.setEntity(value); break; - case 2: - var value = new proto.spotify.backstage.inventory.v1.Fact; - reader.readMessage(value,proto.spotify.backstage.inventory.v1.Fact.deserializeBinaryFromReader); - msg.addFacts(value); - break; default: reader.skipField(); break; @@ -881,14 +816,6 @@ proto.spotify.backstage.inventory.v1.GetEntityReply.serializeBinaryToWriter = fu proto.spotify.backstage.inventory.v1.Entity.serializeBinaryToWriter ); } - f = message.getFactsList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 2, - f, - proto.spotify.backstage.inventory.v1.Fact.serializeBinaryToWriter - ); - } }; @@ -925,40 +852,6 @@ proto.spotify.backstage.inventory.v1.GetEntityReply.prototype.hasEntity = functi }; -/** - * repeated Fact facts = 2; - * @return {!Array} - */ -proto.spotify.backstage.inventory.v1.GetEntityReply.prototype.getFactsList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.spotify.backstage.inventory.v1.Fact, 2)); -}; - - -/** @param {!Array} value */ -proto.spotify.backstage.inventory.v1.GetEntityReply.prototype.setFactsList = function(value) { - jspb.Message.setRepeatedWrapperField(this, 2, value); -}; - - -/** - * @param {!proto.spotify.backstage.inventory.v1.Fact=} opt_value - * @param {number=} opt_index - * @return {!proto.spotify.backstage.inventory.v1.Fact} - */ -proto.spotify.backstage.inventory.v1.GetEntityReply.prototype.addFacts = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.spotify.backstage.inventory.v1.Fact, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - */ -proto.spotify.backstage.inventory.v1.GetEntityReply.prototype.clearFactsList = function() { - this.setFactsList([]); -}; - - @@ -1883,6 +1776,13 @@ proto.spotify.backstage.inventory.v1.GetFactReply.prototype.hasFact = function() +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.spotify.backstage.inventory.v1.Entity.repeatedFields_ = [2]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -1914,7 +1814,9 @@ proto.spotify.backstage.inventory.v1.Entity.prototype.toObject = function(opt_in */ proto.spotify.backstage.inventory.v1.Entity.toObject = function(includeInstance, msg) { var f, obj = { - uri: jspb.Message.getFieldWithDefault(msg, 1, "") + uri: jspb.Message.getFieldWithDefault(msg, 1, ""), + factsList: jspb.Message.toObjectList(msg.getFactsList(), + proto.spotify.backstage.inventory.v1.Fact.toObject, includeInstance) }; if (includeInstance) { @@ -1955,6 +1857,11 @@ proto.spotify.backstage.inventory.v1.Entity.deserializeBinaryFromReader = functi var value = /** @type {string} */ (reader.readString()); msg.setUri(value); break; + case 2: + var value = new proto.spotify.backstage.inventory.v1.Fact; + reader.readMessage(value,proto.spotify.backstage.inventory.v1.Fact.deserializeBinaryFromReader); + msg.addFacts(value); + break; default: reader.skipField(); break; @@ -1991,6 +1898,14 @@ proto.spotify.backstage.inventory.v1.Entity.serializeBinaryToWriter = function(m f ); } + f = message.getFactsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.spotify.backstage.inventory.v1.Fact.serializeBinaryToWriter + ); + } }; @@ -2009,6 +1924,40 @@ proto.spotify.backstage.inventory.v1.Entity.prototype.setUri = function(value) { }; +/** + * repeated Fact facts = 2; + * @return {!Array} + */ +proto.spotify.backstage.inventory.v1.Entity.prototype.getFactsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.spotify.backstage.inventory.v1.Fact, 2)); +}; + + +/** @param {!Array} value */ +proto.spotify.backstage.inventory.v1.Entity.prototype.setFactsList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.spotify.backstage.inventory.v1.Fact=} opt_value + * @param {number=} opt_index + * @return {!proto.spotify.backstage.inventory.v1.Fact} + */ +proto.spotify.backstage.inventory.v1.Entity.prototype.addFacts = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.spotify.backstage.inventory.v1.Fact, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + */ +proto.spotify.backstage.inventory.v1.Entity.prototype.clearFactsList = function() { + this.setFactsList([]); +}; + + diff --git a/proto/inventory/v1/inventory.proto b/proto/inventory/v1/inventory.proto index eaf58bb61a..f506f7a04d 100644 --- a/proto/inventory/v1/inventory.proto +++ b/proto/inventory/v1/inventory.proto @@ -17,17 +17,15 @@ message ListEntitiesRequest { } message ListEntitiesReply { - repeated GetEntityReply entities = 1; + repeated Entity entities = 1; } message GetEntityRequest { Entity entity = 1; - repeated string include_facts = 2; } message GetEntityReply { Entity entity = 1; - repeated Fact facts = 2; } message CreateEntityRequest { @@ -59,6 +57,7 @@ message GetFactReply { message Entity { string uri = 1; + repeated Fact facts = 2; } message Fact {