package
0.3.0
Repository: https://github.com/discord-gophers/goapi-gen.git
Documentation: pkg.go.dev

# Functions

DescribeParameters generates descriptors based on params and path.
DescribeSecurityDefinition returns all security definitions in srs.
EscapePathElements escapes non path parameters in path and url encodes them.
FilterParameterDefinitionByType returns params which match the the type with in.
Generate uses the Go templating engine to generate all of our server wrappers from the descriptions we've built up above from the schema objects.
GenerateAdditionalPropertyBoilerplate creates any glue code for interfacing with additional properties and JSON marshaling.
GenerateBodyDefinitions returns the Swagger body definitions into a list of our body definitions which will be used for code generation.
GenerateChiServer generates codee for the chi server for ops.
GenerateConstants creates operation ids, context keys, paths, etc.
GenerateEnums makes definitions for any enums defined in types.
GenerateEnumTypes makes types for any enums in types.
GenerateGoSchema generates the schema for sref.
GenerateImports creates import statements and the package definition.
GenerateInlinedSpec generates a gzipped, base64 encoded JSON representation of the swagger definition, which is embedded inside the generated code.
GenerateParamsTypes defines the schema for a parameters definition object which encapsulates all the query, header and cookie parameters for an operation.
GenerateTemplates generates templates.
GenerateTypeDefinitions produces the type definitions in ops and executes the template.
GenerateTypeDefsForOperation returns the type definitions for op.
GenerateTypes is a helper function to execute the templates for type defs.
GenerateTypesForOperations prooduces code all types used by ops.
GenerateTypesForParameters creates type definitions for any custom types defined in the components/parameters section of the Swagger spec.
GenerateTypesForRequestBodies creates definitions for any custom types defined in the components/requestBodies section of the Swagger spec.
GenerateTypesForResponses makes definitions for any custom types defined in the components/responses section of the Swagger spec.
GenerateTypesForSchemas creates type definitions for any custom types defined in the components/schemas section of the Swagger spec.
GenFieldsFromProperties produces corresponding field names with JSON annotations.
GenStructFromAllOf function generates an object that is the union of the objects in the input array.
GenStructFromSchema creates a struct definition from the given Schema.
IsGoIdentity checks if str is a valid go identifier.
IsGoKeyword checks if str is a reserved keyword.
IsGoTypeReference checks if ref links to a valid go type.
IsPredeclaredGoIdentifier returns whether str is a go indentifier.
IsValidGoIdentity checks if str can be used as a name of variable, constant, or type.
IsWholeDocumentReference checks if ref is a whole document reference.
LowercaseFirstCharacter lowercases te first character of str.
MergeSchemas merges all the fields in the schemas supplied together.
OperationDefinitions returns all operations for a swagger definition.
OrderedParamsFromURI returns argument names in uri.
PathToTypeName converts path to a go type name.
PropertiesEqual returns if a and b can be considered to be the same.
RefPathToGoType converts refPath to a Go type name.
ReplacePathParamsWithStr replaces uri parameters with %s.
SanitizeCode runs sanitizers across the generated Go code to ensure the generated code will be able to compile.
SanitizeEnumNames removes illegal and duplicates chars in enum names.
SanitizeGoIdentity replaces illegal characters in str.
SchemaHasAdditionalProperties checks if schema has additional properties.
SchemaNameToTypeName converts name to a valid Go type name.
SortedContentKeys returns the keys of dict alphabetically.
SortedOperationsKeys returns the keys of dict alphabetically.
SortedParameterKeys returns the keys of dict alphabetically.
SortedPathsKeys returns the keys of dict alphabetically.
SortedRequestBodyKeys returns the keys of dict alphabetically.
SortedResponsesKeys returns the keys of dict alphabetically.
SortedSchemaKeys returns the keys of dict in alphabetically.
SortedSecurityRequirementKeys eturns the keys of dict alphabetically.
SortedStringKeys returns the keys of dict alphabetically.
SortParamsByPath sorts in to match those in the path URI.
StringInArray returns if strs contains str.
StringToGoComment renders a possible multi-line string to a valid Go-Comment.
SwaggerURIToChiURI converts uri to a Chi-style URI.
TitleWord converts a single worded string to title case.
ToCamelCase converts a string to camel case with proper Go initialisms.
ToSnakeCase converts a string to snake case.
UppercaseFirstCharacter uppercases the first character of str.

# Variables

TemplateFunctions generates the list of utlity and helpfer functions used by the templates.

# Structs

Constants holds the list of definitions that will be defined as constants.
EnumDefinition holds type information for enum.
FieldDescriptor describes a field.
OperationDefinition represents an Operation.
Options defines the optional code to generate.
ParameterDefinition is a definition for a parameter.
Property represents an OpenAPI property.
RefWrapper represents a ref wrapped with more information.
RequestBodyDefinition describes a request body.
ResponseTypeDefinition is an extension of TypeDefinition, specifically for response unmarshaling.
Schema represents an OpenAPI type definition.
SchemaDescriptor describes a Schema, a type definition.
SecurityDefinition represents an OpenAPI security definition.
TypeDefinition describes a Go type definition in generated code.

# Type aliases

ParameterDefinitions is a slice of ParameterDefinition.