-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SBT - Adds AvroWithSchema Support (#233)
* Adds AvroWithSchema support for scala source generation * Adds scripted tests verifying AvroWithSchema feature * Updates IDL docs section with the new sbt setting * Updates/adds unit tests
- Loading branch information
1 parent
02f77e0
commit 7f34e98
Showing
14 changed files
with
155 additions
and
27 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
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
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
modules/idlgen/core/src/test/resources/avro/MyGreeterWithSchemaService.scala
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 2017-2018 47 Degrees, LLC. <http://www.47deg.com> | ||
* | ||
* 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. | ||
*/ | ||
|
||
package foo.bar | ||
|
||
import freestyle.rpc.protocol._ | ||
|
||
@message case class HelloRequest(arg1: String, arg2: Option[String], arg3: List[String]) | ||
|
||
@message case class HelloResponse(arg1: String, arg2: Option[String], arg3: List[String]) | ||
|
||
@service trait MyGreeterService[F[_]] { | ||
|
||
@rpc(AvroWithSchema, Gzip) | ||
def sayHelloAvro(arg: foo.bar.HelloRequest): F[foo.bar.HelloResponse] | ||
|
||
@rpc(AvroWithSchema, Gzip) | ||
def sayNothingAvro(arg: Empty.type): F[Empty.type] | ||
|
||
} |
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
7 changes: 7 additions & 0 deletions
7
modules/idlgen/plugin/src/sbt-test/sbt-frees-rpc-idlgen/avroWithSchema/build.sbt
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,7 @@ | ||
version := sys.props("version") | ||
|
||
resolvers += Resolver.bintrayRepo("beyondthelines", "maven") | ||
|
||
libraryDependencies ++= Seq( | ||
"io.frees" %% "frees-rpc-server" % sys.props("version") | ||
) |
1 change: 1 addition & 0 deletions
1
...s/idlgen/plugin/src/sbt-test/sbt-frees-rpc-idlgen/avroWithSchema/project/build.properties
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 @@ | ||
sbt.version=1.1.2 |
1 change: 1 addition & 0 deletions
1
modules/idlgen/plugin/src/sbt-test/sbt-frees-rpc-idlgen/avroWithSchema/project/plugins.sbt
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 @@ | ||
addSbtPlugin("io.frees" %% "sbt-frees-rpc-idlgen" % sys.props("version")) |
16 changes: 16 additions & 0 deletions
16
...n/plugin/src/sbt-test/sbt-frees-rpc-idlgen/avroWithSchema/src/main/resources/service.avdl
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,16 @@ | ||
@namespace("io.frees") | ||
protocol service { | ||
|
||
record Foo { | ||
string bar; | ||
} | ||
|
||
record Person { | ||
long id; | ||
string name; | ||
union { null, string } email; | ||
} | ||
|
||
io.frees.Person hi(io.frees.Foo request); | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
modules/idlgen/plugin/src/sbt-test/sbt-frees-rpc-idlgen/avroWithSchema/test
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,12 @@ | ||
$ exists src/main/resources/service.avdl | ||
> 'set idlType := "avro"' | ||
> 'set srcGenSerializationType := "Avro"' | ||
> srcGen | ||
$ exists target/scala-2.12/src_managed/main/io/frees/service.scala | ||
$ delete target/scala-2.12/src_managed/main/io/frees/service.scala | ||
|
||
$ exists src/main/resources/service.avdl | ||
> 'set idlType := "avro"' | ||
> 'set srcGenSerializationType := "AvroWithSchema"' | ||
> srcGen | ||
$ exists target/scala-2.12/src_managed/main/io/frees/service.scala |