-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove generation of redundant package imports (#102)
- Loading branch information
Showing
9 changed files
with
112 additions
and
20 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
22 changes: 22 additions & 0 deletions
22
modules/example/src/smithy4s/example/error/NotFoundError.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,22 @@ | ||
package smithy4s.example.error | ||
|
||
import smithy4s.syntax._ | ||
|
||
case class NotFoundError(error: Option[String] = None) extends Throwable { | ||
} | ||
object NotFoundError extends smithy4s.ShapeTag.Companion[NotFoundError] { | ||
val id: smithy4s.ShapeId = smithy4s.ShapeId("smithy4s.example.error", "NotFoundError") | ||
|
||
val hints : smithy4s.Hints = smithy4s.Hints( | ||
id, | ||
smithy.api.Error.CLIENT, | ||
smithy.api.HttpError(404), | ||
) | ||
|
||
val schema: smithy4s.Schema[NotFoundError] = struct( | ||
string.optional[NotFoundError]("error", _.error), | ||
){ | ||
NotFoundError.apply | ||
}.withHints(hints) | ||
implicit val staticSchema : schematic.Static[smithy4s.Schema[NotFoundError]] = schematic.Static(schema) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package smithy4s.example | ||
|
||
package object imp { | ||
type ImportService[F[_]] = smithy4s.Monadic[ImportServiceGen, F] | ||
object ImportService extends smithy4s.Service.Provider[ImportServiceGen, ImportServiceOperation] { | ||
def apply[F[_]](implicit F: ImportService[F]): F.type = F | ||
def service : smithy4s.Service[ImportServiceGen, ImportServiceOperation] = ImportServiceGen | ||
val id: smithy4s.ShapeId = service.id | ||
} | ||
|
||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
namespace smithy4s.example | ||
namespace smithy4s.example.imp | ||
|
||
use smithy4s.api#simpleRestJson | ||
use smithy4s.example.import_test#ImportOperation | ||
use smithy4s.example.error#NotFoundError | ||
|
||
@simpleRestJson | ||
service ImportService { | ||
version: "1.0.0", | ||
operations: [ImportOperation] | ||
operations: [ImportOperation], | ||
errors: [NotFoundError], | ||
} | ||
|
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 @@ | ||
namespace smithy4s.example.error | ||
|
||
@error("client") | ||
@httpError(404) | ||
structure NotFoundError { | ||
error: String, | ||
} |