smithy

package module
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

README

smithy

A Go-based tool to work with Smithy API Specifications.

This code is extracted from SADL, and extended to handle more Smithy use cases.

The tool reads multiple files, assembles them, and then outputs the resulting model. The input files can be any mix of Smithy IDL or Smithy AST files in JSON. The default output is the "unparsing" of the assembled model to IDL into a file per namespace. Alternate generators may be specified (see usage line), notably "ast", which just dumps the model as JSON.

This work is an independent implementation of the 1.0 Smithy Specification. For more information about Smithy, its specification, and its supported tooling, see https://awslabs.github.io/smithy/.

Documentation

Overview

Copyright 2021 Lee R. Boynton

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2021 Lee R. Boynton

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2021 Lee R. Boynton

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2021 Lee R. Boynton

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2021 Lee R. Boynton

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2021 Lee R. Boynton

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2021 Lee R. Boynton

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2021 Lee R. Boynton

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const BLACK = "\033[0;0m"
View Source
const BLUE = "\033[94m"
View Source
const GREEN = "\033[92m"
View Source
const IndentAmount = "    "
View Source
const RED = "\033[0;31m"
View Source
const UnspecifiedNamespace = "example"
View Source
const UnspecifiedVersion = "0.0"
View Source
const YELLOW = "\033[0;33m"

Variables

View Source
var AnnotateSources = false
View Source
var ToolVersion string = "development version"
View Source
var Verbose bool

Functions

func Capitalize

func Capitalize(s string) string

func Debug

func Debug(args ...interface{})

func FormatComment

func FormatComment(indent, prefix, comment string, maxcol int, extraPad bool) string

func FormattedAnnotation

func FormattedAnnotation(filename string, source string, prefix string, msg string, tok *Token, color string, contextSize int) string

func IsDigit

func IsDigit(ch rune) bool

func IsLetter

func IsLetter(ch rune) bool

func IsLowercaseLetter

func IsLowercaseLetter(ch rune) bool

func IsPreludeType

func IsPreludeType(name string) bool

func IsSymbolChar

func IsSymbolChar(ch rune, first bool) bool

func IsUppercaseLetter

func IsUppercaseLetter(ch rune) bool

func IsWhitespace

func IsWhitespace(ch rune) bool

func StripNamespace

func StripNamespace(target string) string

func TrimLeftSpace

func TrimLeftSpace(s string) string

func TrimRightSpace

func TrimRightSpace(s string) string

func TrimSpace

func TrimSpace(s string) string

func Uncapitalize

func Uncapitalize(s string) string

func WithCommentTrait

func WithCommentTrait(traits *data.Object, namespace string, val string) (*data.Object, string)

func WithTrait

func WithTrait(traits *data.Object, key string, val interface{}) *data.Object

Types

type AST

type AST struct {
	Smithy   string       `json:"smithy"`
	Metadata *data.Object `json:"metadata,omitempty"`
	Shapes   *Shapes      `json:"shapes,omitempty"`
}

func LoadAST

func LoadAST(path string) (*AST, error)

func Parse

func Parse(path string, opts ...ParserOption) (*AST, error)

func ParseString added in v0.5.3

func ParseString(s string, opts ...ParserOption) (*AST, error)

func (*AST) AssemblyVersion

func (ast *AST) AssemblyVersion() int

func (*AST) ExternalRefs

func (ast *AST) ExternalRefs(ns string) []string

func (*AST) Filter

func (ast *AST) Filter(tags []string)

func (*AST) GetShape

func (ast *AST) GetShape(id string) *Shape

func (*AST) IDL

func (ast *AST) IDL(ns string) string

Generate Smithy IDL to describe the Smithy model for a specified namespace

func (*AST) Merge

func (ast *AST) Merge(src *AST) error

func (*AST) NamespaceAndServiceVersion

func (ast *AST) NamespaceAndServiceVersion() (string, string, string)

ASTs don't have a preferred namespace, but IDL files do. When going back to IDL, getting the preferred namespace is desirable. The algorithm here is to prefer the first service's namespace, if present, or the first non-smithy, non-aws namespace encountered.

func (*AST) Namespaces

func (ast *AST) Namespaces() []string

func (*AST) PutShape

func (ast *AST) PutShape(id string, shape *Shape)

func (*AST) RequiresDocumentType

func (ast *AST) RequiresDocumentType() bool

func (*AST) ShapeNames

func (ast *AST) ShapeNames() []string

func (*AST) Validate

func (ast *AST) Validate() error

func (*AST) ValidateDefined

