Skip to content

Commit 542fa13

Browse files
Update documentation
1 parent 3bbbac3 commit 542fa13

235 files changed

Lines changed: 11674 additions & 6779 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1.0/_sources/guides/building-models/build-config.rst.txt

Lines changed: 482 additions & 536 deletions
Large diffs are not rendered by default.

1.0/_sources/guides/building-models/gradle-plugin.rst.txt

Lines changed: 129 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ Installation
1616
The Smithy Gradle plugin is applied using the ``software.amazon.smithy`` plugin.
1717
The following example configures a project to use the Smithy Gradle plugin:
1818

19-
.. tabs::
19+
.. code-block:: kotlin
2020
21-
.. code-tab:: kotlin
22-
23-
plugins {
24-
id("software.amazon.smithy").version("0.6.0")
25-
}
21+
plugins {
22+
id("software.amazon.smithy").version("0.6.0")
23+
}
2624
2725
2826
.. _smithy-model-sources:
@@ -66,13 +64,11 @@ Smithy extension properties
6664
This plugin is configured using the ``software.amazon.smithy.gradle.SmithyExtension``
6765
extension:
6866

69-
.. tabs::
70-
71-
.. code-tab:: kotlin
67+
.. code-block:: kotlin
7268
73-
configure<software.amazon.smithy.gradle.SmithyExtension> {
74-
projection = "foo"
75-
}
69+
configure<software.amazon.smithy.gradle.SmithyExtension> {
70+
projection = "foo"
71+
}
7672
7773
7874
This extension supports the following properties:
@@ -133,31 +129,29 @@ build scripts, Smithy models are discovered using only the
133129
The following example ``build.gradle.kts`` will build a Smithy model using a
134130
"source" build:
135131

136-
.. tabs::
132+
.. code-block:: kotlin
137133
138-
.. code-tab:: kotlin
134+
plugins {
135+
id("software.amazon.smithy").version("0.6.0")
136+
}
139137
140-
plugins {
141-
id("software.amazon.smithy").version("0.6.0")
142-
}
138+
// The SmithyExtension is used to customize the build. This example
139+
// doesn't set any values and can be completely omitted.
140+
configure<software.amazon.smithy.gradle.SmithyExtension> {}
143141
144-
// The SmithyExtension is used to customize the build. This example
145-
// doesn't set any values and can be completely omitted.
146-
configure<software.amazon.smithy.gradle.SmithyExtension> {}
142+
repositories {
143+
mavenLocal()
144+
mavenCentral()
145+
}
147146
148-
repositories {
149-
mavenLocal()
150-
mavenCentral()
151-
}
147+
dependencies {
148+
implementation("software.amazon.smithy:smithy-model:__smithy_version__")
152149
153-
dependencies {
154-
implementation("software.amazon.smithy:smithy-model:__smithy_version__")
155-
156-
// These are just examples of dependencies. This model has a dependency on
157-
// a "common" model package and uses the external AWS traits.
158-
implementation("com.foo.baz:foo-model-internal-common:1.0.0")
159-
implementation("software.amazon.smithy:smithy-aws-traits:__smithy_version__")
160-
}
150+
// These are just examples of dependencies. This model has a dependency on
151+
// a "common" model package and uses the external AWS traits.
152+
implementation("com.foo.baz:foo-model-internal-common:1.0.0")
153+
implementation("software.amazon.smithy:smithy-aws-traits:__smithy_version__")
154+
}
161155
162156
163157
.. _generating-projection:
@@ -179,91 +173,87 @@ projected version of the model.
179173
The following example ``build.gradle.kts`` file will run a "projection"
180174
build that uses the "external" projection.
181175

