_id
stringlengths
2
7
title
stringlengths
1
118
partition
stringclasses
3 values
text
stringlengths
52
85.5k
language
stringclasses
1 value
meta_information
dict
q18700
Render
train
func (renderer *Renderer) Render(response *plugins.Response, files []string) (err error) { for _, filename := range files { file := &plugins.File{Name: filename} switch filename { case "client.go": file.Data, err = renderer.RenderClient() case "types.go": file.Data, err = renderer.RenderTypes() case "p...
go
{ "resource": "" }
q18701
build
train
func (b *OpenAPI2Builder) build(document *openapiv2.Document) (err error) { // Collect service type descriptions from Definitions section. if document.Definitions != nil { for _, pair := range document.Definitions.AdditionalProperties { t, err := b.buildTypeFromDefinition(pair.Name, pair.Value) if err != nil ...
go
{ "resource": "" }
q18702
generateMainFile
train
func generateMainFile(packageName string, license string, codeBody string, imports []string) string { code := &printer.Code{} code.Print(license) code.Print("// THIS FILE IS AUTOMATICALLY GENERATED.\n") // generate package declaration code.Print("package %s\n", packageName) code.Print("import (") for _, filena...
go
{ "resource": "" }
q18703
NewDocumentStatistics
train
func NewDocumentStatistics(source string, document *openapi.Document) *DocumentStatistics { s := &DocumentStatistics{} s.Operations = make(map[string]int, 0) s.ParameterTypes = make(map[string]int, 0) s.ResultTypes = make(map[string]int, 0) s.DefinitionFieldTypes = make(map[string]int, 0) s.DefinitionArrayTypes =...
go
{ "resource": "" }
q18704
analyzeDefinition
train
func (s *DocumentStatistics) analyzeDefinition(path string, definition *openapi.Schema) { s.DefinitionCount++ typeName := typeNameForSchema(definition) switch typeName { case "object": if definition.Properties != nil { for _, pair := range definition.Properties.AdditionalProperties { propertySchema := pair...
go
{ "resource": "" }
q18705
analyzeDocument
train
func (s *DocumentStatistics) analyzeDocument(source string, document *openapi.Document) { s.Name = source s.Title = document.Info.Title for _, pair := range document.Paths.Path { path := pair.Value if path.Get != nil { s.analyzeOperation("get", "paths"+pair.Name+"/get", path.Get) } if path.Post != nil { ...
go
{ "resource": "" }
q18706
typeForSchema
train
func typeForSchema(schema *openapi.Schema) string { if schema.XRef != "" { return "reference" } if len(schema.Enum) > 0 { enumType := typeNameForSchema(schema) return "enum-of-" + enumType } typeName := typeNameForSchema(schema) if typeName == "array" { if schema.Items != nil { // items contains an arr...
go
{ "resource": "" }
q18707
Description
train
func (s *StringOrStringArray) Description() string { if s.String != nil { return *s.String } if s.StringArray != nil { return strings.Join(*s.StringArray, ", ") } return "" }
go
{ "resource": "" }
q18708
Prepare
train
func (language *GoLanguageModel) Prepare(model *surface.Model) { for _, t := range model.Types { // determine the type used for Go language implementation of the type t.TypeName = strings.Title(filteredTypeName(t.Name)) for _, f := range t.Fields { f.FieldName = goFieldName(f.Name) f.ParameterName = goPa...
go
{ "resource": "" }
q18709
camelCaseToSnakeCase
train
func camelCaseToSnakeCase(input string) string { out := "" for index, runeValue := range input { //fmt.Printf("%#U starts at byte position %d\n", runeValue, index) if runeValue >= 'A' && runeValue <= 'Z' { if index > 0 { out += "_" } out += string(runeValue - 'A' + 'a') } else { out += string(ru...
go
{ "resource": "" }
q18710
FetchFile
train
func FetchFile(fileurl string) ([]byte, error) { var bytes []byte initializeFileCache() if fileCacheEnable { bytes, ok := fileCache[fileurl] if ok { if verboseReader { log.Printf("Cache hit %s", fileurl) } return bytes, nil } if verboseReader { log.Printf("Fetching %s", fileurl) } } respo...
go
{ "resource": "" }
q18711
ReadBytesForFile
train
func ReadBytesForFile(filename string) ([]byte, error) { // is the filename a url? fileurl, _ := url.Parse(filename) if fileurl.Scheme != "" { // yes, fetch it bytes, err := FetchFile(filename) if err != nil { return nil, err } return bytes, nil } // no, it's a local filename bytes, err := ioutil.Rea...
go
{ "resource": "" }
q18712
ReadInfoFromBytes
train
func ReadInfoFromBytes(filename string, bytes []byte) (interface{}, error) { initializeInfoCache() if infoCacheEnable { cachedInfo, ok := infoCache[filename] if ok { if verboseReader { log.Printf("Cache hit info for file %s", filename) } return cachedInfo, nil } if verboseReader { log.Printf("...
go
{ "resource": "" }
q18713
SpecialCaseExpression
train
func (p *patternNames) SpecialCaseExpression(value, variable string) (code string, ok bool) { fn, ok := p.specialCase[value] if !ok { return "", false } return fn(variable), ok }
go
{ "resource": "" }
q18714
VariableName
train
func (p *patternNames) VariableName(value string) string { num, ok := p.values[value] if !ok { if p.values == nil { p.values = make(map[string]int) } num = p.last p.last++ p.values[value] = num } return fmt.Sprintf("%s%d", p.prefix, num) }
go
{ "resource": "" }
q18715
GenerateCompiler
train
func (domain *Domain) GenerateCompiler(packageName string, license string, imports []string) string { code := &printer.Code{} code.Print(license) code.Print("// THIS FILE IS AUTOMATICALLY GENERATED.\n") // generate package declaration code.Print("package %s\n", packageName) code.Print("import (") for _, filena...
go
{ "resource": "" }
q18716
NewEnvironment
train
func NewEnvironment() (env *Environment, err error) { env = &Environment{ Invocation: os.Args[0], Response: &Response{}, } input := flag.String("input", "", "API description (in binary protocol buffer form)") output := flag.String("output", "-", "Output file or directory") plugin := flag.Bool("plugin", fals...
go
{ "resource": "" }
q18717
RespondAndExitIfError
train
func (env *Environment) RespondAndExitIfError(err error) { if err != nil { env.Response.Errors = append(env.Response.Errors, err.Error()) env.RespondAndExit() } }
go
{ "resource": "" }
q18718
RespondAndExit
train
func (env *Environment) RespondAndExit() { if env.RunningAsPlugin { responseBytes, _ := proto.Marshal(env.Response) os.Stdout.Write(responseBytes) } else { err := HandleResponse(env.Response, env.Request.OutputPath) if err != nil { log.Printf("%s", err.Error()) } } os.Exit(0) }
go
{ "resource": "" }
q18719
readConfig
train
func readConfig(scopes []string) (*oauth2.Config, error) { // Read the secrets file data, err := ioutil.ReadFile(*clientSecretsFile) if err != nil { pwd, _ := os.Getwd() fullPath := filepath.Join(pwd, *clientSecretsFile) return nil, fmt.Errorf(missingClientSecretsMessage, fullPath) } cfg := new(Config) err...
go
{ "resource": "" }
q18720
OpenAPIv2
train
func OpenAPIv2(api *discovery.Document) (*openapi2.Document, error) { d := &openapi2.Document{} d.Swagger = "2.0" d.Info = &openapi2.Info{ Title: api.Title, Version: api.Version, Description: api.Description, } url, _ := url.Parse(api.RootUrl) d.Host = url.Host d.BasePath = removeTrailingSlash(ap...
go
{ "resource": "" }
q18721
HandleExtension
train
func HandleExtension(context *Context, in interface{}, extensionName string) (bool, *any.Any, error) { handled := false var errFromPlugin error var outFromPlugin *any.Any if context != nil && context.ExtensionHandlers != nil && len(*(context.ExtensionHandlers)) != 0 { for _, customAnyProtoGenerator := range *(co...
go
{ "resource": "" }
q18722
OpenAPIv3
train
func OpenAPIv3(api *discovery.Document) (*openapi3.Document, error) { d := &openapi3.Document{} d.Openapi = "3.0" d.Info = &openapi3.Info{ Title: api.Title, Version: api.Version, Description: api.Description, } d.Servers = make([]*openapi3.Server, 0) url, _ := url.Parse(api.RootUrl) host := url....
go
{ "resource": "" }
q18723
NewAdditionalPropertiesItem
train
func NewAdditionalPropertiesItem(in interface{}, context *compiler.Context) (*AdditionalPropertiesItem, error) { errors := make([]error, 0) x := &AdditionalPropertiesItem{} matched := false // Schema schema = 1; { m, ok := compiler.UnpackMap(in) if ok { // errors might be ok here, they mean we just don't ha...
go
{ "resource": "" }
q18724
NewHeaders
train
func NewHeaders(in interface{}, context *compiler.Context) (*Headers, error) { errors := make([]error, 0) x := &Headers{} m, ok := compiler.UnpackMap(in) if !ok { message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) errors = append(errors, compiler.NewError(context, message)) } else { // repeated...
go
{ "resource": "" }
q18725
NewItemsItem
train
func NewItemsItem(in interface{}, context *compiler.Context) (*ItemsItem, error) { errors := make([]error, 0) x := &ItemsItem{} m, ok := compiler.UnpackMap(in) if !ok { message := fmt.Sprintf("has unexpected value for item array: %+v (%T)", in, in) errors = append(errors, compiler.NewError(context, message)) }...
go
{ "resource": "" }
q18726
NewJsonReference
train
func NewJsonReference(in interface{}, context *compiler.Context) (*JsonReference, error) { errors := make([]error, 0) x := &JsonReference{} m, ok := compiler.UnpackMap(in) if !ok { message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) errors = append(errors, compiler.NewError(context, message)) } el...
go
{ "resource": "" }
q18727
NewNonBodyParameter
train
func NewNonBodyParameter(in interface{}, context *compiler.Context) (*NonBodyParameter, error) { errors := make([]error, 0) x := &NonBodyParameter{} matched := false m, ok := compiler.UnpackMap(in) if !ok { message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) errors = append(errors, compiler.NewErr...
go
{ "resource": "" }
q18728
NewOauth2Scopes
train
func NewOauth2Scopes(in interface{}, context *compiler.Context) (*Oauth2Scopes, error) { errors := make([]error, 0) x := &Oauth2Scopes{} m, ok := compiler.UnpackMap(in) if !ok { message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) errors = append(errors, compiler.NewError(context, message)) } else ...
go
{ "resource": "" }
q18729
NewParameterDefinitions
train
func NewParameterDefinitions(in interface{}, context *compiler.Context) (*ParameterDefinitions, error) { errors := make([]error, 0) x := &ParameterDefinitions{} m, ok := compiler.UnpackMap(in) if !ok { message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) errors = append(errors, compiler.NewError(con...
go
{ "resource": "" }
q18730
NewParametersItem
train
func NewParametersItem(in interface{}, context *compiler.Context) (*ParametersItem, error) { errors := make([]error, 0) x := &ParametersItem{} matched := false // Parameter parameter = 1; { m, ok := compiler.UnpackMap(in) if ok { // errors might be ok here, they mean we just don't have the right subtype ...
go
{ "resource": "" }
q18731
NewResponseDefinitions
train
func NewResponseDefinitions(in interface{}, context *compiler.Context) (*ResponseDefinitions, error) { errors := make([]error, 0) x := &ResponseDefinitions{} m, ok := compiler.UnpackMap(in) if !ok { message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) errors = append(errors, compiler.NewError(contex...
go
{ "resource": "" }
q18732
NewResponseValue
train
func NewResponseValue(in interface{}, context *compiler.Context) (*ResponseValue, error) { errors := make([]error, 0) x := &ResponseValue{} matched := false // Response response = 1; { m, ok := compiler.UnpackMap(in) if ok { // errors might be ok here, they mean we just don't have the right subtype t, ma...
go
{ "resource": "" }
q18733
NewSchemaItem
train
func NewSchemaItem(in interface{}, context *compiler.Context) (*SchemaItem, error) { errors := make([]error, 0) x := &SchemaItem{} matched := false // Schema schema = 1; { m, ok := compiler.UnpackMap(in) if ok { // errors might be ok here, they mean we just don't have the right subtype t, matchingError :...
go
{ "resource": "" }
q18734
NewSecurityDefinitions
train
func NewSecurityDefinitions(in interface{}, context *compiler.Context) (*SecurityDefinitions, error) { errors := make([]error, 0) x := &SecurityDefinitions{} m, ok := compiler.UnpackMap(in) if !ok { message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in) errors = append(errors, compiler.NewError(contex...
go
{ "resource": "" }
q18735
NewSecurityDefinitionsItem
train
func NewSecurityDefinitionsItem(in interface{}, context *compiler.Context) (*SecurityDefinitionsItem, error) { errors := make([]error, 0) x := &SecurityDefinitionsItem{} matched := false // BasicAuthenticationSecurity basic_authentication_security = 1; { m, ok := compiler.UnpackMap(in) if ok { // errors mig...
go
{ "resource": "" }
q18736
NewTypeItem
train
func NewTypeItem(in interface{}, context *compiler.Context) (*TypeItem, error) { errors := make([]error, 0) x := &TypeItem{} switch in := in.(type) { case string: x.Value = make([]string, 0) x.Value = append(x.Value, in) case []interface{}: x.Value = make([]string, 0) for _, v := range in { value, ok :=...
go
{ "resource": "" }
q18737
ResolveReferences
train
func (m *BodyParameter) ResolveReferences(root string) (interface{}, error) { errors := make([]error, 0) if m.Schema != nil { _, err := m.Schema.ResolveReferences(root) if err != nil { errors = append(errors, err) } } for _, item := range m.VendorExtension { if item != nil { _, err := item.ResolveRefe...
go
{ "resource": "" }
q18738
ResolveReferences
train
func (m *FileSchema) ResolveReferences(root string) (interface{}, error) { errors := make([]error, 0) if m.Default != nil { _, err := m.Default.ResolveReferences(root) if err != nil { errors = append(errors, err) } } if m.ExternalDocs != nil { _, err := m.ExternalDocs.ResolveReferences(root) if err != ...
go
{ "resource": "" }
q18739
ResolveReferences
train
func (m *Info) ResolveReferences(root string) (interface{}, error) { errors := make([]error, 0) if m.Contact != nil { _, err := m.Contact.ResolveReferences(root) if err != nil { errors = append(errors, err) } } if m.License != nil { _, err := m.License.ResolveReferences(root) if err != nil { errors ...
go
{ "resource": "" }
q18740
ResolveReferences
train
func (m *ItemsItem) ResolveReferences(root string) (interface{}, error) { errors := make([]error, 0) for _, item := range m.Schema { if item != nil { _, err := item.ResolveReferences(root) if err != nil { errors = append(errors, err) } } } return nil, compiler.NewErrorGroupOrNil(errors) }
go
{ "resource": "" }
q18741
ResolveReferences
train
func (m *JsonReference) ResolveReferences(root string) (interface{}, error) { errors := make([]error, 0) if m.XRef != "" { info, err := compiler.ReadInfoForRef(root, m.XRef) if err != nil { return nil, err } if info != nil { replacement, err := NewJsonReference(info, nil) if err == nil { *m = *re...
go
{ "resource": "" }
q18742
ResolveReferences
train
func (m *NonBodyParameter) ResolveReferences(root string) (interface{}, error) { errors := make([]error, 0) { p, ok := m.Oneof.(*NonBodyParameter_HeaderParameterSubSchema) if ok { _, err := p.HeaderParameterSubSchema.ResolveReferences(root) if err != nil { return nil, err } } } { p, ok := m.One...
go
{ "resource": "" }
q18743
ResolveReferences
train
func (m *Oauth2ImplicitSecurity) ResolveReferences(root string) (interface{}, error) { errors := make([]error, 0) if m.Scopes != nil { _, err := m.Scopes.ResolveReferences(root) if err != nil { errors = append(errors, err) } } for _, item := range m.VendorExtension { if item != nil { _, err := item.Re...
go
{ "resource": "" }
q18744
ResolveReferences
train
func (m *ParametersItem) ResolveReferences(root string) (interface{}, error) { errors := make([]error, 0) { p, ok := m.Oneof.(*ParametersItem_Parameter) if ok { _, err := p.Parameter.ResolveReferences(root) if err != nil { return nil, err } } } { p, ok := m.Oneof.(*ParametersItem_JsonReference)...
go
{ "resource": "" }
q18745
ResolveReferences
train
func (m *PathParameterSubSchema) ResolveReferences(root string) (interface{}, error) { errors := make([]error, 0) if m.Items != nil { _, err := m.Items.ResolveReferences(root) if err != nil { errors = append(errors, err) } } if m.Default != nil { _, err := m.Default.ResolveReferences(root) if err != ni...
go
{ "resource": "" }
q18746
ResolveReferences
train
func (m *Paths) ResolveReferences(root string) (interface{}, error) { errors := make([]error, 0) for _, item := range m.VendorExtension { if item != nil { _, err := item.ResolveReferences(root) if err != nil { errors = append(errors, err) } } } for _, item := range m.Path { if item != nil { _,...
go
{ "resource": "" }
q18747
ResolveReferences
train
func (m *ResponseValue) ResolveReferences(root string) (interface{}, error) { errors := make([]error, 0) { p, ok := m.Oneof.(*ResponseValue_Response) if ok { _, err := p.Response.ResolveReferences(root) if err != nil { return nil, err } } } { p, ok := m.Oneof.(*ResponseValue_JsonReference) if...
go
{ "resource": "" }
q18748
ResolveReferences
train
func (m *SchemaItem) ResolveReferences(root string) (interface{}, error) { errors := make([]error, 0) { p, ok := m.Oneof.(*SchemaItem_Schema) if ok { _, err := p.Schema.ResolveReferences(root) if err != nil { return nil, err } } } { p, ok := m.Oneof.(*SchemaItem_FileSchema) if ok { _, err ...
go
{ "resource": "" }
q18749
ResolveReferences
train
func (m *SecurityDefinitionsItem) ResolveReferences(root string) (interface{}, error) { errors := make([]error, 0) { p, ok := m.Oneof.(*SecurityDefinitionsItem_BasicAuthenticationSecurity) if ok { _, err := p.BasicAuthenticationSecurity.ResolveReferences(root) if err != nil { return nil, err } } }...
go
{ "resource": "" }
q18750
ToRawInfo
train
func (m *AdditionalPropertiesItem) ToRawInfo() interface{} { // ONE OF WRAPPER // AdditionalPropertiesItem // {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} v0 := m.GetSchema() if v0 != nil { return v0.ToRawInfo() } // {Name:boolean Type:bool StringEn...
go
{ "resource": "" }
q18751
ToRawInfo
train
func (m *ApiKeySecurity) ToRawInfo() interface{} { info := yaml.MapSlice{} if m == nil { return info } // always include this required field. info = append(info, yaml.MapItem{Key: "type", Value: m.Type}) // always include this required field. info = append(info, yaml.MapItem{Key: "name", Value: m.Name}) // al...
go
{ "resource": "" }
q18752
ToRawInfo
train
func (m *BodyParameter) ToRawInfo() interface{} { info := yaml.MapSlice{} if m == nil { return info } if m.Description != "" { info = append(info, yaml.MapItem{Key: "description", Value: m.Description}) } // always include this required field. info = append(info, yaml.MapItem{Key: "name", Value: m.Name}) //...
go
{ "resource": "" }
q18753
ToRawInfo
train
func (m *FileSchema) ToRawInfo() interface{} { info := yaml.MapSlice{} if m == nil { return info } if m.Format != "" { info = append(info, yaml.MapItem{Key: "format", Value: m.Format}) } if m.Title != "" { info = append(info, yaml.MapItem{Key: "title", Value: m.Title}) } if m.Description != "" { info = ...
go
{ "resource": "" }
q18754
ToRawInfo
train
func (m *Info) ToRawInfo() interface{} { info := yaml.MapSlice{} if m == nil { return info } // always include this required field. info = append(info, yaml.MapItem{Key: "title", Value: m.Title}) // always include this required field. info = append(info, yaml.MapItem{Key: "version", Value: m.Version}) if m.De...
go
{ "resource": "" }
q18755
ToRawInfo
train
func (m *ItemsItem) ToRawInfo() interface{} { info := yaml.MapSlice{} if m == nil { return info } if len(m.Schema) != 0 { items := make([]interface{}, 0) for _, item := range m.Schema { items = append(items, item.ToRawInfo()) } info = append(info, yaml.MapItem{Key: "schema", Value: items}) } // &{Nam...
go
{ "resource": "" }
q18756
ToRawInfo
train
func (m *JsonReference) ToRawInfo() interface{} { info := yaml.MapSlice{} if m == nil { return info } // always include this required field. info = append(info, yaml.MapItem{Key: "$ref", Value: m.XRef}) if m.Description != "" { info = append(info, yaml.MapItem{Key: "description", Value: m.Description}) } re...
go
{ "resource": "" }
q18757
ToRawInfo
train
func (m *License) ToRawInfo() interface{} { info := yaml.MapSlice{} if m == nil { return info } // always include this required field. info = append(info, yaml.MapItem{Key: "name", Value: m.Name}) if m.Url != "" { info = append(info, yaml.MapItem{Key: "url", Value: m.Url}) } if m.VendorExtension != nil { ...
go
{ "resource": "" }
q18758
ToRawInfo
train
func (m *NonBodyParameter) ToRawInfo() interface{} { // ONE OF WRAPPER // NonBodyParameter // {Name:headerParameterSubSchema Type:HeaderParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} v0 := m.GetHeaderParameterSubSchema() if v0 != nil { return v0.ToRawInfo() ...
go
{ "resource": "" }
q18759
ToRawInfo
train
func (m *Oauth2AccessCodeSecurity) ToRawInfo() interface{} { info := yaml.MapSlice{} if m == nil { return info } // always include this required field. info = append(info, yaml.MapItem{Key: "type", Value: m.Type}) // always include this required field. info = append(info, yaml.MapItem{Key: "flow", Value: m.Flo...
go
{ "resource": "" }
q18760
ToRawInfo
train
func (m *Oauth2Scopes) ToRawInfo() interface{} { info := yaml.MapSlice{} if m == nil { return info } // &{Name:additionalProperties Type:NamedString StringEnumValues:[] MapType:string Repeated:true Pattern: Implicit:true Description:} return info }
go
{ "resource": "" }
q18761
ToRawInfo
train
func (m *ParametersItem) ToRawInfo() interface{} { // ONE OF WRAPPER // ParametersItem // {Name:parameter Type:Parameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} v0 := m.GetParameter() if v0 != nil { return v0.ToRawInfo() } // {Name:jsonReference Type:JsonReference Stri...
go
{ "resource": "" }
q18762
ToRawInfo
train
func (m *ResponseValue) ToRawInfo() interface{} { // ONE OF WRAPPER // ResponseValue // {Name:response Type:Response StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} v0 := m.GetResponse() if v0 != nil { return v0.ToRawInfo() } // {Name:jsonReference Type:JsonReference StringEnu...
go
{ "resource": "" }
q18763
ToRawInfo
train
func (m *SchemaItem) ToRawInfo() interface{} { // ONE OF WRAPPER // SchemaItem // {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} v0 := m.GetSchema() if v0 != nil { return v0.ToRawInfo() } // {Name:fileSchema Type:FileSchema StringEnumValues:[] MapType...
go
{ "resource": "" }
q18764
ToRawInfo
train
func (m *SecurityDefinitionsItem) ToRawInfo() interface{} { // ONE OF WRAPPER // SecurityDefinitionsItem // {Name:basicAuthenticationSecurity Type:BasicAuthenticationSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:} v0 := m.GetBasicAuthenticationSecurity() if v0 != nil { ...
go
{ "resource": "" }
q18765
ToRawInfo
train
func (m *TypeItem) ToRawInfo() interface{} { info := yaml.MapSlice{} if m == nil { return info } if len(m.Value) != 0 { info = append(info, yaml.MapItem{Key: "value", Value: m.Value}) } return info }
go
{ "resource": "" }
q18766
build
train
func (b *OpenAPI3Builder) build(document *openapiv3.Document) (err error) { // Collect service type descriptions from Components/Schemas. if document.Components != nil && document.Components.Schemas != nil { for _, pair := range document.Components.Schemas.AdditionalProperties { t, err := b.buildTypeFromSchemaOr...
go
{ "resource": "" }
q18767
buildTypeFromSchemaOrReference
train
func (b *OpenAPI3Builder) buildTypeFromSchemaOrReference( name string, schemaOrReference *openapiv3.SchemaOrReference) (t *Type, err error) { if schema := schemaOrReference.GetSchema(); schema != nil { t = &Type{} t.Name = name t.Description = "implements the service definition of " + name t.Fields = make([]...
go
{ "resource": "" }
q18768
buildMethodFromPathItem
train
func (b *OpenAPI3Builder) buildMethodFromPathItem( path string, pathItem *openapiv3.PathItem) (err error) { for _, method := range []string{"GET", "PUT", "POST", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE"} { var op *openapiv3.Operation switch method { case "GET": op = pathItem.Get case "PUT": op = p...
go
{ "resource": "" }
q18769
buildTypeFromParameters
train
func (b *OpenAPI3Builder) buildTypeFromParameters( name string, parameters []*openapiv3.ParameterOrReference, requestBody *openapiv3.RequestBodyOrReference) (typeName string, err error) { t := &Type{} t.Name = name + "Parameters" t.Description = t.Name + " holds parameters to " + name t.Kind = TypeKind_STRUCT t...
go
{ "resource": "" }
q18770
buildTypeFromResponses
train
func (b *OpenAPI3Builder) buildTypeFromResponses( m *Method, name string, responses *openapiv3.Responses) (typeName string, err error) { t := &Type{} t.Name = name + "Responses" t.Description = t.Name + " holds responses of " + name t.Kind = TypeKind_STRUCT t.Fields = make([]*Field, 0) addResponse := func(nam...
go
{ "resource": "" }
q18771
typeForSchemaOrReference
train
func (b *OpenAPI3Builder) typeForSchemaOrReference(value *openapiv3.SchemaOrReference) (kind FieldKind, typeName, format string) { if value.GetSchema() != nil { return b.typeForSchema(value.GetSchema()) } if value.GetReference() != nil { return FieldKind_SCALAR, typeForRef(value.GetReference().XRef), "" } retu...
go
{ "resource": "" }
q18772
typeForSchema
train
func (b *OpenAPI3Builder) typeForSchema(schema *openapiv3.Schema) (kind FieldKind, typeName, format string) { if schema.Type != "" { format := schema.Format switch schema.Type { case "string": return FieldKind_SCALAR, "string", format case "integer": return FieldKind_SCALAR, "integer", format case "num...
go
{ "resource": "" }
q18773
GetEventListeners
train
func (d *domainClient) GetEventListeners(ctx context.Context, args *GetEventListenersArgs) (reply *GetEventListenersReply, err error) { reply = new(GetEventListenersReply) if args != nil { err = rpcc.Invoke(ctx, "DOMDebugger.getEventListeners", args, reply, d.conn) } else { err = rpcc.Invoke(ctx, "DOMDebugger.ge...
go
{ "resource": "" }
q18774
Disable
train
func (d *domainClient) Disable(ctx context.Context) (err error) { err = rpcc.Invoke(ctx, "HeadlessExperimental.disable", nil, nil, d.conn) if err != nil { err = &internal.OpError{Domain: "HeadlessExperimental", Op: "Disable", Err: err} } return }
go
{ "resource": "" }
q18775
AwaitPromise
train
func (d *domainClient) AwaitPromise(ctx context.Context, args *AwaitPromiseArgs) (reply *AwaitPromiseReply, err error) { reply = new(AwaitPromiseReply) if args != nil { err = rpcc.Invoke(ctx, "Runtime.awaitPromise", args, reply, d.conn) } else { err = rpcc.Invoke(ctx, "Runtime.awaitPromise", nil, reply, d.conn) ...
go
{ "resource": "" }
q18776
CallFunctionOn
train
func (d *domainClient) CallFunctionOn(ctx context.Context, args *CallFunctionOnArgs) (reply *CallFunctionOnReply, err error) { reply = new(CallFunctionOnReply) if args != nil { err = rpcc.Invoke(ctx, "Runtime.callFunctionOn", args, reply, d.conn) } else { err = rpcc.Invoke(ctx, "Runtime.callFunctionOn", nil, rep...
go
{ "resource": "" }
q18777
CompileScript
train
func (d *domainClient) CompileScript(ctx context.Context, args *CompileScriptArgs) (reply *CompileScriptReply, err error) { reply = new(CompileScriptReply) if args != nil { err = rpcc.Invoke(ctx, "Runtime.compileScript", args, reply, d.conn) } else { err = rpcc.Invoke(ctx, "Runtime.compileScript", nil, reply, d....
go
{ "resource": "" }
q18778
Evaluate
train
func (d *domainClient) Evaluate(ctx context.Context, args *EvaluateArgs) (reply *EvaluateReply, err error) { reply = new(EvaluateReply) if args != nil { err = rpcc.Invoke(ctx, "Runtime.evaluate", args, reply, d.conn) } else { err = rpcc.Invoke(ctx, "Runtime.evaluate", nil, reply, d.conn) } if err != nil { er...
go
{ "resource": "" }
q18779
GetProperties
train
func (d *domainClient) GetProperties(ctx context.Context, args *GetPropertiesArgs) (reply *GetPropertiesReply, err error) { reply = new(GetPropertiesReply) if args != nil { err = rpcc.Invoke(ctx, "Runtime.getProperties", args, reply, d.conn) } else { err = rpcc.Invoke(ctx, "Runtime.getProperties", nil, reply, d....
go
{ "resource": "" }
q18780
GlobalLexicalScopeNames
train
func (d *domainClient) GlobalLexicalScopeNames(ctx context.Context, args *GlobalLexicalScopeNamesArgs) (reply *GlobalLexicalScopeNamesReply, err error) { reply = new(GlobalLexicalScopeNamesReply) if args != nil { err = rpcc.Invoke(ctx, "Runtime.globalLexicalScopeNames", args, reply, d.conn) } else { err = rpcc.I...
go
{ "resource": "" }
q18781
QueryObjects
train
func (d *domainClient) QueryObjects(ctx context.Context, args *QueryObjectsArgs) (reply *QueryObjectsReply, err error) { reply = new(QueryObjectsReply) if args != nil { err = rpcc.Invoke(ctx, "Runtime.queryObjects", args, reply, d.conn) } else { err = rpcc.Invoke(ctx, "Runtime.queryObjects", nil, reply, d.conn) ...
go
{ "resource": "" }
q18782
RunScript
train
func (d *domainClient) RunScript(ctx context.Context, args *RunScriptArgs) (reply *RunScriptReply, err error) { reply = new(RunScriptReply) if args != nil { err = rpcc.Invoke(ctx, "Runtime.runScript", args, reply, d.conn) } else { err = rpcc.Invoke(ctx, "Runtime.runScript", nil, reply, d.conn) } if err != nil ...
go
{ "resource": "" }
q18783
NewGetCurrentTimeArgs
train
func NewGetCurrentTimeArgs(id string) *GetCurrentTimeArgs { args := new(GetCurrentTimeArgs) args.ID = id return args }
go
{ "resource": "" }
q18784
NewReleaseAnimationsArgs
train
func NewReleaseAnimationsArgs(animations []string) *ReleaseAnimationsArgs { args := new(ReleaseAnimationsArgs) args.Animations = animations return args }
go
{ "resource": "" }
q18785
NewResolveAnimationArgs
train
func NewResolveAnimationArgs(animationID string) *ResolveAnimationArgs { args := new(ResolveAnimationArgs) args.AnimationID = animationID return args }
go
{ "resource": "" }
q18786
NewSeekAnimationsArgs
train
func NewSeekAnimationsArgs(animations []string, currentTime float64) *SeekAnimationsArgs { args := new(SeekAnimationsArgs) args.Animations = animations args.CurrentTime = currentTime return args }
go
{ "resource": "" }
q18787
NewSetPausedArgs
train
func NewSetPausedArgs(animations []string, paused bool) *SetPausedArgs { args := new(SetPausedArgs) args.Animations = animations args.Paused = paused return args }
go
{ "resource": "" }
q18788
NewSetPlaybackRateArgs
train
func NewSetPlaybackRateArgs(playbackRate float64) *SetPlaybackRateArgs { args := new(SetPlaybackRateArgs) args.PlaybackRate = playbackRate return args }
go
{ "resource": "" }
q18789
NewSetTimingArgs
train
func NewSetTimingArgs(animationID string, duration float64, delay float64) *SetTimingArgs { args := new(SetTimingArgs) args.AnimationID = animationID args.Duration = duration args.Delay = delay return args }
go
{ "resource": "" }
q18790
NewContinueToLocationArgs
train
func NewContinueToLocationArgs(location Location) *ContinueToLocationArgs { args := new(ContinueToLocationArgs) args.Location = location return args }
go
{ "resource": "" }
q18791
NewEvaluateOnCallFrameArgs
train
func NewEvaluateOnCallFrameArgs(callFrameID CallFrameID, expression string) *EvaluateOnCallFrameArgs { args := new(EvaluateOnCallFrameArgs) args.CallFrameID = callFrameID args.Expression = expression return args }
go
{ "resource": "" }
q18792
SetIncludeCommandLineAPI
train
func (a *EvaluateOnCallFrameArgs) SetIncludeCommandLineAPI(includeCommandLineAPI bool) *EvaluateOnCallFrameArgs { a.IncludeCommandLineAPI = &includeCommandLineAPI return a }
go
{ "resource": "" }
q18793
SetThrowOnSideEffect
train
func (a *EvaluateOnCallFrameArgs) SetThrowOnSideEffect(throwOnSideEffect bool) *EvaluateOnCallFrameArgs { a.ThrowOnSideEffect = &throwOnSideEffect return a }
go
{ "resource": "" }
q18794
NewGetPossibleBreakpointsArgs
train
func NewGetPossibleBreakpointsArgs(start Location) *GetPossibleBreakpointsArgs { args := new(GetPossibleBreakpointsArgs) args.Start = start return args }
go
{ "resource": "" }
q18795
NewGetScriptSourceArgs
train
func NewGetScriptSourceArgs(scriptID runtime.ScriptID) *GetScriptSourceArgs { args := new(GetScriptSourceArgs) args.ScriptID = scriptID return args }
go
{ "resource": "" }
q18796
NewGetStackTraceArgs
train
func NewGetStackTraceArgs(stackTraceID runtime.StackTraceID) *GetStackTraceArgs { args := new(GetStackTraceArgs) args.StackTraceID = stackTraceID return args }
go
{ "resource": "" }
q18797
NewPauseOnAsyncCallArgs
train
func NewPauseOnAsyncCallArgs(parentStackTraceID runtime.StackTraceID) *PauseOnAsyncCallArgs { args := new(PauseOnAsyncCallArgs) args.ParentStackTraceID = parentStackTraceID return args }
go
{ "resource": "" }
q18798
NewRemoveBreakpointArgs
train
func NewRemoveBreakpointArgs(breakpointID BreakpointID) *RemoveBreakpointArgs { args := new(RemoveBreakpointArgs) args.BreakpointID = breakpointID return args }
go
{ "resource": "" }
q18799
NewRestartFrameArgs
train
func NewRestartFrameArgs(callFrameID CallFrameID) *RestartFrameArgs { args := new(RestartFrameArgs) args.CallFrameID = callFrameID return args }
go
{ "resource": "" }