-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: codegen for outer class and multiple files variations (#403)
- Loading branch information
Showing
17 changed files
with
366 additions
and
80 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
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
33 changes: 33 additions & 0 deletions
33
codegen/java-gen-compilation-tests/src/main/proto/actions/simple_action.proto
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,33 @@ | ||
// Copyright 2021 Lightbend 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. | ||
|
||
syntax = "proto3"; | ||
|
||
package com.example.action1; | ||
|
||
// no java_multiple_files option, classes will be wrapped in outer class | ||
// no java_outer_classname option, will default to "SimpleActionOuterClass" | ||
|
||
import "akkaserverless/annotations.proto"; | ||
|
||
message Request {} | ||
message Response {} | ||
|
||
service SimpleAction { | ||
option (akkaserverless.service) = { | ||
type: SERVICE_TYPE_ACTION | ||
}; | ||
|
||
rpc Method(Request) returns (Response); | ||
} |
33 changes: 33 additions & 0 deletions
33
codegen/java-gen-compilation-tests/src/main/proto/actions/simple_action_api.proto
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,33 @@ | ||
// Copyright 2021 Lightbend 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. | ||
|
||
syntax = "proto3"; | ||
|
||
package com.example.action2; | ||
|
||
// no java_multiple_files option, classes will be wrapped in outer class | ||
// no java_outer_classname option, will default to "SimpleActionApi" | ||
|
||
import "akkaserverless/annotations.proto"; | ||
|
||
message Request {} | ||
message Response {} | ||
|
||
service AnotherSimpleAction { | ||
option (akkaserverless.service) = { | ||
type: SERVICE_TYPE_ACTION | ||
}; | ||
|
||
rpc Method(Request) returns (Response); | ||
} |
33 changes: 33 additions & 0 deletions
33
codegen/java-gen-compilation-tests/src/main/proto/actions/some_action.proto
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,33 @@ | ||
// Copyright 2021 Lightbend 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. | ||
|
||
syntax = "proto3"; | ||
|
||
package com.example.action3; | ||
|
||
option java_multiple_files = true; | ||
// no java_outer_classname option, will default to "SomeActionOuterClass" | ||
|
||
import "akkaserverless/annotations.proto"; | ||
|
||
message Request {} | ||
message Response {} | ||
|
||
service SomeAction { | ||
option (akkaserverless.service) = { | ||
type: SERVICE_TYPE_ACTION | ||
}; | ||
|
||
rpc Method(Request) returns (Response); | ||
} |
33 changes: 33 additions & 0 deletions
33
codegen/java-gen-compilation-tests/src/main/proto/actions/some_other_action_api.proto
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,33 @@ | ||
// Copyright 2021 Lightbend 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. | ||
|
||
syntax = "proto3"; | ||
|
||
package com.example.action4; | ||
|
||
option java_multiple_files = true; | ||
// no java_outer_classname option, will default to "SomeOtherActionApi" | ||
|
||
import "akkaserverless/annotations.proto"; | ||
|
||
message Request {} | ||
message Response {} | ||
|
||
service SomeOtherAction { | ||
option (akkaserverless.service) = { | ||
type: SERVICE_TYPE_ACTION | ||
}; | ||
|
||
rpc Method(Request) returns (Response); | ||
} |
33 changes: 33 additions & 0 deletions
33
codegen/java-gen-compilation-tests/src/main/proto/actions/yet_another_action.proto
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,33 @@ | ||
// Copyright 2021 Lightbend 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. | ||
|
||
syntax = "proto3"; | ||
|
||
package com.example.action5; | ||
|
||
option java_multiple_files = true; | ||
option java_outer_classname = "YetAnotherActionApi"; | ||
|
||
import "akkaserverless/annotations.proto"; | ||
|
||
message Request {} | ||
message Response {} | ||
|
||
service YetAnotherAction { | ||
option (akkaserverless.service) = { | ||
type: SERVICE_TYPE_ACTION | ||
}; | ||
|
||
rpc Method(Request) returns (Response); | ||
} |
34 changes: 34 additions & 0 deletions
34
...mpilation-tests/src/main/proto/event-sourced-entities/some_event_sourced_entity_api.proto
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,34 @@ | ||
// Copyright 2021 Lightbend 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. | ||
|
||
syntax = "proto3"; | ||
|
||
package com.example.eventsourcedentity; | ||
|
||
import "akkaserverless/annotations.proto"; | ||
|
||
option java_multiple_files = true; | ||
// no java_outer_classname option, will default to "SomeEventSourcedEntityApi" | ||
|
||
message Request {} | ||
message Response {} | ||
|
||
service SomeEventSourcedEntityService { | ||
option (akkaserverless.service) = { | ||
type: SERVICE_TYPE_ENTITY | ||
component: "com.example.eventsourcedentity.domain.SomeEventSourcedEntity" | ||
}; | ||
|
||
rpc Method(Request) returns (Response); | ||
} |
37 changes: 37 additions & 0 deletions
37
...lation-tests/src/main/proto/event-sourced-entities/some_event_sourced_entity_domain.proto
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,37 @@ | ||
// Copyright 2021 Lightbend 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. | ||
|
||
syntax = "proto3"; | ||
|
||
package com.example.eventsourcedentity.domain; | ||
|
||
import "akkaserverless/annotations.proto"; | ||
|
||
option java_multiple_files = true; | ||
// no java_outer_classname option, will default to "SomeEventSourcedEntityDomain" | ||
|
||
option (akkaserverless.file).event_sourced_entity = { | ||
name: "SomeEventSourcedEntity" | ||
entity_type: "some-event-sourced-entity" | ||
state: "SomeEventSourcedEntityState" | ||
events: ["SomeEvent"] | ||
}; | ||
|
||
message SomeEventSourcedEntityState { | ||
string some_field = 1; | ||
} | ||
|
||
message SomeEvent { | ||
string some_field = 1; | ||
} |
34 changes: 34 additions & 0 deletions
34
codegen/java-gen-compilation-tests/src/main/proto/value-entities/some_value_entity_api.proto
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,34 @@ | ||
// Copyright 2021 Lightbend 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. | ||
|
||
syntax = "proto3"; | ||
|
||
package com.example.valueentity; | ||
|
||
import "akkaserverless/annotations.proto"; | ||
|
||
option java_multiple_files = true; | ||
// no java_outer_classname option, will default to "SomeValueEntityApi" | ||
|
||
message Request {} | ||
message Response {} | ||
|
||
service SomeValueEntityService { | ||
option (akkaserverless.service) = { | ||
type: SERVICE_TYPE_ENTITY | ||
component: "com.example.valueentity.domain.SomeValueEntity" | ||
}; | ||
|
||
rpc Method(Request) returns (Response); | ||
} |
32 changes: 32 additions & 0 deletions
32
...n/java-gen-compilation-tests/src/main/proto/value-entities/some_value_entity_domain.proto
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,32 @@ | ||
// Copyright 2021 Lightbend 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. | ||
|
||
syntax = "proto3"; | ||
|
||
package com.example.valueentity.domain; | ||
|
||
import "akkaserverless/annotations.proto"; | ||
|
||
option java_multiple_files = true; | ||
// no java_outer_classname option, will default to "SomeValueEntityDomain" | ||
|
||
option (akkaserverless.file).value_entity = { | ||
name: "SomeValueEntity" | ||
entity_type: "some-value-entity" | ||
state: "SomeValueEntityState" | ||
}; | ||
|
||
message SomeValueEntityState { | ||
string some_field = 1; | ||
} |
Oops, something went wrong.