182-
.. tabs::
183-
184-
.. code-tab:: kotlin
185-
186-
plugins {
187-
id("software.amazon.smithy").version("0.6.0")
188-
}
189-
190-
buildscript {
191-
repositories {
192-
mavenLocal()
193-
mavenCentral()
194-
}
195-
dependencies {
196-
classpath("software.amazon.smithy:smithy-aws-traits:__smithy_version__")
197-
198-
// Take a dependency on the internal model package. This
199-
// dependency *must* be a buildscript only dependency to ensure
200-
// that is does not appear in the generated JAR.
201-
classpath("com.foo.baz:foo-internal-model:1.0.0")
202-
}
203-
}
204-
205-
// Use the "external" projection. This projection must be found in the
206-
// smithy-build.json file. This also ensures that models found in the
207-
// foo-internal-package that weren't filtered out are copied into the
208-
// projection created by this package.
209-
configure<software.amazon.smithy.gradle.SmithyExtension> {
210-
projection = "external"
211-
projectionSourceTags = setOf("com.foo.baz:foo-internal-model")
212-
}
213-
214-
repositories {
215-
mavenLocal()
216-
mavenCentral()
217-
}
218-
219-
dependencies {
220-
implementation("software.amazon.smithy:smithy-model:__smithy_version__")
221-
222-
// Any dependencies that the projected model needs must be (re)declared
223-
// here. For example, let's assume that the smithy-aws-traits package is
224-
// needed in the projected model too.
225-
implementation("software.amazon.smithy:smithy-aws-traits:__smithy_version__")
226-
}
176+
.. code-block:: kotlin
177+
178+
plugins {
179+
id("software.amazon.smithy").version("0.6.0")
180+
}
181+
182+
buildscript {
183+
repositories {
184+
mavenLocal()
185+
mavenCentral()
186+
}
187+
dependencies {
188+
classpath("software.amazon.smithy:smithy-aws-traits:__smithy_version__")
189+
190+
// Take a dependency on the internal model package. This
191+
// dependency *must* be a buildscript only dependency to ensure
192+
// that is does not appear in the generated JAR.
193+
classpath("com.foo.baz:foo-internal-model:1.0.0")
194+
}
195+
}
196+
197+
// Use the "external" projection. This projection must be found in the
198+
// smithy-build.json file. This also ensures that models found in the
199+
// foo-internal-package that weren't filtered out are copied into the
200+
// projection created by this package.
201+
configure<software.amazon.smithy.gradle.SmithyExtension> {
202+
projection = "external"
203+
projectionSourceTags = setOf("com.foo.baz:foo-internal-model")
204+
}
205+
206+
repositories {
207+
mavenLocal()
208+
mavenCentral()
209+
}
210+
211+
dependencies {
212+
implementation("software.amazon.smithy:smithy-model:__smithy_version__")
213+
214+
// Any dependencies that the projected model needs must be (re)declared
215+
// here. For example, let's assume that the smithy-aws-traits package is
216+
// needed in the projected model too.
217+
implementation("software.amazon.smithy:smithy-aws-traits:__smithy_version__")
218+
}
227219
228220
229221
Because the ``projection`` of the ``SmithyExtension`` was set to ``external``, a
230222
``smithy-build.json`` file **must** be found that defines the ``external``
231223
projection. For example:
232224

233-
.. tabs::
234-
235-
.. code-tab:: json
236-
237-
{
238-
"version": "1.0",
239-
"projections": {
240-
"external": {
241-
"transforms": [
242-
{
243-
"name": "excludeShapesByTag",
244-
"args": {
245-
"tags": ["internal"]
246-
}
247-
},
248-
{
249-
"name": "excludeShapesByTrait",
250-
"args": {
251-
"traits": ["internal"]
252-
}
253-
},
254-
{
255-
"name": "excludeMetadata",
256-
"args": {
257-
"keys": ["suppressions", "validators"]
258-
}
259-
},
260-
{
261-
"name": "removeUnusedShapes"
262-
}
263-
]
264-
}
265-
}
266-
}
225+
.. code-block:: json
226+
227+
{
228+
"version": "1.0",
229+
"projections": {
230+
"external": {
231+
"transforms": [
232+
{
233+
"name": "excludeShapesByTag",
234+
"args": {
235+
"tags": ["internal"]
236+
}
237+
},
238+
{
239+
"name": "excludeShapesByTrait",
240+
"args": {
241+
"traits": ["internal"]
242+
}
243+
},
244+
{
245+
"name": "excludeMetadata",
246+
"args": {
247+
"keys": ["suppressions", "validators"]
248+
}
249+
},
250+
{
251+
"name": "removeUnusedShapes"
252+
}
253+
]
254+
}
255+
}
256+
}
267257
268258
269259
.. _projection-tags:
@@ -275,26 +265,22 @@ Projections are meant to *project* and filter other models into another
275265
model. You need to specify which dependencies are being projected into your
276266
JAR by setting the ``projectionSourceTags`` property.
277267

