Documentation ¶
Index ¶
- Constants
- func AddOperationToPathItem(item *oapi_spec.PathItem, method string, operation *oapi_spec.Operation)
- func CloneOperation(op *spec.Operation) (*spec.Operation, error)
- func ConvertHeadersToMap(headers [][2]string) map[string]string
- func CopyPathItemWithNewOperation(item *oapi_spec.PathItem, method string, operation *oapi_spec.Operation) *oapi_spec.PathItem
- func GetContentTypeWithoutParameter(contentTypeHeaderField string) string
- func GetOperationFromPathItem(item *oapi_spec.PathItem, method string) *oapi_spec.Operation
- func GetPathAndQuery(fullPath string) (path, query string)
- func MergePathItems(dst, src *oapi_spec.PathItem) *oapi_spec.PathItem
- type APIDiff
- type ApprovedSpec
- type ApprovedSpecReview
- type ApprovedSpecReviewPathItem
- type DiffParams
- type DiffSource
- type DiffType
- type HTTPInteractionData
- type LearningParametrizedPaths
- type LearningSpec
- type OperationGenerator
- type OperationGeneratorConfig
- type PathParam
- type ProvidedSpec
- type ReviewPathItem
- type SCNTCommon
- type SCNTRequest
- type SCNTResponse
- type SCNTelemetry
- type Spec
- func (s *Spec) ApplyApprovedReview(approvedReviews *ApprovedSpecReview) error
- func (s *Spec) CreateSuggestedReview() *SuggestedSpecReview
- func (s *Spec) DiffTelemetry(telemetry *SCNTelemetry, diffSource DiffSource) (*APIDiff, error)
- func (s *Spec) GenerateOASJson() ([]byte, error)
- func (s *Spec) GenerateOASYaml() ([]byte, error)
- func (s *Spec) HasApprovedSpec() bool
- func (s *Spec) HasProvidedSpec() bool
- func (s *Spec) LearnTelemetry(telemetry *SCNTelemetry) error
- func (s *Spec) LoadProvidedSpec(providedSpec []byte, pathToPathID map[string]string) error
- func (s *Spec) SpecInfoClone() (*Spec, error)
- type SpecInfo
- type SuggestedSpecReview
- type SuggestedSpecReviewPathItem
- type TestOperation
- type TestPathItem
- type TestSpec
Constants ¶
View Source
const ( BasicAuthSecurityDefinitionKey = "BasicAuth" APIKeyAuthSecurityDefinitionKey = "ApiKeyAuth" OAuth2SecurityDefinitionKey = "OAuth2" BearerAuthPrefix = "Bearer " BasicAuthPrefix = "Basic " AccessTokenParamKey = "access_token" )
Variables ¶
This section is empty.
Functions ¶
func AddOperationToPathItem ¶
func ConvertHeadersToMap ¶
func GetPathAndQuery ¶
example: for "/example-path?param=value" returns "/example-path", "param=value"
Types ¶
type ApprovedSpec ¶
type ApprovedSpec struct { PathItems map[string]*oapi_spec.PathItem SecurityDefinitions oapi_spec.SecurityDefinitions }
func (*ApprovedSpec) Clone ¶
func (a *ApprovedSpec) Clone() (*ApprovedSpec, error)
func (*ApprovedSpec) GetPathItem ¶
func (a *ApprovedSpec) GetPathItem(path string) *oapi_spec.PathItem
type ApprovedSpecReview ¶
type ApprovedSpecReview struct { PathItemsReview []*ApprovedSpecReviewPathItem PathToPathItem map[string]*oapi_spec.PathItem }
type ApprovedSpecReviewPathItem ¶
type ApprovedSpecReviewPathItem struct { ReviewPathItem PathUUID string }
type DiffParams ¶
type DiffParams struct {
// contains filtered or unexported fields
}
type DiffSource ¶
type DiffSource string
const ( DiffSourceReconstructed DiffSource = "RECONSTRUCTED" DiffSourceProvided DiffSource = "PROVIDED" )
type HTTPInteractionData ¶
type LearningSpec ¶
type LearningSpec struct { // map parameterized path into path item PathItems map[string]*oapi_spec.PathItem SecurityDefinitions oapi_spec.SecurityDefinitions }
func (*LearningSpec) AddPathItem ¶
func (l *LearningSpec) AddPathItem(path string, pathItem *oapi_spec.PathItem)
func (*LearningSpec) GetPathItem ¶
func (l *LearningSpec) GetPathItem(path string) *oapi_spec.PathItem
type OperationGenerator ¶ added in v0.0.3
type OperationGenerator struct { ResponseHeadersToIgnore map[string]struct{} RequestHeadersToIgnore map[string]struct{} }
func CreateTestNewOperationGenerator ¶ added in v0.0.3
func CreateTestNewOperationGenerator() *OperationGenerator
func NewOperationGenerator ¶ added in v0.0.3
func NewOperationGenerator(config OperationGeneratorConfig) *OperationGenerator
func (*OperationGenerator) GenerateSpecOperation ¶ added in v0.0.3
func (o *OperationGenerator) GenerateSpecOperation(data *HTTPInteractionData, securityDefinitions spec.SecurityDefinitions) (*spec.Operation, error)
Note: securityDefinitions might be updated.
type OperationGeneratorConfig ¶ added in v0.0.3
type ProvidedSpec ¶
func (*ProvidedSpec) GetPathItem ¶ added in v0.0.4
func (p *ProvidedSpec) GetPathItem(path string) *oapispec.PathItem
type ReviewPathItem ¶
type SCNTCommon ¶
type SCNTRequest ¶
type SCNTRequest struct { Method string `json:"method"` Path string `json:"path"` Host string `json:"host"` SCNTCommon }
type SCNTResponse ¶
type SCNTResponse struct { StatusCode string `json:"status_code"` SCNTCommon }
type SCNTelemetry ¶
type SCNTelemetry struct { RequestID string `json:"request_id"` Scheme string `json:"scheme"` DestinationAddress string `json:"destination_address"` SourceAddress string `json:"source_address"` SCNTRequest SCNTRequest `json:"scnt_request"` SCNTResponse SCNTResponse `json:"scnt_response"` }
type Spec ¶
type Spec struct { SpecInfo OpGenerator *OperationGenerator // contains filtered or unexported fields }
func CreateDefaultSpec ¶
func CreateDefaultSpec(host string, port string, config OperationGeneratorConfig) *Spec
func (*Spec) ApplyApprovedReview ¶
func (s *Spec) ApplyApprovedReview(approvedReviews *ApprovedSpecReview) error
func (*Spec) CreateSuggestedReview ¶
func (s *Spec) CreateSuggestedReview() *SuggestedSpecReview
this function should group all paths that have suspect parameter (with a certain template), into one path which is parameterized, and then add this path params to the spec.
func (*Spec) DiffTelemetry ¶
func (s *Spec) DiffTelemetry(telemetry *SCNTelemetry, diffSource DiffSource) (*APIDiff, error)
func (*Spec) GenerateOASJson ¶
func (*Spec) GenerateOASYaml ¶
func (*Spec) HasApprovedSpec ¶
func (*Spec) HasProvidedSpec ¶
func (*Spec) LearnTelemetry ¶
func (s *Spec) LearnTelemetry(telemetry *SCNTelemetry) error
func (*Spec) LoadProvidedSpec ¶
func (*Spec) SpecInfoClone ¶ added in v0.0.3
type SpecInfo ¶ added in v0.0.3
type SpecInfo struct { // Host of the spec Host string Port string // Spec ID ID uuid.UUID // Provided Spec ProvidedSpec *ProvidedSpec // Merged & approved state (can be generated into spec YAML) ApprovedSpec *ApprovedSpec // Upon learning, this will be updated (not the ApprovedSpec field) LearningSpec *LearningSpec ApprovedPathTrie pathtrie.PathTrie ProvidedPathTrie pathtrie.PathTrie }
type SuggestedSpecReview ¶
type SuggestedSpecReview struct { PathItemsReview []*SuggestedSpecReviewPathItem PathToPathItem map[string]*oapi_spec.PathItem }
type SuggestedSpecReviewPathItem ¶
type SuggestedSpecReviewPathItem struct {
ReviewPathItem
}
type TestOperation ¶
func NewOperation ¶
func NewOperation(t *testing.T, data *HTTPInteractionData) *TestOperation
func (*TestOperation) Deprecated ¶ added in v0.0.4
func (op *TestOperation) Deprecated() *TestOperation
type TestPathItem ¶
func NewTestPathItem ¶
func NewTestPathItem() *TestPathItem
func (*TestPathItem) WithOperation ¶
func (t *TestPathItem) WithOperation(method string, op *oapi_spec.Operation) *TestPathItem
func (*TestPathItem) WithPathParams ¶
func (t *TestPathItem) WithPathParams(name, tpe, format string) *TestPathItem
Source Files ¶
Click to show internal directories.
Click to hide internal directories.