func (ast *AST) ValidateDefined(id string, alreadyChecked map[string]*Shape) error

ValidateDefined checks that all references are defined in this assembly

type ASTParser

type ASTParser struct {
	// contains filtered or unexported fields
}

func (*ASTParser) EndOfFileError

func (p *ASTParser) EndOfFileError() error

func (*ASTParser) EnsureNamespaced

func (p *ASTParser) EnsureNamespaced(name string) string

func (*ASTParser) Error

func (p *ASTParser) Error(msg string) error

func (*ASTParser) Expect

func (p *ASTParser) Expect(tokenType TokenType) error

func (*ASTParser) ExpectIdentifier

func (p *ASTParser) ExpectIdentifier() (string, error)

func (*ASTParser) ExpectIdentifierArray

func (p *ASTParser) ExpectIdentifierArray() ([]string, error)

func (*ASTParser) ExpectIdentifierMap

func (p *ASTParser) ExpectIdentifierMap() (map[string]string, error)

func (*ASTParser) ExpectInt

func (p *ASTParser) ExpectInt() (int, error)

func (*ASTParser) ExpectNumber

func (p *ASTParser) ExpectNumber() (*data.Decimal, error)

func (*ASTParser) ExpectString

func (p *ASTParser) ExpectString() (string, error)

func (*ASTParser) ExpectStringArray

func (p *ASTParser) ExpectStringArray() ([]string, error)

func (*ASTParser) ExpectText

func (p *ASTParser) ExpectText() (string, error)

func (*ASTParser) GetToken

func (p *ASTParser) GetToken() *Token

func (*ASTParser) MergeComment

func (p *ASTParser) MergeComment(comment1 string, comment2 string) string

func (*ASTParser) Parse

func (p *ASTParser) Parse() error

func (*ASTParser) ParseTraitArgs

func (p *ASTParser) ParseTraitArgs() (*data.Object, interface{}, error)

func (*ASTParser) SyntaxError

func (p *ASTParser) SyntaxError() error

func (*ASTParser) UngetToken

func (p *ASTParser) UngetToken()

func (*ASTParser) Warning

func (p *ASTParser) Warning(msg string)

type AstGenerator

type AstGenerator struct {
	BaseGenerator
}

func (*AstGenerator) Generate

func (gen *AstGenerator) Generate(ast *AST, config *data.Object) error

type BaseGenerator

type BaseGenerator struct {
	Config         *data.Object
	OutDir         string
	ForceOverwrite bool

	Err error
	// contains filtered or unexported fields
}

func (*BaseGenerator) Configure

func (gen *BaseGenerator) Configure(conf *data.Object) error

func (*BaseGenerator) Emit

func (gen *BaseGenerator) Emit(text string, filename string, separator string) error

func (*BaseGenerator) FileExists

func (gen *BaseGenerator) FileExists(path string) bool

func (*BaseGenerator) FileName

func (gen *BaseGenerator) FileName(ns string, suffix string) string

func (*BaseGenerator) WriteFile

func (gen *BaseGenerator) WriteFile(path string, content string) error

type Generator

type Generator interface {
	Generate(ast *AST, config *data.Object) error
}

type IdlGenerator

type IdlGenerator struct {
	BaseGenerator
}

func (*IdlGenerator) Generate

func (gen *IdlGenerator) Generate(ast *AST, config *data.Object) error

type IdlWriter

type IdlWriter struct {
	// contains filtered or unexported fields
}

func (*IdlWriter) Begin

func (w *IdlWriter) Begin()

func (*IdlWriter) Emit

func (w *IdlWriter) Emit(format string, args ...interface{})

func (*IdlWriter) EmitBlobShape

func (w *IdlWriter) EmitBlobShape(name string, shape *Shape)

func (*IdlWriter) EmitBooleanShape

func (w *IdlWriter) EmitBooleanShape(name string, shape *Shape)

func (*IdlWriter) EmitBooleanTrait

func (w *IdlWriter) EmitBooleanTrait(b bool, tname, indent string)

func (*IdlWriter) EmitCollectionShape

func (w *IdlWriter) EmitCollectionShape(shapeName, name string, shape *Shape)

func (*IdlWriter) EmitCustomTrait

func (w *IdlWriter) EmitCustomTrait(k string, v interface{}, indent string)

func (*IdlWriter) EmitDeprecatedTrait

func (w *IdlWriter) EmitDeprecatedTrait(v interface{}, indent string)

func (*IdlWriter) EmitDocumentation

func (w *IdlWriter) EmitDocumentation(doc, indent string)

