Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add README's for most modules. #573

Merged
merged 8 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
# <img alt="Smithy" src="https://github.com/smithy-lang/smithy/blob/main/docs/_static/smithy-anvil.svg?raw=true" width="32"> Smithy Java
# <img alt="Smithy" src="https://github.com/smithy-lang/smithy/blob/main/docs/_static/smithy-anvil.svg?raw=true" width="32"> Smithy Java
[![ci](https://github.com/smithy-lang/smithy-java/actions/workflows/ci.yml/badge.svg)](https://github.com/smithy-lang/smithy-java/actions/workflows/ci.yml)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)

[Smithy](https://smithy.io/2.0/index.html) code generators for [Java](https://java.com/).
[Smithy](https://smithy.io/2.0/index.html) code generators for clients, servers, and shapes for [Java](https://java.com/).

> [!Caution]
> This project is confidential until the repository is made public.
> [!WARNING]
> This project is still in development and is not intended for use in production.

## Usage
> [!WARNING]
> This project is in early development and is not intended for use in production.
> Smithy-Java only supports **Java 17** or later. Older Java versions are not supported.

### API Stability
APIs annotated with `@SmithyInternal` are for internal use by Smithy-Java libraries and should not be used by Smithy users.
APIs annotated with `@SmithyUnstableApi` are subject to change in future releases, and library code that other projects
may depend on should not use these APIs.

## Development
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information on contributing to the Smithy-Java project.

### Pre-push hooks
Pre-push hooks are automatically added for unix users via the `addPrePushHooks` gradle task.
Pre-push hooks are automatically added for unix users via the `addGitHooks` gradle task.

**Note**: In order to successfully execute the pre-defined hooks you must have the `smithy` CLI installed.
See [installation instructions](https://smithy.io/2.0/guides/smithy-cli/cli_installation.html) if you do not already have the CLI installed.

## Security

See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our
[vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/).
Please do **not** create a public GitHub issue.

## License

This project is licensed under the Apache-2.0 License.

2 changes: 2 additions & 0 deletions auth-api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## auth-api
This module provides the auth API for clients and servers.
6 changes: 6 additions & 0 deletions aws/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## AWS SDK Packages
Packages within this directory are specific to AWS SDKs and the use of AWS services.

### Service Integrations
The following integrations for AWS services are provided:
- [lambda](./integrations/lambda) - Wrapper for running Smithy Java services on AWS Lambda
3 changes: 3 additions & 0 deletions aws/client/aws-client-awsjson/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## aws-client-awsjson
Client implementation of the [AWS JSON 1.0](https://smithy.io/2.0/aws/protocols/aws-json-1_0-protocol.html#aws-json-1-0-protocol)
and [AWS JSON 1.1](https://smithy.io/2.0/aws/protocols/aws-json-1_1-protocol.html#aws-json-1-1-protocol) protocols.
2 changes: 2 additions & 0 deletions aws/client/aws-client-core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## aws-client-core
Provides common client functionality for AWS SDKs.
2 changes: 2 additions & 0 deletions aws/client/aws-client-http/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## aws-client-http
Provides common HTTP functionality for AWS SDKs.
3 changes: 3 additions & 0 deletions aws/client/aws-client-restjson/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## aws-client-restjson
Client implementation of the [AWS restJson1](https://smithy.io/2.0/aws/protocols/aws-json-1_1-protocol.html#aws-json-1-1-protocol)
protocol.
3 changes: 3 additions & 0 deletions aws/client/aws-client-restxml/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## aws-client-restxml
Client implementation of the [AWS restXml](https://smithy.io/2.0/aws/protocols/aws-restxml-protocol.html#aws-restxml-protocol)
protocol.
3 changes: 3 additions & 0 deletions aws/server/aws-server-restjson/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## aws-server-restjson
Server implementation of the [AWS restJson1](https://smithy.io/2.0/aws/protocols/aws-json-1_1-protocol.html#aws-json-1-1-protocol)
protocol.
21 changes: 21 additions & 0 deletions client/client-core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## client-core
This module provides the core functionality required to execute the client
request pipeline. This module is used by both code generated and dynamic clients.

**Note:** Code generated clients require this module as a runtime dependency.

The functionality provided by this module includes:
- Auth Scheme API and Auth Scheme Resolution
- Identity Resolution
- Endpoint API and Endpoint Resolution
- Client Interceptors
- Pagination
- Exception Mapping
- Client Plugin API
- Client Transport API
- Client Protocol API
- Default Client Plugins
- Base Client settings

To generate a client see the [client-codegen plugin](../codegen/plugins/client).
To use a dynamic client see the [dynamic-client](../dynamic-client) module.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@SmithyUnstableApi
package software.amazon.smithy.java.client.core;

import software.amazon.smithy.utils.SmithyUnstableApi;
4 changes: 4 additions & 0 deletions client/client-http-binding/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### client-http-binding
Provides client specific [http-binding](https://smithy.io/2.0/spec/http-bindings.html#http-bindings) functionality.
Http-binding allows Smithy-modeled data to be bound to various parts of an HTTP message such
as headers, query parameters, or the message body.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@SmithyUnstableApi
package software.amazon.smithy.java.client.http.binding;

import software.amazon.smithy.utils.SmithyUnstableApi;
2 changes: 2 additions & 0 deletions client/client-http/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
### client-http
Provides a client-side implementation of HTTP transport.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@SmithyUnstableApi
package software.amazon.smithy.java.client.http;

import software.amazon.smithy.utils.SmithyUnstableApi;
41 changes: 41 additions & 0 deletions client/client-rpcv2-cbor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## client-rpcv2-cbor
Client implementation of the [rpcv2-cbor](https://smithy.io/2.0/additional-specs/protocols/smithy-rpc-v2.html#smithy-rpc-v2-cbor-protocol) protocol.

### Usage
To use this protocol as the default in a generated client, first add the `@rpcv2Cbor` trait
to your service.

```diff
$version: "2"

namespace smithy.example

+ use smithy.protocols#rpcv2Cbor

+@rpcv2Cbor
service MyService {
version: "2020-07-02"
}
```

Then add this module as a runtime dependency of your project
```diff
dependencies {
+ implementation("software.amazon.smithy.java:client-rpcv2-cbor")
}
```

Finally, configure the client codegen plugin to use this protocol as the
default
```diff
{
"version": "1.0",
"plugins": {
"java-client-codegen": {
"service": "com.example#CoffeeShop",
"namespace": "com.example.cafe",
+ "protocol": "smithy.protocols#rpcv2Cbor"
}
}
}
```
34 changes: 34 additions & 0 deletions client/dynamic-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
### dynamic-client
Provides a dynamic client that can be used without code generation.

The dynamic client can load Smithy models at runtime, convert them to a schema-based client,
and call a service using `Document` types as input and output.

### Example usage
```java
// (1) Load up a model
var model = Model.assembler()
.addImport("/path/to/model.json")
.assemble()
.unwrap();

// (2) Which service to call
var shapeId = ShapeId.from("com.example#CoffeeShop");

// (3) make the client and manually wire up the protocol, transport, etc.
var client = DynamicClient.builder()
.service(shapeId)
.model(model)
.protocol(new RestJsonClientProtocol(shapeId))
.transport(new JavaHttpClientTransport())
.endpointResolver(EndpointResolver.staticEndpoint("https://api.cafe.example.com"))
.build();

// (4) Input is defined using a document that mirrors what you'd see in the Smithy model.
var input = Document.createFromObject(Map.of("coffeeType", "COLD_BREW"));

// (5) "call" is used to send the input to an operation by name, and it returns a document too.
var result = client.call("CreateOrder", input).get();

System.out.println(result);
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@SmithyUnstableApi
package software.amazon.smithy.java.dynamicclient;

import software.amazon.smithy.utils.SmithyUnstableApi;
38 changes: 38 additions & 0 deletions client/mock-client-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## mock-client-plugin
The MockPlugin is used to intercept client requests and return canned
responses, shapes, or exceptions.

### Usage
```java
// (1) Create a response queue and add a set of canned responses that will be returned
// from client in the order in which they were added to the queue.
var mockQueue = new MockQueue();
mockQueue.enqueue(
HttpResponse.builder()
.statusCode(200)
.body(DataStream.ofString("{\"id\":\"1\"}"))
.build()
);
mockQueue.enqueue(
HttpResponse.builder()
.statusCode(429)
.body(DataStream.ofString("{\"__type\":\"InvalidSprocketId\"}"))
.build()
);

// (2) Create a MockPlugin instance using the request queue created above.
var mockPlugin = MockPlugin.builder().addQueue(mockQueue).build();

// (3) Create a client instance that uses the MockPlugin.
var client = SprocketClient.builder()
.addPlugin(mockPlugin)
.build();

// (4) Call client to get the first canned response from the queue.
var response = client.createSprocket(CreateSprocketRequest.builder().id(2).build());

// (5) Inspect the HTTP requests that were sent to the client.
var requests = mock.getRequests();

```

20 changes: 20 additions & 0 deletions client/waiters/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## waiters
Provides the core runtime functionality for [Waiters](https://smithy.io/2.0/additional-specs/waiters.html#waiters).

Waiters are a client-side abstraction used to poll a resource until a desired state is reached,
or until it is determined that the resource will never enter into the desired state.

### Usage
A Waiter can be manually created using:
```java
// Create a waiter with a single failure acceptor
var waiter = Waiter.builder(client::getFoosSync)
.failure(Matcher.output(o -> o.status().equals("FAILED")))
.build();
// Wait for up to 2 seconds for waiter to complete
waiter.wait(input, Duration.ofSeconds(2));
```

Waiters can also be code generated for your client based on the presence of the `smithy.waiters#waitable` trait.
To code generate waiters see: [waiter-integration](../../codegen/integrations/waiters-codegen)

9 changes: 9 additions & 0 deletions codecs/cbor-codec/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### rpcv2-cbor-codec
Provides a codec for serializing or deserializing CBOR data to/from
Smithy-Java `SerializableShape`'s.

> [!NOTE]
> This codec follows the [Smithy RPCv2 CBOR specification](https://smithy.io/2.0/additional-specs/protocols/smithy-rpc-v2.html#shape-serialization)
> for the encoding of BigIntegers, BigDecimals, and Timestamps.

CBOR Protocol implementation can use this package to provide basic serde functionality.
8 changes: 8 additions & 0 deletions codecs/json-codec/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## json-codec
Provides a codec for serializing or deserializing JSON data to/from
Smithy-Java `SerializableShape`'s.

JSON Protocol implementation can use this package to provide basic serde capabilities.

**Note:** This codec can discover custom `JsonSerdeProvider` service implementations via SPI.
By default, [Jackson](https://github.com/FasterXML/jackson) is used to provide JSON serde.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@SmithyUnstableApi
package software.amazon.smithy.java.json;

import software.amazon.smithy.utils.SmithyUnstableApi;
5 changes: 5 additions & 0 deletions codecs/xml-codec/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## xml-codec
Provides a codec for serializing or deserializing XML data to/from
Smithy-Java `SerializableShape`'s.

XML Protocol implementation can use this package to provide basic serde.
3 changes: 3 additions & 0 deletions codegen/core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## codegen-core
Provides the base functionality for Java code generation used
by all Smithy Java codegen plugins.
16 changes: 16 additions & 0 deletions codegen/integrations/waiters-codegen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## waiters-codegen
Codegen integration to generate pre-defined waiters based on
[waitable](https://smithy.io/2.0/additional-specs/waiters.html#smithy-waiters-waitable-trait) traits in the service model.

### Usage
```kotlin
dependencies {
// Add codegen integration as a smithy-build dependency, so it can be
// discovered by the client codegen plugin
smithyBuild("software.amazon.smithy.java.codegen:waiters:<VERSION>")

// Add waiters core package as a runtime dependency
implementation("software.amazon.smithy.java:waiters:<VERSION>")
}
```

2 changes: 2 additions & 0 deletions codegen/plugins/client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
### codegen-client
Codegen plugin to generate a Java client from a Smithy model.
2 changes: 2 additions & 0 deletions codegen/plugins/server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
### codegen-server
Codegen plugin to generate Java server stubs from a Smithy model.
3 changes: 3 additions & 0 deletions codegen/plugins/types/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### codegen-types
Codegen plugin to generate standalone "plain old Java objects" (POJOs)
from a Smithy model.
3 changes: 3 additions & 0 deletions context/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## context
Provides a typed property map that can be used to store
contextual data.
3 changes: 3 additions & 0 deletions core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## core
Provides the core functionality common to all clients and servers
using the Smithy Java framework.
5 changes: 5 additions & 0 deletions framework-errors/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## framework-errors
> [!WARNING]
> Frameworks errors are a preview feature and may change significantly before 1.0 release.

Provides framework errors common to all Smithy-Java clients and servers.
2 changes: 2 additions & 0 deletions http-api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## http-api
Provides the Smithy Java HTTP API.
4 changes: 4 additions & 0 deletions http-binding/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### http-binding
Provides [http-binding](https://smithy.io/2.0/spec/http-bindings.html#http-bindings) functionality. This allows Smithy-modeled
data to be bound to various parts of an HTTP message such
as headers, query parameters, or the message body.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@SmithyUnstableApi
package software.amazon.smithy.java.http.binding;

import software.amazon.smithy.utils.SmithyUnstableApi;
3 changes: 3 additions & 0 deletions io/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## io
Provides the common I/O functionality for Smithy Java such
as construction and encoding of URL's and handling of data streams.
11 changes: 11 additions & 0 deletions jmespath/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## jmespath
Provides functionality to perform a [JMESPath](https://jmespath.org/) query
against a Smithy-Java `Document`.

### Example Usage
Given a `Document` representing the JSON object `{"foo": [1,2,3,4]}`,
all items in member `foo` greater than 2 could be queried as:

```java
Document result = JMESPathDocumentQuery.query("foo[?@ > `2`]", myDocument);
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@SmithyUnstableApi
package software.amazon.smithy.java.jmespath;

import software.amazon.smithy.utils.SmithyUnstableApi;
11 changes: 11 additions & 0 deletions logging/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## logging
> [!WARNING]
> This module is intended for internal components of the Smithy Java framework
> and should not be depended on by projects outside of this repository.

This package provides a common logging facade for internal
Smithy-Java logging. This logging facade supports the following
logger implementations:
- JDK System Logger (default)
- Log4j2 Logger
- Slf4j2 Logger
Loading