Skip to main content Svelte Highlight v7.21.1

Smithy language preview

1. A user shape and service

the version control statement, traits, and a doc comment
horizon-dark
$version: "2"

namespace com.example

/// A simple user shape
@readonly
structure User {
    @required
    id: String

    name: String
}

service UserService {
    version: "2024-01-01"
    resources: [com.example#User]
}
atom-one-dark
$version: "2"

namespace com.example

/// A simple user shape
@readonly
structure User {
    @required
    id: String

    name: String
}

service UserService {
    version: "2024-01-01"
    resources: [com.example#User]
}
github-dark
$version: "2"

namespace com.example

/// A simple user shape
@readonly
structure User {
    @required
    id: String

    name: String
}

service UserService {
    version: "2024-01-01"
    resources: [com.example#User]
}
dracula
$version: "2"

namespace com.example

/// A simple user shape
@readonly
structure User {
    @required
    id: String

    name: String
}

service UserService {
    version: "2024-01-01"
    resources: [com.example#User]
}
nord
$version: "2"

namespace com.example

/// A simple user shape
@readonly
structure User {
    @required
    id: String

    name: String
}

service UserService {
    version: "2024-01-01"
    resources: [com.example#User]
}
github
$version: "2"

namespace com.example

/// A simple user shape
@readonly
structure User {
    @required
    id: String

    name: String
}

service UserService {
    version: "2024-01-01"
    resources: [com.example#User]
}

2. HTTP traits

the http and error traits on an operation
horizon-dark
@http(method: "GET", uri: "/users/{id}")
operation GetUser {
    input: GetUserInput
    output: GetUserOutput
    errors: [NotFound]
}

@error("client")
structure NotFound {
    message: String
}
atom-one-dark
@http(method: "GET", uri: "/users/{id}")
operation GetUser {
    input: GetUserInput
    output: GetUserOutput
    errors: [NotFound]
}

@error("client")
structure NotFound {
    message: String
}
github-dark
@http(method: "GET", uri: "/users/{id}")
operation GetUser {
    input: GetUserInput
    output: GetUserOutput
    errors: [NotFound]
}

@error("client")
structure NotFound {
    message: String
}
dracula
@http(method: "GET", uri: "/users/{id}")
operation GetUser {
    input: GetUserInput
    output: GetUserOutput
    errors: [NotFound]
}

@error("client")
structure NotFound {
    message: String
}
nord
@http(method: "GET", uri: "/users/{id}")
operation GetUser {
    input: GetUserInput
    output: GetUserOutput
    errors: [NotFound]
}

@error("client")
structure NotFound {
    message: String
}
github
@http(method: "GET", uri: "/users/{id}")
operation GetUser {
    input: GetUserInput
    output: GetUserOutput
    errors: [NotFound]
}

@error("client")
structure NotFound {
    message: String
}

3. Enums and unions

an enum shape and a tagged union
horizon-dark
enum Status {
    ACTIVE
    INACTIVE
}

union SearchResult {
    user: User
    error: NotFound
}
atom-one-dark
enum Status {
    ACTIVE
    INACTIVE
}

union SearchResult {
    user: User
    error: NotFound
}
github-dark
enum Status {
    ACTIVE
    INACTIVE
}

union SearchResult {
    user: User
    error: NotFound
}
dracula
enum Status {
    ACTIVE
    INACTIVE
}

union SearchResult {
    user: User
    error: NotFound
}
nord
enum Status {
    ACTIVE
    INACTIVE
}

union SearchResult {
    user: User
    error: NotFound
}
github
enum Status {
    ACTIVE
    INACTIVE
}

union SearchResult {
    user: User
    error: NotFound
}