func (*IdlWriter) EmitEnumShape

func (w *IdlWriter) EmitEnumShape(enumType string, name string, shape *Shape)

func (*IdlWriter) EmitExamplesTrait

func (w *IdlWriter) EmitExamplesTrait(opname string, raw interface{})

func (*IdlWriter) EmitHttpErrorTrait

func (w *IdlWriter) EmitHttpErrorTrait(rv interface{}, indent string)

func (*IdlWriter) EmitHttpTrait

func (w *IdlWriter) EmitHttpTrait(rv interface{}, indent string)

func (*IdlWriter) EmitLengthTrait

func (w *IdlWriter) EmitLengthTrait(v interface{}, indent string)

func (*IdlWriter) EmitMapShape

func (w *IdlWriter) EmitMapShape(name string, shape *Shape)

func (*IdlWriter) EmitNumericShape

func (w *IdlWriter) EmitNumericShape(shapeName, name string, shape *Shape)

func (*IdlWriter) EmitOperationShape

func (w *IdlWriter) EmitOperationShape(name string, shape *Shape, emitted map[string]bool)

func (*IdlWriter) EmitPaginatedTrait

func (w *IdlWriter) EmitPaginatedTrait(d interface{})

func (*IdlWriter) EmitRangeTrait

func (w *IdlWriter) EmitRangeTrait(v interface{}, indent string)

func (*IdlWriter) EmitResourceShape

func (w *IdlWriter) EmitResourceShape(name string, shape *Shape)

func (*IdlWriter) EmitServiceShape

func (w *IdlWriter) EmitServiceShape(name string, shape *Shape)

func (*IdlWriter) EmitShape

func (w *IdlWriter) EmitShape(name string, shape *Shape)

func (*IdlWriter) EmitSimpleShape

func (w *IdlWriter) EmitSimpleShape(shapeName, name string, shape *Shape)

func (*IdlWriter) EmitStringShape

func (w *IdlWriter) EmitStringShape(name string, shape *Shape)

func (*IdlWriter) EmitStringTrait

func (w *IdlWriter) EmitStringTrait(v, tname, indent string)

func (*IdlWriter) EmitStructureShape

func (w *IdlWriter) EmitStructureShape(name string, shape *Shape)

func (*IdlWriter) EmitTagsTrait

func (w *IdlWriter) EmitTagsTrait(v interface{}, indent string)

func (*IdlWriter) EmitTimestampShape

func (w *IdlWriter) EmitTimestampShape(name string, shape *Shape)

func (*IdlWriter) EmitTraitTrait

func (w *IdlWriter) EmitTraitTrait(v interface{})

func (*IdlWriter) EmitTraits

func (w *IdlWriter) EmitTraits(traits *data.Object, indent string)

func (*IdlWriter) EmitUnionShape

func (w *IdlWriter) EmitUnionShape(name string, shape *Shape)

func (*IdlWriter) End

func (w *IdlWriter) End() string

type Member

type Member struct {
	Target string       `json:"target"`
	Traits *data.Object `json:"traits,omitempty"`
}

type Members

type Members struct {
	// contains filtered or unexported fields
}

Members object is a map from string to *Member. It preserves the order of its keys, unlike a Go map

func NewMembers

func NewMembers() *Members

func (*Members) Get

func (m *Members) Get(key string) *Member

func (*Members) Keys

func (m *Members) Keys() []string

func (*Members) Length

func (m *Members) Length() int

func (Members) MarshalJSON

func (m Members) MarshalJSON() ([]byte, error)

func (*Members) Put

func (m *Members) Put(key string, val *Member)

func (*Members) UnmarshalJSON

func (m *Members) UnmarshalJSON(raw []byte) error

type Parser

type Parser interface {
	Expect(tokenType TokenType) error
	ExpectText() (string, error)
	ExpectString() (string, error)
	ExpectInt() (int, error)
	ParseTraitArgs() (*data.Object, interface{}, error)

	Error(msg string) error
	SyntaxError() error
	Warning(msg string)

	EnsureNamespaced(name string) string
}

type ParserOption

type ParserOption func(*ASTParser)

func WithTraitVisitors

func WithTraitVisitors(visitors ...TraitVisitor) ParserOption

type SadlGenerator

type SadlGenerator struct {
	BaseGenerator
}

func (*SadlGenerator) Generate

func (gen *SadlGenerator) Generate(ast *AST, config *data.Object) error

func (*SadlGenerator) ToSadl

func (gen *SadlGenerator) ToSadl(ns string, ast *AST) string