278-
.. tabs::
279-
280-
.. code-tab:: kotlin
268+
.. code-block:: kotlin
281269
282-
configure<software.amazon.smithy.gradle.SmithyExtension> {
283-
projection = "external"
284-
projectionSourceTags = setOf("Foo", "com.baz:bar")
285-
}
270+
configure<software.amazon.smithy.gradle.SmithyExtension> {
271+
projection = "external"
272+
projectionSourceTags = setOf("Foo", "com.baz:bar")
273+
}
286274
287275
288276
Tags are used to logically group packages to make it easier to build
289277
projections. The ``tags`` property is used to add ``Smithy-Tags`` to a JAR.
290278

291-
.. tabs::
279+
.. code-block:: kotlin
292280
293-
.. code-tab:: kotlin
294-
295-
configure<software.amazon.smithy.gradle.SmithyExtension> {
296-
tags = setOf("X", "foobaz-model")
297-
}
281+
configure<software.amazon.smithy.gradle.SmithyExtension> {
282+
tags = setOf("X", "foobaz-model")
283+
}
298284
299285
300286
For example, if your service is made up of 10 packages, you can add the
@@ -317,37 +303,33 @@ will be used to generate :ref:`artifacts <projection-artifacts>` from the Smithy
317303

318304
The following example generates an OpenAPI model from a Smithy model:
319305

320-
.. tabs::
321-
322-
.. code-tab:: json
306+
.. code-block:: json
323307
324-
{
325-
"version": "1.0",
326-
"plugins": {
327-
"openapi": {
328-
"service": "foo.baz#MyService"
329-
}
330-
}
331-
}
308+
{
309+
"version": "1.0",
310+
"plugins": {
311+
"openapi": {
312+
"service": "foo.baz#MyService"
313+
}
314+
}
315+
}
332316
333317
334318
The above Smithy plugin also requires a ``buildscript`` dependency in
335319
``build.gradle.kts``:
336320

337-
.. tabs::
338-
339-
.. code-tab:: kotlin
321+
.. code-block:: kotlin
340322
341-
buildscript {
342-
// ...
343-
dependencies {
344-
// ...
323+
buildscript {
324+
// ...
325+
dependencies {
326+
// ...
345327
346-
// This dependency is required in order to apply the "openapi"
347-
// plugin in smithy-build.json
348-
classpath("software.amazon.smithy:smithy-openapi:__smithy_version__")
349-
}
350-
}
328+
// This dependency is required in order to apply the "openapi"
329+
// plugin in smithy-build.json
330+
classpath("software.amazon.smithy:smithy-openapi:__smithy_version__")
331+
}
332+
}
351333
352334
Complete Examples
353335
=================

1.0/_sources/guides/model-linters.rst.txt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@ can be used to apply additional validation to Smithy models.
1616
The following example adds ``smithy-linters`` as a Gradle dependency
1717
to a ``build.gradle.kts`` file:
1818

19-
.. tabs::
19+
.. code-block:: kotlin
2020
21-
.. code-tab:: kotlin
22-
23-
dependencies {
24-
implementation("software.amazon.smithy:smithy-model:__smithy_version__")
25-
implementation("software.amazon.smithy:smithy-linters:__smithy_version__")
26-
}
21+
dependencies {
22+
implementation("software.amazon.smithy:smithy-model:__smithy_version__")
23+
implementation("software.amazon.smithy:smithy-linters:__smithy_version__")
24+
}
2725
2826
After the dependency is added and available on the Java classpath, validators
2927
defined in the package and registered using `Java SPI`_ are available for

0 commit comments

Comments
 (0)