Documentation
¶
Index ¶
- func New(api string) (*generator, error)
- func Run(api, outputDir string) error
- type Contact
- type Definitions
- type Example
- type ExternalDocumentation
- type Header
- type Headers
- type Info
- type Items
- type License
- type ModelAsString
- type NameParameter
- type NameParameters
- type NameSchema
- type NameSchemas
- type Operation
- type Pageable
- type Parameter
- type ParametersDefinitions
- type PathItem
- type Paths
- type Reference
- type Response
- type Responses
- type ResponsesDefinitions
- type Schema
- type Scopes
- type SecurityDefinitions
- type SecurityRequirement
- type SecurityScheme
- type Swagger
- type Tag
- type XML
- type XMSEnum
- type XMSEnumValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Contact ¶
type Contact struct {
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
Email string `json:"email,omitempty"`
}
Contact represents a Contact object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#contact-object
type Definitions ¶
Definitions represents a Definitions object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#definitions-object
type Example ¶
type Example map[string]interface{}
Example represents an Example object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#example-object
type ExternalDocumentation ¶
type ExternalDocumentation struct {
Description string `json:"description,omitempty"`
URL string `json:"url,omitempty"`
}
ExternalDocumentation represents an External Documentation object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#external-documentation-object
type Header ¶
type Header struct {
Description string `json:"description,omitempty"`
Type string `json:"type,omitempty"`
Format string `json:"format,omitempty"`
Items *Items `json:"items,omitempty"`
CollectionFormat string `json:"collectionFormat,omitempty"`
Default interface{} `json:"default,omitempty"`
Maximum int `json:"maximum,omitempty"`
ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"`
Minimum int `json:"minimum,omitempty"`
ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"`
MaxLength int `json:"maxLength,omitempty"`
MinLength int `json:"minLength,omitempty"`
Pattern string `json:"pattern,omitempty"`
MaxItems int `json:"maxItems,omitempty"`
MinItems int `json:"minItems,omitempty"`
UniqueItems bool `json:"uniqueItems,omitempty"`
Enum []interface{} `json:"enum,omitempty"`
MultipleOf int `json:"multipleOf,omitempty"`
}
Header represents a Header object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#header-object
type Headers ¶
Headers represents a Headers object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#headers-object
type Info ¶
type Info struct {
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
TermsOfService string `json:"termsOfService,omitempty"`
Contact *Contact `json:"contact,omitempty"`
License *License `json:"license,omitempty"`
Version string `json:"version,omitempty"`
}
Info represents an Info object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#info-object
type Items ¶
type Items struct {
Type string `json:"type,omitempty"`
Format string `json:"format,omitempty"`
Items *Items `json:"items,omitempty"`
CollectionFormat string `json:"collectionFormat,omitempty"`
Default interface{} `json:"default,omitempty"`
Maximum int `json:"maximum,omitempty"`
ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"`
Minimum int `json:"minimum,omitempty"`
ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"`
MaxLength int `json:"maxLength,omitempty"`
MinLength int `json:"minLength,omitempty"`
Pattern string `json:"pattern,omitempty"`
MaxItems int `json:"maxItems,omitempty"`
MinItems int `json:"minItems,omitempty"`
UniqueItems bool `json:"uniqueItems,omitempty"`
Enum []interface{} `json:"enum,omitempty"`
MultipleOf int `json:"multipleOf,omitempty"`
}
Items represents an Items object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#items-object
type License ¶
License represents a License object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#license-object
type ModelAsString ¶
type ModelAsString bool
type NameParameter ¶
type NameParameter struct {
Name string
Parameter interface{}
}
NameParameter represents a name and a Parameter
type NameParameters ¶
type NameParameters []NameParameter
NameParameters is a slice of NameParameters
func (NameParameters) MarshalJSON ¶
func (xs NameParameters) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler
func (*NameParameters) UnmarshalJSON ¶
func (xs *NameParameters) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler
type NameSchema ¶
NameSchema represents a name and a Schema
type NameSchemas ¶
type NameSchemas []NameSchema
NameSchemas is a slice of NameSchemas
func (NameSchemas) MarshalJSON ¶
func (xs NameSchemas) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler
func (*NameSchemas) UnmarshalJSON ¶
func (xs *NameSchemas) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler
type Operation ¶
type Operation struct {
Tags []string `json:"tags,omitempty"`
Summary string `json:"summary,omitempty"`
Description string `json:"description,omitempty"`
ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
OperationID string `json:"operationId,omitempty"`
Consumes []string `json:"consumes,omitempty"`
Produces []string `json:"produces,omitempty"`
Parameters []interface{} `json:"parameters,omitempty"`
Responses Responses `json:"responses,omitempty"`
Schemes []string `json:"schemes,omitempty"`
Deprecated bool `json:"deprecated,omitempty"`
LongRunningOperation bool `json:"x-ms-long-running-operation,omitempty"`
Examples map[string]Reference `json:"x-ms-examples,omitempty"`
Pageable *Pageable `json:"x-ms-pageable,omitempty"`
}
Operation represents an Operation object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#operation-object
type Pageable ¶
type Pageable struct {
NextLinkName string `json:"nextLinkName,omitempty"`
}
Pageable represents a Pageable object
type Parameter ¶
type Parameter struct {
Name string `json:"name,omitempty"`
In string `json:"in,omitempty"`
Description string `json:"description,omitempty"`
Required bool `json:"required,omitempty"`
Schema *Schema `json:"schema,omitempty"`
Type string `json:"type,omitempty"`
Format string `json:"format,omitempty"`
AllowEmptyValue bool `json:"allowEmptyValue,omitempty"`
Items *Items `json:"items,omitempty"`
CollectionFormat string `json:"collectionFormat,omitempty"`
Default interface{} `json:"default,omitempty"`
Maximum int `json:"maximum,omitempty"`
ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"`
Minimum int `json:"minimum,omitempty"`
ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"`
MaxLength int `json:"maxLength,omitempty"`
MinLength int `json:"minLength,omitempty"`
Pattern string `json:"pattern,omitempty"`
MaxItems int `json:"maxItems,omitempty"`
MinItems int `json:"minItems,omitempty"`
UniqueItems bool `json:"uniqueItems,omitempty"`
Enum []interface{} `json:"enum,omitempty"`
MultipleOf int `json:"multipleOf,omitempty"`
XMSParameterLocation string `json:"x-ms-parameter-location,omitempty"`
}
Parameter represents a Parameter object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameter-object
type ParametersDefinitions ¶
ParametersDefinitions represents a Parameters Definitions object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameters-definitions-object
type PathItem ¶
type PathItem struct {
Ref string `json:"$ref,omitempty"`
Get *Operation `json:"get,omitempty"`
Put *Operation `json:"put,omitempty"`
Post *Operation `json:"post,omitempty"`
Delete *Operation `json:"delete,omitempty"`
Options *Operation `json:"options,omitempty"`
Head *Operation `json:"head,omitempty"`
Patch *Operation `json:"patch,omitempty"`
Parameters []interface{} `json:"parameters,omitempty"`
}
PathItem represents a Path Item object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#path-item-object
type Paths ¶
Paths represents a Paths object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#paths-object
type Reference ¶
type Reference struct {
Ref string `json:"$ref,omitempty"`
}
Reference represents a Reference object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#reference-object
type Response ¶
type Response struct {
Description string `json:"description,omitempty"`
Schema *Schema `json:"schema,omitempty"`
Headers Headers `json:"headers,omitempty"`
Examples Example `json:"examples,omitempty"`
}
Response represents a Response object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#response-object
type Responses ¶
type Responses map[string]interface{}
Responses represents a Responses object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#responses-object
type ResponsesDefinitions ¶
ResponsesDefinitions represents a Responses Definitions object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#responses-definitions-object
type Schema ¶
type Schema struct {
Ref string `json:"$ref,omitempty"`
Format string `json:"format,omitempty"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Default interface{} `json:"default,omitempty"`
MultipleOf int `json:"multipleOf,omitempty"`
Maximum int `json:"maximum,omitempty"`
ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"`
Minimum int `json:"minimum,omitempty"`
ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"`
MaxLength int `json:"maxLength,omitempty"`
MinLength int `json:"minLength,omitempty"`
Pattern string `json:"pattern,omitempty"`
MaxItems int `json:"maxItems,omitempty"`
MinItems int `json:"minItems,omitempty"`
UniqueItems bool `json:"uniqueItems,omitempty"`
MaxProperties int `json:"maxProperties,omitempty"`
MinProperties int `json:"minProperties,omitempty"`
Required bool `json:"required,omitempty"`
Enum []interface{} `json:"enum,omitempty"`
Type string `json:"type,omitempty"`
Items *Schema `json:"items,omitempty"`
AllOf []Schema `json:"allOf,omitempty"`
Properties NameSchemas `json:"properties,omitempty"`
AdditionalProperties *Schema `json:"additionalProperties,omitempty"`
Discriminator string `json:"discriminator,omitempty"`
ReadOnly bool `json:"readOnly,omitempty"`
XML *XML `json:"xml,omitempty"`
ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
Example interface{} `json:"example,omitempty"`
ClientFlatten bool `json:"x-ms-client-flatten,omitempty"`
XMSEnum *XMSEnum `json:"x-ms-enum,omitempty"`
XMSSecret bool `json:"x-ms-secret,omitempty"`
XMSIdentifiers *[]string `json:"x-ms-identifiers,omitempty"`
}
Schema represents a Schema object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schema-object
type Scopes ¶
Scopes represents a Scopes object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#scopes-object
type SecurityDefinitions ¶
type SecurityDefinitions map[string]*SecurityScheme
SecurityDefinitions represents a Security Definitions object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#security-definitions-object
type SecurityRequirement ¶
SecurityRequirement represents a Security Requirement object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#security-requirement-object
type SecurityScheme ¶
type SecurityScheme struct {
Type string `json:"type,omitempty"`
Description string `json:"description,omitempty"`
Name string `json:"name,omitempty"`
In string `json:"in,omitempty"`
Flow string `json:"flow,omitempty"`
AuthorizationURL string `json:"authorizationUrl,omitempty"`
TokenURL string `json:"tokenUrl,omitempty"`
Scopes Scopes `json:"scopes,omitempty"`
}
SecurityScheme represents a Security Scheme object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#security-scheme-object
type Swagger ¶
type Swagger struct {
Swagger string `json:"swagger,omitempty"`
Info *Info `json:"info,omitempty"`
Host string `json:"host,omitempty"`
BasePath string `json:"basePath,omitempty"`
Schemes []string `json:"schemes,omitempty"`
Consumes []string `json:"consumes,omitempty"`
Produces []string `json:"produces,omitempty"`
Paths Paths `json:"paths,omitempty"`
Definitions Definitions `json:"definitions,omitempty"`
Parameters ParametersDefinitions `json:"parameters,omitempty"`
Responses ResponsesDefinitions `json:"responses,omitempty"`
SecurityDefinitions SecurityDefinitions `json:"securityDefinitions,omitempty"`
Security []SecurityRequirement `json:"security,omitempty"`
Tags []*Tag `json:"tags,omitempty"`
ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
}
Swagger represents a Swagger object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#swagger-object
type Tag ¶
type Tag struct {
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"`
}
Tag represents a Tag object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#tag-object
type XML ¶
type XML struct {
Description string `json:"description,omitempty"`
URL string `json:"url,omitempty"`
}
XML represents an XML object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#xml-object
type XMSEnum ¶
type XMSEnum struct {
Name string `json:"name"`
ModelAsString bool `json:"modelAsString"`
Values []XMSEnumValue `json:"values,omitempty"`
}
XMSEnum is x-ms-enum swagger extension adding the ability to generate static enums https://github.com/Azure/autorest/tree/master/docs/extensions#x-ms-enum
type XMSEnumValue ¶
type XMSEnumValue struct {
Value interface{} `json:"value"`
Description *string `json:"description,omitempty"`
Name *string `json:"name,omitempty"`
}
XMSEnumValue represents value for x-ms-enum https://github.com/Azure/autorest/tree/master/docs/extensions#x-ms-enum