func (*SadlGenerator) Validate

func (gen *SadlGenerator) Validate(ns string, ast *AST) error

type SadlWriter

type SadlWriter struct {
	// contains filtered or unexported fields
}

func (*SadlWriter) Begin

func (w *SadlWriter) Begin()

func (*SadlWriter) Emit

func (w *SadlWriter) Emit(format string, args ...interface{})

func (*SadlWriter) EmitBlobShape

func (w *SadlWriter) EmitBlobShape(name string, shape *Shape)

func (*SadlWriter) EmitBooleanShape

func (w *SadlWriter) EmitBooleanShape(name string, shape *Shape)

func (*SadlWriter) EmitCollectionShape

func (w *SadlWriter) EmitCollectionShape(shapeName, name string, shape *Shape)

func (*SadlWriter) EmitEnumShape

func (w *SadlWriter) EmitEnumShape(name string, shape *Shape)

func (*SadlWriter) EmitExample

func (w *SadlWriter) EmitExample(shape *Shape, obj *data.Object)

func (*SadlWriter) EmitMapShape

func (w *SadlWriter) EmitMapShape(name string, shape *Shape)

func (*SadlWriter) EmitNumericShape

func (w *SadlWriter) EmitNumericShape(shapeName, name string, shape *Shape)

func (*SadlWriter) EmitOperationShape

func (w *SadlWriter) EmitOperationShape(name string, shape *Shape, opts []string)

func (*SadlWriter) EmitShape

func (w *SadlWriter) EmitShape(name string, shape *Shape)

func (*SadlWriter) EmitShapeComment

func (w *SadlWriter) EmitShapeComment(shape *Shape)

func (*SadlWriter) EmitStringShape

func (w *SadlWriter) EmitStringShape(name string, shape *Shape)

func (*SadlWriter) EmitStructureShape

func (w *SadlWriter) EmitStructureShape(name string, shape *Shape, opts []string)

func (*SadlWriter) EmitTimestampShape

func (w *SadlWriter) EmitTimestampShape(name string, shape *Shape)

func (*SadlWriter) EmitUnionShape

func (w *SadlWriter) EmitUnionShape(name string, shape *Shape)

func (*SadlWriter) End

func (w *SadlWriter) End() string

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

func NewScanner

func NewScanner(r io.Reader) *Scanner

func (*Scanner) Scan

func (s *Scanner) Scan() Token

type Shape

type Shape struct {
	Type   string       `json:"type"`
	Traits *data.Object `json:"traits,omitempty"` //service, resource, operation, apply

	//List and Set
	Member *Member `json:"member,omitempty"`

	//Map
	Key   *Member `json:"key,omitempty"`
	Value *Member `json:"value,omitempty"`

	//Structure and Union
	Members *Members    `json:"members,omitempty"` //keys must be case-insensitively unique. For union, len(Members) > 0,
	Mixins  []*ShapeRef `json:"mixins,omitempty"`  //mixins for the shape

	//Resource
	Identifiers map[string]*ShapeRef `json:"identifiers,omitempty"`
	//FIXME preserve resource identifier order?
	Create               *ShapeRef   `json:"create,omitempty"`
	Put                  *ShapeRef   `json:"put,omitempty"`
	Read                 *ShapeRef   `json:"read,omitempty"`
	Update               *ShapeRef   `json:"update,omitempty"`
	Delete               *ShapeRef   `json:"delete,omitempty"`
	List                 *ShapeRef   `json:"list,omitempty"`
	CollectionOperations []*ShapeRef `json:"collectionOperations,omitempty"`

	//Resource and Service
	Operations []*ShapeRef `json:"operations,omitempty"`
	Resources  []*ShapeRef `json:"resources,omitempty"`

	//Operation
	Input  *ShapeRef   `json:"input,omitempty"`
	Output *ShapeRef   `json:"output,omitempty"`
	Errors []*ShapeRef `json:"errors,omitempty"`

	//Service
	Version string `json:"version,omitempty"`
}

type ShapeRef

type ShapeRef struct {
	Target string `json:"target"`
}

type Shapes

type Shapes struct {
	// contains filtered or unexported fields
}

Shapes object is a map from Shape ID to *Shape. It preserves the order of its keys, unlike a Go map

func NewShapes

func NewShapes() *Shapes

func (*Shapes) Get

func (s *Shapes) Get(key string) *Shape

func (*Shapes) Keys

func (s *Shapes) Keys() []string

func (*Shapes) Length

func (s *Shapes) Length() int

func (Shapes) MarshalJSON

