Skip to content

Commit

Permalink
Add cli and groovy examples to guides (#2165)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpmellema authored Feb 27, 2024
1 parent 18530ec commit 367c4a5
Show file tree
Hide file tree
Showing 9 changed files with 292 additions and 93 deletions.
4 changes: 2 additions & 2 deletions docs/source-2.0/aws/amazon-apigateway.rst
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ operation within the service.
.. code-block:: json
{
"smithy": "1.0",
"version": "2.0",
"shapes": {
"smithy.example#Weather": {
"type": "service",
Expand Down Expand Up @@ -531,7 +531,7 @@ The following example defines an operation that uses a mock integration.
.. code-block:: json
{
"smithy": "1.0",
"smithy": "2.0",
"shapes": {
"smithy.example#MyOperation": {
"type": "operation",
Expand Down
40 changes: 27 additions & 13 deletions docs/source-2.0/aws/rules-engine/auth-schemes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,12 @@ make it possible to validate configurations for AWS authentication schemes like
`AWS signature version 4`_. An additional dependency is required to access
these validators

The following example adds ``smithy-aws-endpoints`` as a Gradle dependency
to a Smithy project:
The following example adds ``smithy-aws-endpoints`` as a dependency to a Smithy project:

.. tab:: Gradle

.. code-block:: kotlin
dependencies {
...
implementation("software.amazon.smithy:smithy-aws-endpoints:__smithy_version__")
...
}
.. tab:: smithy-build.json
.. tab:: Smithy CLI

.. code-block:: json
:caption: smithy-build.json
{
"maven": {
Expand All @@ -34,6 +24,30 @@ to a Smithy project:
}
}
.. tab:: Gradle

.. tab:: Kotlin

.. code-block:: kotlin
:caption: build.gradle.kts
dependencies {
...
implementation("software.amazon.smithy:smithy-aws-endpoints:__smithy_version__")
...
}
.. tab:: Groovy

.. code-block:: groovy
:caption: build.gradle
dependencies {
...
implementation 'software.amazon.smithy:smithy-aws-endpoints:__smithy_version__'
...
}
.. _rules-engine-aws-authscheme-validator-sigv4:

-----------------------------------------
Expand Down
36 changes: 25 additions & 11 deletions docs/source-2.0/aws/rules-engine/built-ins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,10 @@ dependency is required to access these functions:
The following example adds ``smithy-aws-endpoints`` as a Gradle dependency
to a Smithy project:

.. tab:: Gradle

.. code-block:: kotlin
dependencies {
...
implementation("software.amazon.smithy:smithy-aws-endpoints:__smithy_version__")
...
}
.. tab:: smithy-build.json
.. tab:: Smithy CLI

.. code-block:: json
:caption: smithy-build.json
{
"maven": {
Expand All @@ -33,6 +24,29 @@ to a Smithy project:
}
}
.. tab:: Gradle

.. tab:: Kotlin

.. code-block:: kotlin
:caption: build.gradle.kts
dependencies {
...
implementation("software.amazon.smithy:smithy-aws-endpoints:__smithy_version__")
...
}
.. tab:: Groovy

.. code-block:: groovy
:caption: build.gradle
dependencies {
...
implementation 'software.amazon.smithy:smithy-aws-endpoints:__smithy_version__'
...
}
.. _rules-engine-aws-built-ins-region:

Expand Down
39 changes: 27 additions & 12 deletions docs/source-2.0/aws/rules-engine/library-functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,13 @@ make it possible to integrate AWS concepts like `Amazon Resource Names (ARNs)`_
and `Partitions`_. An additional dependency is required to access these
functions:

The following example adds ``smithy-aws-endpoints`` as a Gradle dependency
The following example adds ``smithy-aws-endpoints`` as a dependency
to a Smithy project:

.. tab:: Gradle

.. code-block:: kotlin
dependencies {
...
implementation("software.amazon.smithy:smithy-aws-endpoints:__smithy_version__")
...
}
.. tab:: smithy-build.json
.. tab:: Smithy CLI

.. code-block:: json
:caption: smithy-build.json
{
"maven": {
Expand All @@ -34,6 +25,30 @@ to a Smithy project:
}
}
.. tab:: Gradle

.. tab:: Kotlin

.. code-block:: kotlin
:caption: build.gradle.kts
dependencies {
...
implementation("software.amazon.smithy:smithy-aws-endpoints:__smithy_version__")
...
}
.. tab:: Groovy

.. code-block:: groovy
:caption: build.gradle
dependencies {
...
implementation 'software.amazon.smithy:smithy-aws-endpoints:__smithy_version__'
...
}
.. _rules-engine-aws-library-awsPartition:

``aws.partition`` function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Smithy code generators are configured using plugins defined in
smithy-build.json files. For example:

.. code-block:: json
:caption: smithy-build.json
:emphasize-lines: 4-9
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ Interfaces (SPI).
Consider the following smithy-build.json file:

.. code-block:: json
:caption: smithy-build.json
{
{
"version": "1.0",
"plugins": {
"foo-client-codegen": {
Expand All @@ -36,7 +37,7 @@ Consider the following smithy-build.json file:
"edition": "2022"
}
}
}
}
This file tells Smithy-Build to generate a hypothetical Foo language
client using the ``foo-client-codegen`` plugin found on the classpath.
Expand Down Expand Up @@ -149,8 +150,9 @@ implementation. For example, here's how service code generation could be
configured for a Java code generator:

.. code-block:: json
:caption: smithy-build.json
{
{
"version": "1.0",
"projections": {
"source": {
Expand All @@ -164,7 +166,7 @@ configured for a Java code generator:
}
}
}
}
}
Client generation
Expand Down
44 changes: 37 additions & 7 deletions docs/source-2.0/guides/model-linters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,45 @@ that is configurable. Linter implementations are found in code. The
`smithy-linters`_ package in Maven Central contains several linters that
can be used to apply additional validation to Smithy models.

The following example adds ``smithy-linters`` as a Gradle dependency
to a ``build.gradle.kts`` file:
The following example adds ``smithy-linters`` as a dependency to a Smithy project:

.. code-block:: kotlin
.. tab:: Smithy CLI

.. code-block:: json
:caption: smithy-build.json
{
"...": "...",
"maven": {
"dependencies": [
"software.amazon.smithy:smithy-linters:__smithy_version__"
]
},
"...": "..."
}
.. tab:: Gradle

.. tab:: Kotlin

.. code-block:: kotlin
:caption: build.gradle.kts
dependencies {
...
implementation("software.amazon.smithy:smithy-linters:__smithy_version__")
}
.. tab:: Groovy

.. code-block:: groovy
:caption: build.gradle
dependencies {
...
implementation 'software.amazon.smithy:smithy-linters:__smithy_version__'
}
dependencies {
implementation("software.amazon.smithy:smithy-model:__smithy_version__")
implementation("software.amazon.smithy:smithy-linters:__smithy_version__")
}
After the dependency is added and available on the Java classpath, validators
defined in the package and registered using `Java SPI`_ are available for
Expand Down
Loading

0 comments on commit 367c4a5

Please sign in to comment.