-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(type-safe-api): add smithy shape library project for sharing smi…
…thy models between apis Adds a `SmithyShapeLibraryProject` which can be used to define Smithy models that can be reused in different APIs. Previously, one would have to declare a `SmithyModelProject` to achieve this, but this needed an ignored `service` to be defined in the model and generated an OpenAPI spec as part of its build, which is unnecessary. Fixes #825
- Loading branch information
Showing
19 changed files
with
5,387 additions
and
306 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
41 changes: 41 additions & 0 deletions
41
...ges/type-safe-api/src/project/model/smithy/components/smithy-shape-library-sample-code.ts
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,41 @@ | ||
/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 */ | ||
import { Project, SampleDir } from "projen"; | ||
|
||
/** | ||
* Options for Smithy shape library sample code | ||
*/ | ||
export interface SmithyShapeLibrarySampleCodeOptions { | ||
/** | ||
* Directory in which the smithy sample code should be written | ||
*/ | ||
readonly modelDir: string; | ||
/** | ||
* Namespace | ||
*/ | ||
readonly namespace: string; | ||
} | ||
|
||
/** | ||
* Defines sample code for a Smithy shape library | ||
*/ | ||
export class SmithyShapeLibrarySampleCode extends SampleDir { | ||
constructor( | ||
project: Project, | ||
{ modelDir, namespace }: SmithyShapeLibrarySampleCodeOptions | ||
) { | ||
super(project, modelDir, { | ||
files: { | ||
"example.smithy": `$version: "2" | ||
namespace ${namespace} | ||
/// An example structure | ||
structure Example { | ||
@required | ||
myProperty: String | ||
} | ||
`, | ||
}, | ||
}); | ||
} | ||
} |
78 changes: 0 additions & 78 deletions
78
packages/type-safe-api/src/project/model/smithy/smithy-async-definition.ts
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.