func (s Shapes) MarshalJSON() ([]byte, error)

func (*Shapes) Put

func (s *Shapes) Put(key string, val *Shape)

func (*Shapes) UnmarshalJSON

func (s *Shapes) UnmarshalJSON(raw []byte) error

type Token

type Token struct {
	Type  TokenType
	Text  string
	Line  int
	Start int
}

func (Token) IsNumeric

func (tok Token) IsNumeric() bool

func (Token) IsText

func (tok Token) IsText() bool

func (Token) String

func (tok Token) String() string

type TokenType

type TokenType int
const (
	UNDEFINED TokenType = iota
	EOF
	LINE_COMMENT
	BLOCK_COMMENT
	SYMBOL
	NUMBER
	STRING
	COLON
	SEMICOLON
	COMMA
	AT
	DOT
	EQUALS
	DOLLAR
	QUOTE
	SLASH
	QUESTION
	OPEN_BRACE
	CLOSE_BRACE
	OPEN_BRACKET
	CLOSE_BRACKET
	OPEN_PAREN
	CLOSE_PAREN
	OPEN_ANGLE
	CLOSE_ANGLE
	NEWLINE
	HASH
	AMPERSAND
	STAR
	BACKQUOTE
	TILDE
	BANG
)

func (TokenType) String

func (tokenType TokenType) String() string

type Trait

type Trait struct {
	// contains filtered or unexported fields
}

func NewTrait

func NewTrait(namespace string, accepts ...string) Trait

func (Trait) Accepts

func (t Trait) Accepts() []string

func (Trait) Parse

func (t Trait) Parse(p Parser, name string, traits *data.Object) (*data.Object, error)

type TraitDeprecated

type TraitDeprecated struct {
	// contains filtered or unexported fields
}

func DeprecatedTrait

func DeprecatedTrait(other TraitVisitor) TraitDeprecated

func (TraitDeprecated) Accepts

func (t TraitDeprecated) Accepts() []string

func (TraitDeprecated) Parse

func (t TraitDeprecated) Parse(p Parser, name string, traits *data.Object) (*data.Object, error)

type TraitGeneric

type TraitGeneric struct{}

func NewTraitGeneric

func NewTraitGeneric() TraitGeneric

func (TraitGeneric) Accepts

func (t TraitGeneric) Accepts() []string

func (TraitGeneric) Parse

func (t TraitGeneric) Parse(p Parser, name string, traits *data.Object) (*data.Object, error)

type TraitInt

type TraitInt struct {
	Trait
}

func NewTraitInt

func NewTraitInt(namespace string, accepts ...string) TraitInt

func (TraitInt) Parse

func (t TraitInt) Parse(p Parser, name string, traits *data.Object) (*data.Object, error)

type TraitMarker

type TraitMarker struct {
	Trait
}

func NewTraitMarker

func NewTraitMarker(namespace string, accepts ...string) TraitMarker

func (TraitMarker) Parse

func (t TraitMarker) Parse(_ Parser, name string, traits *data.Object) (*data.Object, error)

type TraitString

type TraitString struct {
	Trait
	// contains filtered or unexported fields
}

func NewTraitString

func NewTraitString(namespace string, comments bool, accepts ...string) TraitString

func (TraitString) Parse

func (t TraitString) Parse(p Parser, name string, traits *data.Object) (*data.Object, error)

type TraitTag

type TraitTag struct {
	Trait
}

func NewTraitTag

func NewTraitTag() TraitTag

func (TraitTag) Parse

func (t TraitTag) Parse(p Parser, name string, traits *data.Object) (*data.Object, error)

type TraitVisitor

type TraitVisitor interface {
	Accepts() []string
	Parse(p Parser, name string, traits *data.Object) (*data.Object, error)
}

func DefaultTraitVisitors

func DefaultTraitVisitors() []TraitVisitor

type TraitWithArgs

type TraitWithArgs struct {
	Trait
}

func NewTraitWithArgs

func NewTraitWithArgs(namespace string, accepts ...string) TraitWithArgs

func (TraitWithArgs) Parse

func (t TraitWithArgs) Parse(p Parser, name string, traits *data.Object) (*data.Object, error)

type TraitWithLiteral

type TraitWithLiteral struct {
	Trait
}

func NewTraitWithLiteral

func NewTraitWithLiteral(namespace string, accepts ...string) TraitWithLiteral

func (TraitWithLiteral) Parse

func (t TraitWithLiteral) Parse(p Parser, name string, traits *data.Object) (*data.Object, error)

Directories

Path Synopsis
cmd
smithy command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL