Skip to content

Commit

Permalink
Merge pull request #52 from VachaShah/upgrade-smithy
Browse files Browse the repository at this point in the history
Upgrading to Smithy 2
  • Loading branch information
VachaShah authored Oct 19, 2022
2 parents ac03650 + 7d61bb9 commit af08988
Show file tree
Hide file tree
Showing 31 changed files with 95 additions and 111 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ build/

# osx stuff
.DS_Store

.smithy.lsp.log
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ repositories {

buildscript {
dependencies {
val smithyVersion = "1.21.0"
val smithyVersion = "1.25.2"
classpath("software.amazon.smithy:smithy-openapi:$smithyVersion")
classpath("software.amazon.smithy:smithy-aws-traits:$smithyVersion")
classpath("software.amazon.smithy:smithy-cli:$smithyVersion")
}
}

dependencies {
implementation("software.amazon.smithy:smithy-model:1.21.0")
implementation("software.amazon.smithy:smithy-aws-traits:1.21.0")
implementation("software.amazon.smithy:smithy-model:1.25.2")
implementation("software.amazon.smithy:smithy-aws-traits:1.25.2")
}
1 change: 1 addition & 0 deletions model/_global/ping/operations.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

@readonly
Expand Down
1 change: 1 addition & 0 deletions model/_global/ping/structures.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

structure GetPingClusterInput {
Expand Down
1 change: 1 addition & 0 deletions model/_global/search/operations.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

@externalDocumentation(
Expand Down
1 change: 1 addition & 0 deletions model/_global/search/structures.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

structure PostSearchInput {
Expand Down
1 change: 1 addition & 0 deletions model/_types/query_dsl/abstractions.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

structure UserDefinedObjectStructure {
Expand Down
1 change: 1 addition & 0 deletions model/cat/indices/cat_indicies/operations.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

@externalDocumentation(
Expand Down
1 change: 1 addition & 0 deletions model/cat/indices/cat_indicies/structures.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// this file be licensed under the Apache-2.0 license or a
//

$version: "2"
namespace OpenSearch

structure GetCatIndicesInput {
Expand Down
1 change: 1 addition & 0 deletions model/cat/nodes/cat_nodes/operations.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

@externalDocumentation(
Expand Down
1 change: 1 addition & 0 deletions model/cat/nodes/cat_nodes/structures.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

structure GetCatNodesInput {
Expand Down
2 changes: 2 additions & 0 deletions model/cluster/get_cluster_settings/operations.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

@externalDocumentation(
"OpenSearch Documentation": "https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/"
)

@readonly
@suppress(["HttpUriConflict"])
@http(method: "GET", uri: "/_cluster/settings")
@documentation("Returns cluster settings.")
Expand Down
1 change: 1 addition & 0 deletions model/cluster/get_cluster_settings/structures.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

structure GetClusterSettingsInput {
Expand Down
2 changes: 2 additions & 0 deletions model/cluster/put_update_cluster_settings/operations.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

@externalDocumentation(
"OpenSearch Documentation": "https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/"
)

@idempotent
@suppress(["HttpUriConflict"])
@http(method: "PUT", uri: "/_cluster/settings")
@documentation("Updates the cluster settings.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

structure PutUpdateClusterSettingsInput {
Expand Down
18 changes: 6 additions & 12 deletions model/common_datatypes.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

@pattern("^[^+_\\-\\.][^\\\\, /*?\"<>| ,#\\nA-Z]+$")
Expand All @@ -21,18 +22,11 @@ map UserDefinedValueMap{

document UserDefinedValue

@enum([
{
value: "transient",
name: "transient"},
{
value: "persistent",
name: "persistent"},
{
value: "defaults",
name: "defaults"}
])
string SettingType
enum SettingType {
TRANSIENT = "transient"
PERSISTENT = "persistent"
DEFAULTS = "defaults"
}

list UserDefinedValueList{
member: String
Expand Down
146 changes: 50 additions & 96 deletions model/common_enums.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,101 +4,55 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

@enum([
{
value: "all",
name: "all",
documentation:"Match any data stream or index, including hidden ones."},
{
value: "open",
name: "open",
documentation:"Match open, non-hidden indices. Also matches any non-hidden data stream."},
{
value: "closed",
name: "closed",
documentation:"Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed."},
{
value: "hidden",
name: "hidden",
documentation:"Match hidden data streams and hidden indices. Must be combined with open, closed, or both."},
{
value: "none",
name: "none",
documentation:"Wildcard expressions are not accepted."}
])
string ExpandWildcards

@enum([
{
value: "AND",
name: "AND"},
{
value: "OR",
name: "OR"}
])
string DefaultOperator

@enum([
{
value: "0",
name: "query_then_fetch",
documentation:"Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate."},
{
value: "1",
name: "dfs_query_then_fetch",
documentation:"Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate."}
])
string SearchType

@enum([
{
value: "0",
name: "missing"},
{
value: "1",
name: "popular"},
{
value: "2",
name: "always"}
])
string SuggestMode

@enum([
{
value: "internal",
name: "internal"},
{
value: "external",
name: "external"},
{
value: "external_gte",
name: "external_gte"}
])
string VersionType

@enum([
{
value: "green",
name: "green"},
{
value: "yellow",
name: "yellow"},
{
value: "red",
name: "red"}
])
string HealthStatus

@enum([
{
value: "eq",
name: "eq",
documentation:"Accurate"},
{
value: "gte",
name: "gte",
documentation:"Lower bound, including returned documents"}
])
string Relation
enum ExpandWildcards {
@documentation("Match any data stream or index, including hidden ones.")
ALL = "all"
@documentation("Match open, non-hidden indices. Also matches any non-hidden data stream.")
OPEN = "open"
@documentation("Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.")
CLOSED = "closed"
@documentation("Match hidden data streams and hidden indices. Must be combined with open, closed, or both.")
HIDDEN = "hidden"
@documentation("Wildcard expressions are not accepted.")
NONE = "none"
}

enum DefaultOperator {
AND = "AND"
OR = "OR"
}

enum SearchType {
@documentation("Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.")
QUERY_THEN_FETCH = "0"
@documentation("Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.")
DFS_QUERY_THEN_FETCH = "1"
}

enum SuggestMode {
MISSING = "0"
POPULAR = "1"
ALWAYS = "2"
}

enum VersionType {
INTERNAL = "internal"
EXTERNAL = "external"
EXTERNAL_GTE = "external_gte"
}

enum HealthStatus {
GREEN = "green"
YELLOW = "yellow"
RED = "red"
}

enum Relation {
@documentation("Accurate")
EQ = "eq"
@documentation("Lower bound, including returned documents")
GTE = "gte"
}
1 change: 1 addition & 0 deletions model/common_structures.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

structure ShardStatistics{
Expand Down
1 change: 1 addition & 0 deletions model/indices/aliases/operations.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

@externalDocumentation(
Expand Down
1 change: 1 addition & 0 deletions model/indices/aliases/structures.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

structure PostAliasesInput {
Expand Down
2 changes: 2 additions & 0 deletions model/indices/create/operations.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

@externalDocumentation(
"OpenSearch Documentation": "https://opensearch.org/docs/latest/opensearch/rest-api/index-apis/create-index/"
)

@idempotent
@suppress(["HttpUriConflict"])
@http(method: "PUT", uri: "/{index}")
@documentation("Creates index mappings.")
Expand Down
1 change: 1 addition & 0 deletions model/indices/create/structures.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

structure PutCreateIndexInput {
Expand Down
2 changes: 2 additions & 0 deletions model/indices/delete/operations.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

@externalDocumentation(
"OpenSearch Documentation": "https://opensearch.org/docs/latest/opensearch/rest-api/index-apis/delete-index/"
)

@idempotent
@http(method: "DELETE", uri: "/{index}")
@suppress(["HttpUriConflict"])
@documentation("Removes a document from the index.")
Expand Down
1 change: 1 addition & 0 deletions model/indices/delete/structures.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// this file be licensed under the Apache-2.0 license or a
// compatible open source license.

$version: "2"
namespace OpenSearch

structure DeleteIndexInput {
Expand Down
Loading

0 comments on commit af08988

Please sign in to comment.