smithy/smithy-openapi-traits/build.gradle

16 lines
390 B
Groovy
Raw Normal View History

Support serializing traits into specification extensions in OpenAPI (#1609) ## `smithy.openapi#specificationExtension` Adds a meta trait `smithy.openapi#specificationExtension` that can be used to annotate traits to indicate they should be serialized into specification extension (`x-*`) properties when converting to OpenAPI. This is supported on shapes, operations, and services. By default the extension will be named by the shape ID replacing `#` & `.` with `-` prefixed with `x-`, otherwise the extension can be specified using the `as` property. A new package `smithy-openapi-traits` is introduced to contain the `smithy.openapi#specificationExtension` trait. ## `JsonSchemaMapper` and `JsonSchemaShapeVisitor` BREAKING CHANGE: Technically, `JsonSchemaMapper` has a breaking change from a functional interface to a normal interface, but we are anticipating customers are not using `JsonSchemaMapper` as a functional interface since it was not annotated with `@FunctionalInterface`. `JsonSchemaMapper` is updated to use `updateSchema(JsonSchemaMapperContext, Schema.Builder)` in `JsonSchemaShapeVisitor`, which will call the existing `updateSchema(Shape, Schema.Builder, JsonSchemaConfig)` by default when not implemented for backwards compatibility. ## `smithy-openapi` Support is added for `smithy.openapi#specificationExtension` by implementing `SpecificationExtensionsMapper` for operations and services and updating `OpenApiJsonSchemaMapper` for shapes. --------- Co-authored-by: Steven Yuan <yuasteve@amazon.com>
2023-08-17 03:11:20 +08:00
/*
* Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
description = "This module provides Smithy traits that are used in converting a Smithy model to OpenAPI."
ext {
displayName = "Smithy :: OpenAPI Traits"
moduleName = "software.amazon.smithy.openapi.traits"
}
dependencies {
api project(":smithy-model")
}