id
int32 0
167k
| repo
stringlengths 5
54
| path
stringlengths 4
155
| func_name
stringlengths 1
118
| original_string
stringlengths 52
85.5k
| language
stringclasses 1
value | code
stringlengths 52
85.5k
| code_tokens
listlengths 21
1.41k
| docstring
stringlengths 6
2.61k
| docstring_tokens
listlengths 3
215
| sha
stringlengths 40
40
| url
stringlengths 85
252
|
|---|---|---|---|---|---|---|---|---|---|---|---|
18,700
|
googleapis/gnostic
|
plugins/gnostic-go-generator/renderer.go
|
Render
|
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 "provider.go":
file.Data, err = renderer.RenderProvider()
case "server.go":
file.Data, err = renderer.RenderServer()
case "constants.go":
file.Data, err = renderer.RenderConstants()
default:
file.Data = nil
}
if err != nil {
response.Errors = append(response.Errors, fmt.Sprintf("ERROR %v", err))
}
// run generated Go files through imports pkg
if filepath.Ext(file.Name) == ".go" {
file.Data, err = imports.Process(file.Name, file.Data, nil)
}
response.Files = append(response.Files, file)
}
return
}
|
go
|
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 "provider.go":
file.Data, err = renderer.RenderProvider()
case "server.go":
file.Data, err = renderer.RenderServer()
case "constants.go":
file.Data, err = renderer.RenderConstants()
default:
file.Data = nil
}
if err != nil {
response.Errors = append(response.Errors, fmt.Sprintf("ERROR %v", err))
}
// run generated Go files through imports pkg
if filepath.Ext(file.Name) == ".go" {
file.Data, err = imports.Process(file.Name, file.Data, nil)
}
response.Files = append(response.Files, file)
}
return
}
|
[
"func",
"(",
"renderer",
"*",
"Renderer",
")",
"Render",
"(",
"response",
"*",
"plugins",
".",
"Response",
",",
"files",
"[",
"]",
"string",
")",
"(",
"err",
"error",
")",
"{",
"for",
"_",
",",
"filename",
":=",
"range",
"files",
"{",
"file",
":=",
"&",
"plugins",
".",
"File",
"{",
"Name",
":",
"filename",
"}",
"\n",
"switch",
"filename",
"{",
"case",
"\"",
"\"",
":",
"file",
".",
"Data",
",",
"err",
"=",
"renderer",
".",
"RenderClient",
"(",
")",
"\n",
"case",
"\"",
"\"",
":",
"file",
".",
"Data",
",",
"err",
"=",
"renderer",
".",
"RenderTypes",
"(",
")",
"\n",
"case",
"\"",
"\"",
":",
"file",
".",
"Data",
",",
"err",
"=",
"renderer",
".",
"RenderProvider",
"(",
")",
"\n",
"case",
"\"",
"\"",
":",
"file",
".",
"Data",
",",
"err",
"=",
"renderer",
".",
"RenderServer",
"(",
")",
"\n",
"case",
"\"",
"\"",
":",
"file",
".",
"Data",
",",
"err",
"=",
"renderer",
".",
"RenderConstants",
"(",
")",
"\n",
"default",
":",
"file",
".",
"Data",
"=",
"nil",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"response",
".",
"Errors",
"=",
"append",
"(",
"response",
".",
"Errors",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
")",
"\n",
"}",
"\n",
"// run generated Go files through imports pkg",
"if",
"filepath",
".",
"Ext",
"(",
"file",
".",
"Name",
")",
"==",
"\"",
"\"",
"{",
"file",
".",
"Data",
",",
"err",
"=",
"imports",
".",
"Process",
"(",
"file",
".",
"Name",
",",
"file",
".",
"Data",
",",
"nil",
")",
"\n",
"}",
"\n",
"response",
".",
"Files",
"=",
"append",
"(",
"response",
".",
"Files",
",",
"file",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// Generate runs the renderer to generate the named files.
|
[
"Generate",
"runs",
"the",
"renderer",
"to",
"generate",
"the",
"named",
"files",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/plugins/gnostic-go-generator/renderer.go#L41-L68
|
18,701
|
googleapis/gnostic
|
surface/model_openapiv2.go
|
build
|
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 {
return err
}
b.model.addType(t)
}
}
// Collect service method descriptions from Paths section.
if document.Paths != nil {
for _, pair := range document.Paths.Path {
v := pair.Value
if v.Get != nil {
b.buildMethodFromOperation(v.Get, "GET", pair.Name)
}
if v.Post != nil {
b.buildMethodFromOperation(v.Post, "POST", pair.Name)
}
if v.Put != nil {
b.buildMethodFromOperation(v.Put, "PUT", pair.Name)
}
if v.Delete != nil {
b.buildMethodFromOperation(v.Delete, "DELETE", pair.Name)
}
}
}
return err
}
|
go
|
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 {
return err
}
b.model.addType(t)
}
}
// Collect service method descriptions from Paths section.
if document.Paths != nil {
for _, pair := range document.Paths.Path {
v := pair.Value
if v.Get != nil {
b.buildMethodFromOperation(v.Get, "GET", pair.Name)
}
if v.Post != nil {
b.buildMethodFromOperation(v.Post, "POST", pair.Name)
}
if v.Put != nil {
b.buildMethodFromOperation(v.Put, "PUT", pair.Name)
}
if v.Delete != nil {
b.buildMethodFromOperation(v.Delete, "DELETE", pair.Name)
}
}
}
return err
}
|
[
"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",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"b",
".",
"model",
".",
"addType",
"(",
"t",
")",
"\n",
"}",
"\n",
"}",
"\n",
"// Collect service method descriptions from Paths section.",
"if",
"document",
".",
"Paths",
"!=",
"nil",
"{",
"for",
"_",
",",
"pair",
":=",
"range",
"document",
".",
"Paths",
".",
"Path",
"{",
"v",
":=",
"pair",
".",
"Value",
"\n",
"if",
"v",
".",
"Get",
"!=",
"nil",
"{",
"b",
".",
"buildMethodFromOperation",
"(",
"v",
".",
"Get",
",",
"\"",
"\"",
",",
"pair",
".",
"Name",
")",
"\n",
"}",
"\n",
"if",
"v",
".",
"Post",
"!=",
"nil",
"{",
"b",
".",
"buildMethodFromOperation",
"(",
"v",
".",
"Post",
",",
"\"",
"\"",
",",
"pair",
".",
"Name",
")",
"\n",
"}",
"\n",
"if",
"v",
".",
"Put",
"!=",
"nil",
"{",
"b",
".",
"buildMethodFromOperation",
"(",
"v",
".",
"Put",
",",
"\"",
"\"",
",",
"pair",
".",
"Name",
")",
"\n",
"}",
"\n",
"if",
"v",
".",
"Delete",
"!=",
"nil",
"{",
"b",
".",
"buildMethodFromOperation",
"(",
"v",
".",
"Delete",
",",
"\"",
"\"",
",",
"pair",
".",
"Name",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
// buildV2 builds an API service description, preprocessing its types and methods for code generation.
|
[
"buildV2",
"builds",
"an",
"API",
"service",
"description",
"preprocessing",
"its",
"types",
"and",
"methods",
"for",
"code",
"generation",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/surface/model_openapiv2.go#L49-L79
|
18,702
|
googleapis/gnostic
|
generate-gnostic/generate-extension.go
|
generateMainFile
|
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 _, filename := range imports {
code.Print("\"" + filename + "\"")
}
code.Print(")\n")
code.Print(codeBody)
return code.String()
}
|
go
|
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 _, filename := range imports {
code.Print("\"" + filename + "\"")
}
code.Print(")\n")
code.Print(codeBody)
return code.String()
}
|
[
"func",
"generateMainFile",
"(",
"packageName",
"string",
",",
"license",
"string",
",",
"codeBody",
"string",
",",
"imports",
"[",
"]",
"string",
")",
"string",
"{",
"code",
":=",
"&",
"printer",
".",
"Code",
"{",
"}",
"\n",
"code",
".",
"Print",
"(",
"license",
")",
"\n",
"code",
".",
"Print",
"(",
"\"",
"\\n",
"\"",
")",
"\n\n",
"// generate package declaration",
"code",
".",
"Print",
"(",
"\"",
"\\n",
"\"",
",",
"packageName",
")",
"\n\n",
"code",
".",
"Print",
"(",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"filename",
":=",
"range",
"imports",
"{",
"code",
".",
"Print",
"(",
"\"",
"\\\"",
"\"",
"+",
"filename",
"+",
"\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n",
"code",
".",
"Print",
"(",
"\"",
"\\n",
"\"",
")",
"\n\n",
"code",
".",
"Print",
"(",
"codeBody",
")",
"\n",
"return",
"code",
".",
"String",
"(",
")",
"\n",
"}"
] |
// generateMainFile generates the main program for an extension.
|
[
"generateMainFile",
"generates",
"the",
"main",
"program",
"for",
"an",
"extension",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/generate-gnostic/generate-extension.go#L88-L104
|
18,703
|
googleapis/gnostic
|
plugins/gnostic-analyze/statistics/statsv2.go
|
NewDocumentStatistics
|
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 = make(map[string]int, 0)
s.DefinitionPrimitiveTypes = make(map[string]int, 0)
s.AnonymousOperations = make([]string, 0)
s.AnonymousObjects = make([]string, 0)
s.analyzeDocument(source, document)
return s
}
|
go
|
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 = make(map[string]int, 0)
s.DefinitionPrimitiveTypes = make(map[string]int, 0)
s.AnonymousOperations = make([]string, 0)
s.AnonymousObjects = make([]string, 0)
s.analyzeDocument(source, document)
return s
}
|
[
"func",
"NewDocumentStatistics",
"(",
"source",
"string",
",",
"document",
"*",
"openapi",
".",
"Document",
")",
"*",
"DocumentStatistics",
"{",
"s",
":=",
"&",
"DocumentStatistics",
"{",
"}",
"\n",
"s",
".",
"Operations",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"int",
",",
"0",
")",
"\n",
"s",
".",
"ParameterTypes",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"int",
",",
"0",
")",
"\n",
"s",
".",
"ResultTypes",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"int",
",",
"0",
")",
"\n",
"s",
".",
"DefinitionFieldTypes",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"int",
",",
"0",
")",
"\n",
"s",
".",
"DefinitionArrayTypes",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"int",
",",
"0",
")",
"\n",
"s",
".",
"DefinitionPrimitiveTypes",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"int",
",",
"0",
")",
"\n",
"s",
".",
"AnonymousOperations",
"=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"s",
".",
"AnonymousObjects",
"=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"s",
".",
"analyzeDocument",
"(",
"source",
",",
"document",
")",
"\n",
"return",
"s",
"\n",
"}"
] |
// NewDocumentStatistics builds a new DocumentStatistics object.
|
[
"NewDocumentStatistics",
"builds",
"a",
"new",
"DocumentStatistics",
"object",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/plugins/gnostic-analyze/statistics/statsv2.go#L40-L52
|
18,704
|
googleapis/gnostic
|
plugins/gnostic-analyze/statistics/statsv2.go
|
analyzeDefinition
|
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.Value
propertyType := typeForSchema(propertySchema)
s.addDefinitionFieldType(path+"/"+pair.Name, propertyType)
}
}
case "array":
s.addDefinitionArrayType(path+"/", typeForSchema(definition))
default: // string, boolean, integer, number, null...
s.addDefinitionPrimitiveType(path+"/", typeName)
}
}
|
go
|
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.Value
propertyType := typeForSchema(propertySchema)
s.addDefinitionFieldType(path+"/"+pair.Name, propertyType)
}
}
case "array":
s.addDefinitionArrayType(path+"/", typeForSchema(definition))
default: // string, boolean, integer, number, null...
s.addDefinitionPrimitiveType(path+"/", typeName)
}
}
|
[
"func",
"(",
"s",
"*",
"DocumentStatistics",
")",
"analyzeDefinition",
"(",
"path",
"string",
",",
"definition",
"*",
"openapi",
".",
"Schema",
")",
"{",
"s",
".",
"DefinitionCount",
"++",
"\n",
"typeName",
":=",
"typeNameForSchema",
"(",
"definition",
")",
"\n",
"switch",
"typeName",
"{",
"case",
"\"",
"\"",
":",
"if",
"definition",
".",
"Properties",
"!=",
"nil",
"{",
"for",
"_",
",",
"pair",
":=",
"range",
"definition",
".",
"Properties",
".",
"AdditionalProperties",
"{",
"propertySchema",
":=",
"pair",
".",
"Value",
"\n",
"propertyType",
":=",
"typeForSchema",
"(",
"propertySchema",
")",
"\n",
"s",
".",
"addDefinitionFieldType",
"(",
"path",
"+",
"\"",
"\"",
"+",
"pair",
".",
"Name",
",",
"propertyType",
")",
"\n",
"}",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"s",
".",
"addDefinitionArrayType",
"(",
"path",
"+",
"\"",
"\"",
",",
"typeForSchema",
"(",
"definition",
")",
")",
"\n",
"default",
":",
"// string, boolean, integer, number, null...",
"s",
".",
"addDefinitionPrimitiveType",
"(",
"path",
"+",
"\"",
"\"",
",",
"typeName",
")",
"\n",
"}",
"\n",
"}"
] |
// Analyze a definition in an OpenAPI description.
// Collect information about the definition type and any subsidiary types,
// such as the types of object fields or array elements.
|
[
"Analyze",
"a",
"definition",
"in",
"an",
"OpenAPI",
"description",
".",
"Collect",
"information",
"about",
"the",
"definition",
"type",
"and",
"any",
"subsidiary",
"types",
"such",
"as",
"the",
"types",
"of",
"object",
"fields",
"or",
"array",
"elements",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/plugins/gnostic-analyze/statistics/statsv2.go#L186-L203
|
18,705
|
googleapis/gnostic
|
plugins/gnostic-analyze/statistics/statsv2.go
|
analyzeDocument
|
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 {
s.analyzeOperation("post", "paths"+pair.Name+"/post", path.Post)
}
if path.Put != nil {
s.analyzeOperation("put", "paths"+pair.Name+"/put", path.Put)
}
if path.Delete != nil {
s.analyzeOperation("delete", "paths"+pair.Name+"/delete", path.Delete)
}
}
if document.Definitions != nil {
for _, pair := range document.Definitions.AdditionalProperties {
definition := pair.Value
s.analyzeDefinition("definitions/"+pair.Name, definition)
}
}
}
|
go
|
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 {
s.analyzeOperation("post", "paths"+pair.Name+"/post", path.Post)
}
if path.Put != nil {
s.analyzeOperation("put", "paths"+pair.Name+"/put", path.Put)
}
if path.Delete != nil {
s.analyzeOperation("delete", "paths"+pair.Name+"/delete", path.Delete)
}
}
if document.Definitions != nil {
for _, pair := range document.Definitions.AdditionalProperties {
definition := pair.Value
s.analyzeDefinition("definitions/"+pair.Name, definition)
}
}
}
|
[
"func",
"(",
"s",
"*",
"DocumentStatistics",
")",
"analyzeDocument",
"(",
"source",
"string",
",",
"document",
"*",
"openapi",
".",
"Document",
")",
"{",
"s",
".",
"Name",
"=",
"source",
"\n\n",
"s",
".",
"Title",
"=",
"document",
".",
"Info",
".",
"Title",
"\n",
"for",
"_",
",",
"pair",
":=",
"range",
"document",
".",
"Paths",
".",
"Path",
"{",
"path",
":=",
"pair",
".",
"Value",
"\n",
"if",
"path",
".",
"Get",
"!=",
"nil",
"{",
"s",
".",
"analyzeOperation",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"pair",
".",
"Name",
"+",
"\"",
"\"",
",",
"path",
".",
"Get",
")",
"\n",
"}",
"\n",
"if",
"path",
".",
"Post",
"!=",
"nil",
"{",
"s",
".",
"analyzeOperation",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"pair",
".",
"Name",
"+",
"\"",
"\"",
",",
"path",
".",
"Post",
")",
"\n",
"}",
"\n",
"if",
"path",
".",
"Put",
"!=",
"nil",
"{",
"s",
".",
"analyzeOperation",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"pair",
".",
"Name",
"+",
"\"",
"\"",
",",
"path",
".",
"Put",
")",
"\n",
"}",
"\n",
"if",
"path",
".",
"Delete",
"!=",
"nil",
"{",
"s",
".",
"analyzeOperation",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"pair",
".",
"Name",
"+",
"\"",
"\"",
",",
"path",
".",
"Delete",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"document",
".",
"Definitions",
"!=",
"nil",
"{",
"for",
"_",
",",
"pair",
":=",
"range",
"document",
".",
"Definitions",
".",
"AdditionalProperties",
"{",
"definition",
":=",
"pair",
".",
"Value",
"\n",
"s",
".",
"analyzeDefinition",
"(",
"\"",
"\"",
"+",
"pair",
".",
"Name",
",",
"definition",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
// Analyze an OpenAPI description.
// Collect information about types used in the API.
// This should be called exactly once per DocumentStatistics object.
|
[
"Analyze",
"an",
"OpenAPI",
"description",
".",
"Collect",
"information",
"about",
"types",
"used",
"in",
"the",
"API",
".",
"This",
"should",
"be",
"called",
"exactly",
"once",
"per",
"DocumentStatistics",
"object",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/plugins/gnostic-analyze/statistics/statsv2.go#L208-L233
|
18,706
|
googleapis/gnostic
|
plugins/gnostic-analyze/statistics/statsv2.go
|
typeForSchema
|
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 array of schemas
itemType := ""
for i, itemSchema := range schema.Items.Schema {
if i > 0 {
itemType += "|"
}
itemType += typeForSchema(itemSchema)
}
return "array-of-" + itemType
} else if schema.XRef != "" {
return "array-of-reference"
} else {
// we need to do more work to understand this type
return fmt.Sprintf("array-of-[%+v]", schema)
}
} else if typeName == "object" {
// this object might be representable with a map
// but not if it has properties
if (schema.Properties != nil) && (len(schema.Properties.AdditionalProperties) > 0) {
return typeName
}
if schema.AdditionalProperties != nil {
if schema.AdditionalProperties.GetSchema() != nil {
additionalPropertiesSchemaType := typeForSchema(schema.AdditionalProperties.GetSchema())
return "map-of-" + additionalPropertiesSchemaType
}
if schema.AdditionalProperties.GetBoolean() == false {
// no additional properties are allowed, so we're not sure what to do if we get here...
return typeName
}
}
if schema.Items != nil {
itemType := ""
for i, itemSchema := range schema.Items.Schema {
if i > 0 {
itemType += "|"
}
itemType += typeForSchema(itemSchema)
}
return "map-of-" + itemType
}
return "map-of-object"
} else {
return typeName
}
}
|
go
|
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 array of schemas
itemType := ""
for i, itemSchema := range schema.Items.Schema {
if i > 0 {
itemType += "|"
}
itemType += typeForSchema(itemSchema)
}
return "array-of-" + itemType
} else if schema.XRef != "" {
return "array-of-reference"
} else {
// we need to do more work to understand this type
return fmt.Sprintf("array-of-[%+v]", schema)
}
} else if typeName == "object" {
// this object might be representable with a map
// but not if it has properties
if (schema.Properties != nil) && (len(schema.Properties.AdditionalProperties) > 0) {
return typeName
}
if schema.AdditionalProperties != nil {
if schema.AdditionalProperties.GetSchema() != nil {
additionalPropertiesSchemaType := typeForSchema(schema.AdditionalProperties.GetSchema())
return "map-of-" + additionalPropertiesSchemaType
}
if schema.AdditionalProperties.GetBoolean() == false {
// no additional properties are allowed, so we're not sure what to do if we get here...
return typeName
}
}
if schema.Items != nil {
itemType := ""
for i, itemSchema := range schema.Items.Schema {
if i > 0 {
itemType += "|"
}
itemType += typeForSchema(itemSchema)
}
return "map-of-" + itemType
}
return "map-of-object"
} else {
return typeName
}
}
|
[
"func",
"typeForSchema",
"(",
"schema",
"*",
"openapi",
".",
"Schema",
")",
"string",
"{",
"if",
"schema",
".",
"XRef",
"!=",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"len",
"(",
"schema",
".",
"Enum",
")",
">",
"0",
"{",
"enumType",
":=",
"typeNameForSchema",
"(",
"schema",
")",
"\n",
"return",
"\"",
"\"",
"+",
"enumType",
"\n",
"}",
"\n",
"typeName",
":=",
"typeNameForSchema",
"(",
"schema",
")",
"\n",
"if",
"typeName",
"==",
"\"",
"\"",
"{",
"if",
"schema",
".",
"Items",
"!=",
"nil",
"{",
"// items contains an array of schemas",
"itemType",
":=",
"\"",
"\"",
"\n",
"for",
"i",
",",
"itemSchema",
":=",
"range",
"schema",
".",
"Items",
".",
"Schema",
"{",
"if",
"i",
">",
"0",
"{",
"itemType",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"itemType",
"+=",
"typeForSchema",
"(",
"itemSchema",
")",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"+",
"itemType",
"\n",
"}",
"else",
"if",
"schema",
".",
"XRef",
"!=",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"// we need to do more work to understand this type",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"schema",
")",
"\n",
"}",
"\n",
"}",
"else",
"if",
"typeName",
"==",
"\"",
"\"",
"{",
"// this object might be representable with a map",
"// but not if it has properties",
"if",
"(",
"schema",
".",
"Properties",
"!=",
"nil",
")",
"&&",
"(",
"len",
"(",
"schema",
".",
"Properties",
".",
"AdditionalProperties",
")",
">",
"0",
")",
"{",
"return",
"typeName",
"\n",
"}",
"\n",
"if",
"schema",
".",
"AdditionalProperties",
"!=",
"nil",
"{",
"if",
"schema",
".",
"AdditionalProperties",
".",
"GetSchema",
"(",
")",
"!=",
"nil",
"{",
"additionalPropertiesSchemaType",
":=",
"typeForSchema",
"(",
"schema",
".",
"AdditionalProperties",
".",
"GetSchema",
"(",
")",
")",
"\n",
"return",
"\"",
"\"",
"+",
"additionalPropertiesSchemaType",
"\n",
"}",
"\n",
"if",
"schema",
".",
"AdditionalProperties",
".",
"GetBoolean",
"(",
")",
"==",
"false",
"{",
"// no additional properties are allowed, so we're not sure what to do if we get here...",
"return",
"typeName",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"schema",
".",
"Items",
"!=",
"nil",
"{",
"itemType",
":=",
"\"",
"\"",
"\n",
"for",
"i",
",",
"itemSchema",
":=",
"range",
"schema",
".",
"Items",
".",
"Schema",
"{",
"if",
"i",
">",
"0",
"{",
"itemType",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"itemType",
"+=",
"typeForSchema",
"(",
"itemSchema",
")",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"+",
"itemType",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"return",
"typeName",
"\n",
"}",
"\n",
"}"
] |
// Return a type name to use for a schema.
|
[
"Return",
"a",
"type",
"name",
"to",
"use",
"for",
"a",
"schema",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/plugins/gnostic-analyze/statistics/statsv2.go#L252-L308
|
18,707
|
googleapis/gnostic
|
jsonschema/display.go
|
Description
|
func (s *StringOrStringArray) Description() string {
if s.String != nil {
return *s.String
}
if s.StringArray != nil {
return strings.Join(*s.StringArray, ", ")
}
return ""
}
|
go
|
func (s *StringOrStringArray) Description() string {
if s.String != nil {
return *s.String
}
if s.StringArray != nil {
return strings.Join(*s.StringArray, ", ")
}
return ""
}
|
[
"func",
"(",
"s",
"*",
"StringOrStringArray",
")",
"Description",
"(",
")",
"string",
"{",
"if",
"s",
".",
"String",
"!=",
"nil",
"{",
"return",
"*",
"s",
".",
"String",
"\n",
"}",
"\n",
"if",
"s",
".",
"StringArray",
"!=",
"nil",
"{",
"return",
"strings",
".",
"Join",
"(",
"*",
"s",
".",
"StringArray",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
//
// DISPLAY
// The following methods display Schemas.
//
// Description returns a string representation of a string or string array.
|
[
"DISPLAY",
"The",
"following",
"methods",
"display",
"Schemas",
".",
"Description",
"returns",
"a",
"string",
"representation",
"of",
"a",
"string",
"or",
"string",
"array",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/jsonschema/display.go#L28-L36
|
18,708
|
googleapis/gnostic
|
plugins/gnostic-go-generator/language.go
|
Prepare
|
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 = goParameterName(f.Name)
switch f.Type {
case "boolean":
f.NativeType = "bool"
case "number":
f.NativeType = "int"
case "integer":
switch f.Format {
case "int32":
f.NativeType = "int32"
case "int64":
f.NativeType = "int64"
default:
f.NativeType = "int64"
}
case "object":
f.NativeType = "interface{}"
case "string":
f.NativeType = "string"
default:
f.NativeType = strings.Title(filteredTypeName(f.Type))
}
}
}
for _, m := range model.Methods {
m.HandlerName = "Handle" + m.Name
m.ProcessorName = m.Name
m.ClientName = m.Name
}
}
|
go
|
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 = goParameterName(f.Name)
switch f.Type {
case "boolean":
f.NativeType = "bool"
case "number":
f.NativeType = "int"
case "integer":
switch f.Format {
case "int32":
f.NativeType = "int32"
case "int64":
f.NativeType = "int64"
default:
f.NativeType = "int64"
}
case "object":
f.NativeType = "interface{}"
case "string":
f.NativeType = "string"
default:
f.NativeType = strings.Title(filteredTypeName(f.Type))
}
}
}
for _, m := range model.Methods {
m.HandlerName = "Handle" + m.Name
m.ProcessorName = m.Name
m.ClientName = m.Name
}
}
|
[
"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",
")",
")",
"\n\n",
"for",
"_",
",",
"f",
":=",
"range",
"t",
".",
"Fields",
"{",
"f",
".",
"FieldName",
"=",
"goFieldName",
"(",
"f",
".",
"Name",
")",
"\n",
"f",
".",
"ParameterName",
"=",
"goParameterName",
"(",
"f",
".",
"Name",
")",
"\n",
"switch",
"f",
".",
"Type",
"{",
"case",
"\"",
"\"",
":",
"f",
".",
"NativeType",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"f",
".",
"NativeType",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"switch",
"f",
".",
"Format",
"{",
"case",
"\"",
"\"",
":",
"f",
".",
"NativeType",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"f",
".",
"NativeType",
"=",
"\"",
"\"",
"\n",
"default",
":",
"f",
".",
"NativeType",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"f",
".",
"NativeType",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"f",
".",
"NativeType",
"=",
"\"",
"\"",
"\n",
"default",
":",
"f",
".",
"NativeType",
"=",
"strings",
".",
"Title",
"(",
"filteredTypeName",
"(",
"f",
".",
"Type",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"m",
":=",
"range",
"model",
".",
"Methods",
"{",
"m",
".",
"HandlerName",
"=",
"\"",
"\"",
"+",
"m",
".",
"Name",
"\n",
"m",
".",
"ProcessorName",
"=",
"m",
".",
"Name",
"\n",
"m",
".",
"ClientName",
"=",
"m",
".",
"Name",
"\n",
"}",
"\n",
"}"
] |
// Prepare sets language-specific properties for all types and methods.
|
[
"Prepare",
"sets",
"language",
"-",
"specific",
"properties",
"for",
"all",
"types",
"and",
"methods",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/plugins/gnostic-go-generator/language.go#L31-L69
|
18,709
|
googleapis/gnostic
|
generate-gnostic/helpers.go
|
camelCaseToSnakeCase
|
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(runeValue)
}
}
return out
}
|
go
|
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(runeValue)
}
}
return out
}
|
[
"func",
"camelCaseToSnakeCase",
"(",
"input",
"string",
")",
"string",
"{",
"out",
":=",
"\"",
"\"",
"\n",
"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",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"out",
"+=",
"string",
"(",
"runeValue",
"-",
"'A'",
"+",
"'a'",
")",
"\n",
"}",
"else",
"{",
"out",
"+=",
"string",
"(",
"runeValue",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"out",
"\n",
"}"
] |
// Returns a "snake case" form of a camel-cased string.
|
[
"Returns",
"a",
"snake",
"case",
"form",
"of",
"a",
"camel",
"-",
"cased",
"string",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/generate-gnostic/helpers.go#L23-L37
|
18,710
|
googleapis/gnostic
|
compiler/reader.go
|
FetchFile
|
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)
}
}
response, err := http.Get(fileurl)
if err != nil {
return nil, err
}
if response.StatusCode != 200 {
return nil, errors.New(fmt.Sprintf("Error downloading %s: %s", fileurl, response.Status))
}
defer response.Body.Close()
bytes, err = ioutil.ReadAll(response.Body)
if fileCacheEnable && err == nil {
fileCache[fileurl] = bytes
}
return bytes, err
}
|
go
|
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)
}
}
response, err := http.Get(fileurl)
if err != nil {
return nil, err
}
if response.StatusCode != 200 {
return nil, errors.New(fmt.Sprintf("Error downloading %s: %s", fileurl, response.Status))
}
defer response.Body.Close()
bytes, err = ioutil.ReadAll(response.Body)
if fileCacheEnable && err == nil {
fileCache[fileurl] = bytes
}
return bytes, err
}
|
[
"func",
"FetchFile",
"(",
"fileurl",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"var",
"bytes",
"[",
"]",
"byte",
"\n",
"initializeFileCache",
"(",
")",
"\n",
"if",
"fileCacheEnable",
"{",
"bytes",
",",
"ok",
":=",
"fileCache",
"[",
"fileurl",
"]",
"\n",
"if",
"ok",
"{",
"if",
"verboseReader",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"fileurl",
")",
"\n",
"}",
"\n",
"return",
"bytes",
",",
"nil",
"\n",
"}",
"\n",
"if",
"verboseReader",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"fileurl",
")",
"\n",
"}",
"\n",
"}",
"\n",
"response",
",",
"err",
":=",
"http",
".",
"Get",
"(",
"fileurl",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"response",
".",
"StatusCode",
"!=",
"200",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"fileurl",
",",
"response",
".",
"Status",
")",
")",
"\n",
"}",
"\n",
"defer",
"response",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"bytes",
",",
"err",
"=",
"ioutil",
".",
"ReadAll",
"(",
"response",
".",
"Body",
")",
"\n",
"if",
"fileCacheEnable",
"&&",
"err",
"==",
"nil",
"{",
"fileCache",
"[",
"fileurl",
"]",
"=",
"bytes",
"\n",
"}",
"\n",
"return",
"bytes",
",",
"err",
"\n",
"}"
] |
// FetchFile gets a specified file from the local filesystem or a remote location.
|
[
"FetchFile",
"gets",
"a",
"specified",
"file",
"from",
"the",
"local",
"filesystem",
"or",
"a",
"remote",
"location",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/compiler/reader.go#L74-L102
|
18,711
|
googleapis/gnostic
|
compiler/reader.go
|
ReadBytesForFile
|
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.ReadFile(filename)
if err != nil {
return nil, err
}
return bytes, nil
}
|
go
|
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.ReadFile(filename)
if err != nil {
return nil, err
}
return bytes, nil
}
|
[
"func",
"ReadBytesForFile",
"(",
"filename",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"// is the filename a url?",
"fileurl",
",",
"_",
":=",
"url",
".",
"Parse",
"(",
"filename",
")",
"\n",
"if",
"fileurl",
".",
"Scheme",
"!=",
"\"",
"\"",
"{",
"// yes, fetch it",
"bytes",
",",
"err",
":=",
"FetchFile",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"bytes",
",",
"nil",
"\n",
"}",
"\n",
"// no, it's a local filename",
"bytes",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"bytes",
",",
"nil",
"\n",
"}"
] |
// ReadBytesForFile reads the bytes of a file.
|
[
"ReadBytesForFile",
"reads",
"the",
"bytes",
"of",
"a",
"file",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/compiler/reader.go#L105-L122
|
18,712
|
googleapis/gnostic
|
compiler/reader.go
|
ReadInfoFromBytes
|
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("Reading info for file %s", filename)
}
}
var info yaml.MapSlice
err := yaml.Unmarshal(bytes, &info)
if err != nil {
return nil, err
}
if infoCacheEnable && len(filename) > 0 {
infoCache[filename] = info
}
return info, nil
}
|
go
|
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("Reading info for file %s", filename)
}
}
var info yaml.MapSlice
err := yaml.Unmarshal(bytes, &info)
if err != nil {
return nil, err
}
if infoCacheEnable && len(filename) > 0 {
infoCache[filename] = info
}
return info, nil
}
|
[
"func",
"ReadInfoFromBytes",
"(",
"filename",
"string",
",",
"bytes",
"[",
"]",
"byte",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"initializeInfoCache",
"(",
")",
"\n",
"if",
"infoCacheEnable",
"{",
"cachedInfo",
",",
"ok",
":=",
"infoCache",
"[",
"filename",
"]",
"\n",
"if",
"ok",
"{",
"if",
"verboseReader",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"filename",
")",
"\n",
"}",
"\n",
"return",
"cachedInfo",
",",
"nil",
"\n",
"}",
"\n",
"if",
"verboseReader",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"filename",
")",
"\n",
"}",
"\n",
"}",
"\n",
"var",
"info",
"yaml",
".",
"MapSlice",
"\n",
"err",
":=",
"yaml",
".",
"Unmarshal",
"(",
"bytes",
",",
"&",
"info",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"infoCacheEnable",
"&&",
"len",
"(",
"filename",
")",
">",
"0",
"{",
"infoCache",
"[",
"filename",
"]",
"=",
"info",
"\n",
"}",
"\n",
"return",
"info",
",",
"nil",
"\n",
"}"
] |
// ReadInfoFromBytes unmarshals a file as a yaml.MapSlice.
|
[
"ReadInfoFromBytes",
"unmarshals",
"a",
"file",
"as",
"a",
"yaml",
".",
"MapSlice",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/compiler/reader.go#L125-L148
|
18,713
|
googleapis/gnostic
|
generate-gnostic/generate-compiler.go
|
SpecialCaseExpression
|
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
|
func (p *patternNames) SpecialCaseExpression(value, variable string) (code string, ok bool) {
fn, ok := p.specialCase[value]
if !ok {
return "", false
}
return fn(variable), ok
}
|
[
"func",
"(",
"p",
"*",
"patternNames",
")",
"SpecialCaseExpression",
"(",
"value",
",",
"variable",
"string",
")",
"(",
"code",
"string",
",",
"ok",
"bool",
")",
"{",
"fn",
",",
"ok",
":=",
"p",
".",
"specialCase",
"[",
"value",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"fn",
"(",
"variable",
")",
",",
"ok",
"\n",
"}"
] |
// SpecialCaseExpression returns true if the provided regex can be inlined as a faster
// expression.
|
[
"SpecialCaseExpression",
"returns",
"true",
"if",
"the",
"provided",
"regex",
"can",
"be",
"inlined",
"as",
"a",
"faster",
"expression",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/generate-gnostic/generate-compiler.go#L37-L43
|
18,714
|
googleapis/gnostic
|
generate-gnostic/generate-compiler.go
|
VariableName
|
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
|
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)
}
|
[
"func",
"(",
"p",
"*",
"patternNames",
")",
"VariableName",
"(",
"value",
"string",
")",
"string",
"{",
"num",
",",
"ok",
":=",
"p",
".",
"values",
"[",
"value",
"]",
"\n",
"if",
"!",
"ok",
"{",
"if",
"p",
".",
"values",
"==",
"nil",
"{",
"p",
".",
"values",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"int",
")",
"\n",
"}",
"\n",
"num",
"=",
"p",
".",
"last",
"\n",
"p",
".",
"last",
"++",
"\n",
"p",
".",
"values",
"[",
"value",
"]",
"=",
"num",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"p",
".",
"prefix",
",",
"num",
")",
"\n",
"}"
] |
// VariableName returns the variable name for the given value.
|
[
"VariableName",
"returns",
"the",
"variable",
"name",
"for",
"the",
"given",
"value",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/generate-gnostic/generate-compiler.go#L46-L57
|
18,715
|
googleapis/gnostic
|
generate-gnostic/generate-compiler.go
|
GenerateCompiler
|
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 _, filename := range imports {
code.Print("\"" + filename + "\"")
}
code.Print(")\n")
// generate a simple Version() function
code.Print("// Version returns the package name (and OpenAPI version).")
code.Print("func Version() string {")
code.Print(" return \"%s\"", packageName)
code.Print("}\n")
typeNames := domain.sortedTypeNames()
regexPatterns := &patternNames{
prefix: "pattern",
specialCase: map[string]func(string) string{
"^x-": func(variable string) string { return fmt.Sprintf("strings.HasPrefix(%s, \"x-\")", variable) },
"^/": func(variable string) string { return fmt.Sprintf("strings.HasPrefix(%s, \"/\")", variable) },
"^": func(_ string) string { return "true" },
},
}
// generate NewX() constructor functions for each type
for _, typeName := range typeNames {
domain.generateConstructorForType(code, typeName, regexPatterns)
}
// generate ResolveReferences() methods for each type
for _, typeName := range typeNames {
domain.generateResolveReferencesMethodsForType(code, typeName)
}
// generate ToRawInfo() methods for each type
for _, typeName := range typeNames {
domain.generateToRawInfoMethodForType(code, typeName)
}
domain.generateConstantVariables(code, regexPatterns)
return code.String()
}
|
go
|
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 _, filename := range imports {
code.Print("\"" + filename + "\"")
}
code.Print(")\n")
// generate a simple Version() function
code.Print("// Version returns the package name (and OpenAPI version).")
code.Print("func Version() string {")
code.Print(" return \"%s\"", packageName)
code.Print("}\n")
typeNames := domain.sortedTypeNames()
regexPatterns := &patternNames{
prefix: "pattern",
specialCase: map[string]func(string) string{
"^x-": func(variable string) string { return fmt.Sprintf("strings.HasPrefix(%s, \"x-\")", variable) },
"^/": func(variable string) string { return fmt.Sprintf("strings.HasPrefix(%s, \"/\")", variable) },
"^": func(_ string) string { return "true" },
},
}
// generate NewX() constructor functions for each type
for _, typeName := range typeNames {
domain.generateConstructorForType(code, typeName, regexPatterns)
}
// generate ResolveReferences() methods for each type
for _, typeName := range typeNames {
domain.generateResolveReferencesMethodsForType(code, typeName)
}
// generate ToRawInfo() methods for each type
for _, typeName := range typeNames {
domain.generateToRawInfoMethodForType(code, typeName)
}
domain.generateConstantVariables(code, regexPatterns)
return code.String()
}
|
[
"func",
"(",
"domain",
"*",
"Domain",
")",
"GenerateCompiler",
"(",
"packageName",
"string",
",",
"license",
"string",
",",
"imports",
"[",
"]",
"string",
")",
"string",
"{",
"code",
":=",
"&",
"printer",
".",
"Code",
"{",
"}",
"\n",
"code",
".",
"Print",
"(",
"license",
")",
"\n",
"code",
".",
"Print",
"(",
"\"",
"\\n",
"\"",
")",
"\n\n",
"// generate package declaration",
"code",
".",
"Print",
"(",
"\"",
"\\n",
"\"",
",",
"packageName",
")",
"\n\n",
"code",
".",
"Print",
"(",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"filename",
":=",
"range",
"imports",
"{",
"code",
".",
"Print",
"(",
"\"",
"\\\"",
"\"",
"+",
"filename",
"+",
"\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n",
"code",
".",
"Print",
"(",
"\"",
"\\n",
"\"",
")",
"\n\n",
"// generate a simple Version() function",
"code",
".",
"Print",
"(",
"\"",
"\"",
")",
"\n",
"code",
".",
"Print",
"(",
"\"",
"\"",
")",
"\n",
"code",
".",
"Print",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"packageName",
")",
"\n",
"code",
".",
"Print",
"(",
"\"",
"\\n",
"\"",
")",
"\n\n",
"typeNames",
":=",
"domain",
".",
"sortedTypeNames",
"(",
")",
"\n\n",
"regexPatterns",
":=",
"&",
"patternNames",
"{",
"prefix",
":",
"\"",
"\"",
",",
"specialCase",
":",
"map",
"[",
"string",
"]",
"func",
"(",
"string",
")",
"string",
"{",
"\"",
"\"",
":",
"func",
"(",
"variable",
"string",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"variable",
")",
"}",
",",
"\"",
"\"",
":",
"func",
"(",
"variable",
"string",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"variable",
")",
"}",
",",
"\"",
"\"",
":",
"func",
"(",
"_",
"string",
")",
"string",
"{",
"return",
"\"",
"\"",
"}",
",",
"}",
",",
"}",
"\n\n",
"// generate NewX() constructor functions for each type",
"for",
"_",
",",
"typeName",
":=",
"range",
"typeNames",
"{",
"domain",
".",
"generateConstructorForType",
"(",
"code",
",",
"typeName",
",",
"regexPatterns",
")",
"\n",
"}",
"\n\n",
"// generate ResolveReferences() methods for each type",
"for",
"_",
",",
"typeName",
":=",
"range",
"typeNames",
"{",
"domain",
".",
"generateResolveReferencesMethodsForType",
"(",
"code",
",",
"typeName",
")",
"\n",
"}",
"\n\n",
"// generate ToRawInfo() methods for each type",
"for",
"_",
",",
"typeName",
":=",
"range",
"typeNames",
"{",
"domain",
".",
"generateToRawInfoMethodForType",
"(",
"code",
",",
"typeName",
")",
"\n",
"}",
"\n\n",
"domain",
".",
"generateConstantVariables",
"(",
"code",
",",
"regexPatterns",
")",
"\n\n",
"return",
"code",
".",
"String",
"(",
")",
"\n",
"}"
] |
// GenerateCompiler generates the compiler code for a domain.
|
[
"GenerateCompiler",
"generates",
"the",
"compiler",
"code",
"for",
"a",
"domain",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/generate-gnostic/generate-compiler.go#L68-L117
|
18,716
|
googleapis/gnostic
|
plugins/environment.go
|
NewEnvironment
|
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", false, "Run as a gnostic plugin (other flags are ignored).")
flag.Parse()
env.RunningAsPlugin = *plugin
programName := path.Base(os.Args[0])
if (*input == "") && !*plugin {
flag.Usage = func() {
fmt.Fprintf(os.Stderr, "\n")
fmt.Fprintf(os.Stderr, programName+" is a gnostic plugin.\n")
fmt.Fprintf(os.Stderr, `
When it is run from gnostic, the -plugin option is specified and gnostic
writes a binary request to stdin and waits for a binary response on stdout.
This program can also be run standalone using the other flags listed below.
When the -plugin option is specified, these flags are ignored.`)
fmt.Fprintf(os.Stderr, "\n\nUsage:\n")
flag.PrintDefaults()
}
flag.Usage()
os.Exit(0)
}
if env.RunningAsPlugin {
// Handle invocation as a plugin.
// Read the plugin input.
pluginData, err := ioutil.ReadAll(os.Stdin)
env.RespondAndExitIfError(err)
if len(pluginData) == 0 {
env.RespondAndExitIfError(fmt.Errorf("no input data"))
}
// Deserialize the request from the input.
request := &Request{}
err = proto.Unmarshal(pluginData, request)
env.RespondAndExitIfError(err)
// Collect parameters passed to the plugin.
parameters := request.Parameters
for _, parameter := range parameters {
env.Invocation += " " + parameter.Name + "=" + parameter.Value
}
// Log the invocation.
//log.Printf("Running plugin %s", env.Invocation)
env.Request = request
} else {
// Handle invocation from the command line.
// Read the input document.
apiData, err := ioutil.ReadFile(*input)
if len(apiData) == 0 {
env.RespondAndExitIfError(fmt.Errorf("no input data"))
}
env.Request = &Request{}
env.Request.OutputPath = *output
env.Request.SourceName = path.Base(*input)
// First try to unmarshal OpenAPI v2.
documentv2 := &openapiv2.Document{}
err = proto.Unmarshal(apiData, documentv2)
if err == nil {
env.Request.AddModel("openapi.v2.Document", documentv2)
// include experimental API surface model
surfaceModel, err := surface.NewModelFromOpenAPI2(documentv2)
if err == nil {
env.Request.AddModel("surface.v1.Model", surfaceModel)
}
return env, err
}
// If that failed, ignore deserialization errors and try to unmarshal OpenAPI v3.
documentv3 := &openapiv3.Document{}
err = proto.Unmarshal(apiData, documentv3)
if err == nil {
env.Request.AddModel("openapi.v3.Document", documentv3)
// include experimental API surface model
surfaceModel, err := surface.NewModelFromOpenAPI3(documentv3)
if err == nil {
env.Request.AddModel("surface.v1.Model", surfaceModel)
}
return env, err
}
// If that failed, ignore deserialization errors and try to unmarshal a Discovery document.
discoveryDocument := &discovery.Document{}
err = proto.Unmarshal(apiData, discoveryDocument)
if err == nil {
env.Request.AddModel("discovery.v1.Document", discoveryDocument)
return env, err
}
// If we get here, we don't know what we got
err = errors.New("Unrecognized format for input")
return env, err
}
return env, err
}
|
go
|
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", false, "Run as a gnostic plugin (other flags are ignored).")
flag.Parse()
env.RunningAsPlugin = *plugin
programName := path.Base(os.Args[0])
if (*input == "") && !*plugin {
flag.Usage = func() {
fmt.Fprintf(os.Stderr, "\n")
fmt.Fprintf(os.Stderr, programName+" is a gnostic plugin.\n")
fmt.Fprintf(os.Stderr, `
When it is run from gnostic, the -plugin option is specified and gnostic
writes a binary request to stdin and waits for a binary response on stdout.
This program can also be run standalone using the other flags listed below.
When the -plugin option is specified, these flags are ignored.`)
fmt.Fprintf(os.Stderr, "\n\nUsage:\n")
flag.PrintDefaults()
}
flag.Usage()
os.Exit(0)
}
if env.RunningAsPlugin {
// Handle invocation as a plugin.
// Read the plugin input.
pluginData, err := ioutil.ReadAll(os.Stdin)
env.RespondAndExitIfError(err)
if len(pluginData) == 0 {
env.RespondAndExitIfError(fmt.Errorf("no input data"))
}
// Deserialize the request from the input.
request := &Request{}
err = proto.Unmarshal(pluginData, request)
env.RespondAndExitIfError(err)
// Collect parameters passed to the plugin.
parameters := request.Parameters
for _, parameter := range parameters {
env.Invocation += " " + parameter.Name + "=" + parameter.Value
}
// Log the invocation.
//log.Printf("Running plugin %s", env.Invocation)
env.Request = request
} else {
// Handle invocation from the command line.
// Read the input document.
apiData, err := ioutil.ReadFile(*input)
if len(apiData) == 0 {
env.RespondAndExitIfError(fmt.Errorf("no input data"))
}
env.Request = &Request{}
env.Request.OutputPath = *output
env.Request.SourceName = path.Base(*input)
// First try to unmarshal OpenAPI v2.
documentv2 := &openapiv2.Document{}
err = proto.Unmarshal(apiData, documentv2)
if err == nil {
env.Request.AddModel("openapi.v2.Document", documentv2)
// include experimental API surface model
surfaceModel, err := surface.NewModelFromOpenAPI2(documentv2)
if err == nil {
env.Request.AddModel("surface.v1.Model", surfaceModel)
}
return env, err
}
// If that failed, ignore deserialization errors and try to unmarshal OpenAPI v3.
documentv3 := &openapiv3.Document{}
err = proto.Unmarshal(apiData, documentv3)
if err == nil {
env.Request.AddModel("openapi.v3.Document", documentv3)
// include experimental API surface model
surfaceModel, err := surface.NewModelFromOpenAPI3(documentv3)
if err == nil {
env.Request.AddModel("surface.v1.Model", surfaceModel)
}
return env, err
}
// If that failed, ignore deserialization errors and try to unmarshal a Discovery document.
discoveryDocument := &discovery.Document{}
err = proto.Unmarshal(apiData, discoveryDocument)
if err == nil {
env.Request.AddModel("discovery.v1.Document", discoveryDocument)
return env, err
}
// If we get here, we don't know what we got
err = errors.New("Unrecognized format for input")
return env, err
}
return env, err
}
|
[
"func",
"NewEnvironment",
"(",
")",
"(",
"env",
"*",
"Environment",
",",
"err",
"error",
")",
"{",
"env",
"=",
"&",
"Environment",
"{",
"Invocation",
":",
"os",
".",
"Args",
"[",
"0",
"]",
",",
"Response",
":",
"&",
"Response",
"{",
"}",
",",
"}",
"\n\n",
"input",
":=",
"flag",
".",
"String",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"output",
":=",
"flag",
".",
"String",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"plugin",
":=",
"flag",
".",
"Bool",
"(",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"flag",
".",
"Parse",
"(",
")",
"\n\n",
"env",
".",
"RunningAsPlugin",
"=",
"*",
"plugin",
"\n",
"programName",
":=",
"path",
".",
"Base",
"(",
"os",
".",
"Args",
"[",
"0",
"]",
")",
"\n\n",
"if",
"(",
"*",
"input",
"==",
"\"",
"\"",
")",
"&&",
"!",
"*",
"plugin",
"{",
"flag",
".",
"Usage",
"=",
"func",
"(",
")",
"{",
"fmt",
".",
"Fprintf",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"fmt",
".",
"Fprintf",
"(",
"os",
".",
"Stderr",
",",
"programName",
"+",
"\"",
"\\n",
"\"",
")",
"\n",
"fmt",
".",
"Fprintf",
"(",
"os",
".",
"Stderr",
",",
"`\nWhen it is run from gnostic, the -plugin option is specified and gnostic\nwrites a binary request to stdin and waits for a binary response on stdout.\n\nThis program can also be run standalone using the other flags listed below.\nWhen the -plugin option is specified, these flags are ignored.`",
")",
"\n",
"fmt",
".",
"Fprintf",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\\n",
"\\n",
"\\n",
"\"",
")",
"\n",
"flag",
".",
"PrintDefaults",
"(",
")",
"\n",
"}",
"\n",
"flag",
".",
"Usage",
"(",
")",
"\n",
"os",
".",
"Exit",
"(",
"0",
")",
"\n",
"}",
"\n\n",
"if",
"env",
".",
"RunningAsPlugin",
"{",
"// Handle invocation as a plugin.",
"// Read the plugin input.",
"pluginData",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"os",
".",
"Stdin",
")",
"\n",
"env",
".",
"RespondAndExitIfError",
"(",
"err",
")",
"\n",
"if",
"len",
"(",
"pluginData",
")",
"==",
"0",
"{",
"env",
".",
"RespondAndExitIfError",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"// Deserialize the request from the input.",
"request",
":=",
"&",
"Request",
"{",
"}",
"\n",
"err",
"=",
"proto",
".",
"Unmarshal",
"(",
"pluginData",
",",
"request",
")",
"\n",
"env",
".",
"RespondAndExitIfError",
"(",
"err",
")",
"\n\n",
"// Collect parameters passed to the plugin.",
"parameters",
":=",
"request",
".",
"Parameters",
"\n",
"for",
"_",
",",
"parameter",
":=",
"range",
"parameters",
"{",
"env",
".",
"Invocation",
"+=",
"\"",
"\"",
"+",
"parameter",
".",
"Name",
"+",
"\"",
"\"",
"+",
"parameter",
".",
"Value",
"\n",
"}",
"\n\n",
"// Log the invocation.",
"//log.Printf(\"Running plugin %s\", env.Invocation)",
"env",
".",
"Request",
"=",
"request",
"\n\n",
"}",
"else",
"{",
"// Handle invocation from the command line.",
"// Read the input document.",
"apiData",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"*",
"input",
")",
"\n",
"if",
"len",
"(",
"apiData",
")",
"==",
"0",
"{",
"env",
".",
"RespondAndExitIfError",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"env",
".",
"Request",
"=",
"&",
"Request",
"{",
"}",
"\n",
"env",
".",
"Request",
".",
"OutputPath",
"=",
"*",
"output",
"\n",
"env",
".",
"Request",
".",
"SourceName",
"=",
"path",
".",
"Base",
"(",
"*",
"input",
")",
"\n\n",
"// First try to unmarshal OpenAPI v2.",
"documentv2",
":=",
"&",
"openapiv2",
".",
"Document",
"{",
"}",
"\n",
"err",
"=",
"proto",
".",
"Unmarshal",
"(",
"apiData",
",",
"documentv2",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"env",
".",
"Request",
".",
"AddModel",
"(",
"\"",
"\"",
",",
"documentv2",
")",
"\n",
"// include experimental API surface model",
"surfaceModel",
",",
"err",
":=",
"surface",
".",
"NewModelFromOpenAPI2",
"(",
"documentv2",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"env",
".",
"Request",
".",
"AddModel",
"(",
"\"",
"\"",
",",
"surfaceModel",
")",
"\n",
"}",
"\n",
"return",
"env",
",",
"err",
"\n",
"}",
"\n",
"// If that failed, ignore deserialization errors and try to unmarshal OpenAPI v3.",
"documentv3",
":=",
"&",
"openapiv3",
".",
"Document",
"{",
"}",
"\n",
"err",
"=",
"proto",
".",
"Unmarshal",
"(",
"apiData",
",",
"documentv3",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"env",
".",
"Request",
".",
"AddModel",
"(",
"\"",
"\"",
",",
"documentv3",
")",
"\n",
"// include experimental API surface model",
"surfaceModel",
",",
"err",
":=",
"surface",
".",
"NewModelFromOpenAPI3",
"(",
"documentv3",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"env",
".",
"Request",
".",
"AddModel",
"(",
"\"",
"\"",
",",
"surfaceModel",
")",
"\n",
"}",
"\n",
"return",
"env",
",",
"err",
"\n",
"}",
"\n",
"// If that failed, ignore deserialization errors and try to unmarshal a Discovery document.",
"discoveryDocument",
":=",
"&",
"discovery",
".",
"Document",
"{",
"}",
"\n",
"err",
"=",
"proto",
".",
"Unmarshal",
"(",
"apiData",
",",
"discoveryDocument",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"env",
".",
"Request",
".",
"AddModel",
"(",
"\"",
"\"",
",",
"discoveryDocument",
")",
"\n",
"return",
"env",
",",
"err",
"\n",
"}",
"\n",
"// If we get here, we don't know what we got",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"return",
"env",
",",
"err",
"\n",
"}",
"\n",
"return",
"env",
",",
"err",
"\n",
"}"
] |
// NewEnvironment creates a plugin context from arguments and standard input.
|
[
"NewEnvironment",
"creates",
"a",
"plugin",
"context",
"from",
"arguments",
"and",
"standard",
"input",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/plugins/environment.go#L31-L137
|
18,717
|
googleapis/gnostic
|
plugins/environment.go
|
RespondAndExitIfError
|
func (env *Environment) RespondAndExitIfError(err error) {
if err != nil {
env.Response.Errors = append(env.Response.Errors, err.Error())
env.RespondAndExit()
}
}
|
go
|
func (env *Environment) RespondAndExitIfError(err error) {
if err != nil {
env.Response.Errors = append(env.Response.Errors, err.Error())
env.RespondAndExit()
}
}
|
[
"func",
"(",
"env",
"*",
"Environment",
")",
"RespondAndExitIfError",
"(",
"err",
"error",
")",
"{",
"if",
"err",
"!=",
"nil",
"{",
"env",
".",
"Response",
".",
"Errors",
"=",
"append",
"(",
"env",
".",
"Response",
".",
"Errors",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"env",
".",
"RespondAndExit",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
// RespondAndExitIfError checks an error and if it is non-nil, records it and serializes and returns the response and then exits.
|
[
"RespondAndExitIfError",
"checks",
"an",
"error",
"and",
"if",
"it",
"is",
"non",
"-",
"nil",
"records",
"it",
"and",
"serializes",
"and",
"returns",
"the",
"response",
"and",
"then",
"exits",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/plugins/environment.go#L140-L145
|
18,718
|
googleapis/gnostic
|
plugins/environment.go
|
RespondAndExit
|
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
|
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)
}
|
[
"func",
"(",
"env",
"*",
"Environment",
")",
"RespondAndExit",
"(",
")",
"{",
"if",
"env",
".",
"RunningAsPlugin",
"{",
"responseBytes",
",",
"_",
":=",
"proto",
".",
"Marshal",
"(",
"env",
".",
"Response",
")",
"\n",
"os",
".",
"Stdout",
".",
"Write",
"(",
"responseBytes",
")",
"\n",
"}",
"else",
"{",
"err",
":=",
"HandleResponse",
"(",
"env",
".",
"Response",
",",
"env",
".",
"Request",
".",
"OutputPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"os",
".",
"Exit",
"(",
"0",
")",
"\n",
"}"
] |
// RespondAndExit serializes and returns the plugin response and then exits.
|
[
"RespondAndExit",
"serializes",
"and",
"returns",
"the",
"plugin",
"response",
"and",
"then",
"exits",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/plugins/environment.go#L148-L159
|
18,719
|
googleapis/gnostic
|
plugins/gnostic-go-generator/examples/googleauth/googleauth.go
|
readConfig
|
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 = json.Unmarshal(data, &cfg)
if err != nil {
return nil, err
}
var redirectURI string
if len(cfg.Web.RedirectURIs) > 0 {
redirectURI = cfg.Web.RedirectURIs[0]
} else if len(cfg.Installed.RedirectURIs) > 0 {
redirectURI = cfg.Installed.RedirectURIs[0]
} else {
return nil, errors.New("Must specify a redirect URI in config file or when creating OAuth client")
}
return &oauth2.Config{
ClientID: cfg.Installed.ClientID,
ClientSecret: cfg.Installed.ClientSecret,
Scopes: scopes,
Endpoint: oauth2.Endpoint{cfg.Installed.AuthURI, cfg.Installed.TokenURI},
RedirectURL: redirectURI,
}, nil
}
|
go
|
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 = json.Unmarshal(data, &cfg)
if err != nil {
return nil, err
}
var redirectURI string
if len(cfg.Web.RedirectURIs) > 0 {
redirectURI = cfg.Web.RedirectURIs[0]
} else if len(cfg.Installed.RedirectURIs) > 0 {
redirectURI = cfg.Installed.RedirectURIs[0]
} else {
return nil, errors.New("Must specify a redirect URI in config file or when creating OAuth client")
}
return &oauth2.Config{
ClientID: cfg.Installed.ClientID,
ClientSecret: cfg.Installed.ClientSecret,
Scopes: scopes,
Endpoint: oauth2.Endpoint{cfg.Installed.AuthURI, cfg.Installed.TokenURI},
RedirectURL: redirectURI,
}, nil
}
|
[
"func",
"readConfig",
"(",
"scopes",
"[",
"]",
"string",
")",
"(",
"*",
"oauth2",
".",
"Config",
",",
"error",
")",
"{",
"// Read the secrets file",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"*",
"clientSecretsFile",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"pwd",
",",
"_",
":=",
"os",
".",
"Getwd",
"(",
")",
"\n",
"fullPath",
":=",
"filepath",
".",
"Join",
"(",
"pwd",
",",
"*",
"clientSecretsFile",
")",
"\n",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"missingClientSecretsMessage",
",",
"fullPath",
")",
"\n",
"}",
"\n\n",
"cfg",
":=",
"new",
"(",
"Config",
")",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"redirectURI",
"string",
"\n",
"if",
"len",
"(",
"cfg",
".",
"Web",
".",
"RedirectURIs",
")",
">",
"0",
"{",
"redirectURI",
"=",
"cfg",
".",
"Web",
".",
"RedirectURIs",
"[",
"0",
"]",
"\n",
"}",
"else",
"if",
"len",
"(",
"cfg",
".",
"Installed",
".",
"RedirectURIs",
")",
">",
"0",
"{",
"redirectURI",
"=",
"cfg",
".",
"Installed",
".",
"RedirectURIs",
"[",
"0",
"]",
"\n",
"}",
"else",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"oauth2",
".",
"Config",
"{",
"ClientID",
":",
"cfg",
".",
"Installed",
".",
"ClientID",
",",
"ClientSecret",
":",
"cfg",
".",
"Installed",
".",
"ClientSecret",
",",
"Scopes",
":",
"scopes",
",",
"Endpoint",
":",
"oauth2",
".",
"Endpoint",
"{",
"cfg",
".",
"Installed",
".",
"AuthURI",
",",
"cfg",
".",
"Installed",
".",
"TokenURI",
"}",
",",
"RedirectURL",
":",
"redirectURI",
",",
"}",
",",
"nil",
"\n",
"}"
] |
// readConfig reads the configuration from clientSecretsFile.
// It returns an oauth configuration object for use with the Google API client.
|
[
"readConfig",
"reads",
"the",
"configuration",
"from",
"clientSecretsFile",
".",
"It",
"returns",
"an",
"oauth",
"configuration",
"object",
"for",
"use",
"with",
"the",
"Google",
"API",
"client",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/plugins/gnostic-go-generator/examples/googleauth/googleauth.go#L92-L123
|
18,720
|
googleapis/gnostic
|
apps/disco/openapiv2.go
|
OpenAPIv2
|
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(api.BasePath)
d.Schemes = []string{url.Scheme}
d.Consumes = []string{"application/json"}
d.Produces = []string{"application/json"}
d.Paths = &openapi2.Paths{}
d.Definitions = &openapi2.Definitions{}
if api.Schemas != nil {
for _, pair := range api.Schemas.AdditionalProperties {
addOpenAPI2SchemaForSchema(d, pair.Name, pair.Value)
}
}
if api.Methods != nil {
for _, pair := range api.Methods.AdditionalProperties {
addOpenAPI2PathsForMethod(d, pair.Name, pair.Value)
}
}
if api.Resources != nil {
for _, pair := range api.Resources.AdditionalProperties {
addOpenAPI2PathsForResource(d, pair.Name, pair.Value)
}
}
return d, nil
}
|
go
|
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(api.BasePath)
d.Schemes = []string{url.Scheme}
d.Consumes = []string{"application/json"}
d.Produces = []string{"application/json"}
d.Paths = &openapi2.Paths{}
d.Definitions = &openapi2.Definitions{}
if api.Schemas != nil {
for _, pair := range api.Schemas.AdditionalProperties {
addOpenAPI2SchemaForSchema(d, pair.Name, pair.Value)
}
}
if api.Methods != nil {
for _, pair := range api.Methods.AdditionalProperties {
addOpenAPI2PathsForMethod(d, pair.Name, pair.Value)
}
}
if api.Resources != nil {
for _, pair := range api.Resources.AdditionalProperties {
addOpenAPI2PathsForResource(d, pair.Name, pair.Value)
}
}
return d, nil
}
|
[
"func",
"OpenAPIv2",
"(",
"api",
"*",
"discovery",
".",
"Document",
")",
"(",
"*",
"openapi2",
".",
"Document",
",",
"error",
")",
"{",
"d",
":=",
"&",
"openapi2",
".",
"Document",
"{",
"}",
"\n",
"d",
".",
"Swagger",
"=",
"\"",
"\"",
"\n",
"d",
".",
"Info",
"=",
"&",
"openapi2",
".",
"Info",
"{",
"Title",
":",
"api",
".",
"Title",
",",
"Version",
":",
"api",
".",
"Version",
",",
"Description",
":",
"api",
".",
"Description",
",",
"}",
"\n",
"url",
",",
"_",
":=",
"url",
".",
"Parse",
"(",
"api",
".",
"RootUrl",
")",
"\n",
"d",
".",
"Host",
"=",
"url",
".",
"Host",
"\n",
"d",
".",
"BasePath",
"=",
"removeTrailingSlash",
"(",
"api",
".",
"BasePath",
")",
"\n",
"d",
".",
"Schemes",
"=",
"[",
"]",
"string",
"{",
"url",
".",
"Scheme",
"}",
"\n",
"d",
".",
"Consumes",
"=",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
"\n",
"d",
".",
"Produces",
"=",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
"\n",
"d",
".",
"Paths",
"=",
"&",
"openapi2",
".",
"Paths",
"{",
"}",
"\n",
"d",
".",
"Definitions",
"=",
"&",
"openapi2",
".",
"Definitions",
"{",
"}",
"\n",
"if",
"api",
".",
"Schemas",
"!=",
"nil",
"{",
"for",
"_",
",",
"pair",
":=",
"range",
"api",
".",
"Schemas",
".",
"AdditionalProperties",
"{",
"addOpenAPI2SchemaForSchema",
"(",
"d",
",",
"pair",
".",
"Name",
",",
"pair",
".",
"Value",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"api",
".",
"Methods",
"!=",
"nil",
"{",
"for",
"_",
",",
"pair",
":=",
"range",
"api",
".",
"Methods",
".",
"AdditionalProperties",
"{",
"addOpenAPI2PathsForMethod",
"(",
"d",
",",
"pair",
".",
"Name",
",",
"pair",
".",
"Value",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"api",
".",
"Resources",
"!=",
"nil",
"{",
"for",
"_",
",",
"pair",
":=",
"range",
"api",
".",
"Resources",
".",
"AdditionalProperties",
"{",
"addOpenAPI2PathsForResource",
"(",
"d",
",",
"pair",
".",
"Name",
",",
"pair",
".",
"Value",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"d",
",",
"nil",
"\n",
"}"
] |
// OpenAPIv2 returns an OpenAPI v2 representation of this Discovery document
|
[
"OpenAPIv2",
"returns",
"an",
"OpenAPI",
"v2",
"representation",
"of",
"this",
"Discovery",
"document"
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/apps/disco/openapiv2.go#L255-L287
|
18,721
|
googleapis/gnostic
|
compiler/extension-handler.go
|
HandleExtension
|
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 *(context.ExtensionHandlers) {
outFromPlugin, errFromPlugin = customAnyProtoGenerator.handle(in, extensionName)
if outFromPlugin == nil {
continue
} else {
handled = true
break
}
}
}
return handled, outFromPlugin, errFromPlugin
}
|
go
|
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 *(context.ExtensionHandlers) {
outFromPlugin, errFromPlugin = customAnyProtoGenerator.handle(in, extensionName)
if outFromPlugin == nil {
continue
} else {
handled = true
break
}
}
}
return handled, outFromPlugin, errFromPlugin
}
|
[
"func",
"HandleExtension",
"(",
"context",
"*",
"Context",
",",
"in",
"interface",
"{",
"}",
",",
"extensionName",
"string",
")",
"(",
"bool",
",",
"*",
"any",
".",
"Any",
",",
"error",
")",
"{",
"handled",
":=",
"false",
"\n",
"var",
"errFromPlugin",
"error",
"\n",
"var",
"outFromPlugin",
"*",
"any",
".",
"Any",
"\n\n",
"if",
"context",
"!=",
"nil",
"&&",
"context",
".",
"ExtensionHandlers",
"!=",
"nil",
"&&",
"len",
"(",
"*",
"(",
"context",
".",
"ExtensionHandlers",
")",
")",
"!=",
"0",
"{",
"for",
"_",
",",
"customAnyProtoGenerator",
":=",
"range",
"*",
"(",
"context",
".",
"ExtensionHandlers",
")",
"{",
"outFromPlugin",
",",
"errFromPlugin",
"=",
"customAnyProtoGenerator",
".",
"handle",
"(",
"in",
",",
"extensionName",
")",
"\n",
"if",
"outFromPlugin",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"else",
"{",
"handled",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"handled",
",",
"outFromPlugin",
",",
"errFromPlugin",
"\n",
"}"
] |
// HandleExtension calls a binary extension handler.
|
[
"HandleExtension",
"calls",
"a",
"binary",
"extension",
"handler",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/compiler/extension-handler.go#L38-L55
|
18,722
|
googleapis/gnostic
|
apps/disco/openapiv3.go
|
OpenAPIv3
|
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.Host
basePath := api.BasePath
if basePath == "" {
basePath = "/"
}
d.Servers = append(d.Servers, &openapi3.Server{Url: "https://" + host + basePath})
hasDataWrapper := false
for _, feature := range api.Features {
if feature == "dataWrapper" {
hasDataWrapper = true
}
}
d.Components = &openapi3.Components{}
d.Components.Schemas = &openapi3.SchemasOrReferences{}
for _, pair := range api.Schemas.AdditionalProperties {
addOpenAPI3SchemaForSchema(d, pair.Name, pair.Value)
}
d.Paths = &openapi3.Paths{}
if api.Methods != nil {
for _, pair := range api.Methods.AdditionalProperties {
addOpenAPI3PathsForMethod(d, pair.Name, pair.Value, hasDataWrapper)
}
}
for _, pair := range api.Resources.AdditionalProperties {
addOpenAPI3PathsForResource(d, pair.Value, hasDataWrapper)
}
return d, nil
}
|
go
|
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.Host
basePath := api.BasePath
if basePath == "" {
basePath = "/"
}
d.Servers = append(d.Servers, &openapi3.Server{Url: "https://" + host + basePath})
hasDataWrapper := false
for _, feature := range api.Features {
if feature == "dataWrapper" {
hasDataWrapper = true
}
}
d.Components = &openapi3.Components{}
d.Components.Schemas = &openapi3.SchemasOrReferences{}
for _, pair := range api.Schemas.AdditionalProperties {
addOpenAPI3SchemaForSchema(d, pair.Name, pair.Value)
}
d.Paths = &openapi3.Paths{}
if api.Methods != nil {
for _, pair := range api.Methods.AdditionalProperties {
addOpenAPI3PathsForMethod(d, pair.Name, pair.Value, hasDataWrapper)
}
}
for _, pair := range api.Resources.AdditionalProperties {
addOpenAPI3PathsForResource(d, pair.Value, hasDataWrapper)
}
return d, nil
}
|
[
"func",
"OpenAPIv3",
"(",
"api",
"*",
"discovery",
".",
"Document",
")",
"(",
"*",
"openapi3",
".",
"Document",
",",
"error",
")",
"{",
"d",
":=",
"&",
"openapi3",
".",
"Document",
"{",
"}",
"\n",
"d",
".",
"Openapi",
"=",
"\"",
"\"",
"\n",
"d",
".",
"Info",
"=",
"&",
"openapi3",
".",
"Info",
"{",
"Title",
":",
"api",
".",
"Title",
",",
"Version",
":",
"api",
".",
"Version",
",",
"Description",
":",
"api",
".",
"Description",
",",
"}",
"\n",
"d",
".",
"Servers",
"=",
"make",
"(",
"[",
"]",
"*",
"openapi3",
".",
"Server",
",",
"0",
")",
"\n\n",
"url",
",",
"_",
":=",
"url",
".",
"Parse",
"(",
"api",
".",
"RootUrl",
")",
"\n",
"host",
":=",
"url",
".",
"Host",
"\n",
"basePath",
":=",
"api",
".",
"BasePath",
"\n",
"if",
"basePath",
"==",
"\"",
"\"",
"{",
"basePath",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"d",
".",
"Servers",
"=",
"append",
"(",
"d",
".",
"Servers",
",",
"&",
"openapi3",
".",
"Server",
"{",
"Url",
":",
"\"",
"\"",
"+",
"host",
"+",
"basePath",
"}",
")",
"\n\n",
"hasDataWrapper",
":=",
"false",
"\n",
"for",
"_",
",",
"feature",
":=",
"range",
"api",
".",
"Features",
"{",
"if",
"feature",
"==",
"\"",
"\"",
"{",
"hasDataWrapper",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"d",
".",
"Components",
"=",
"&",
"openapi3",
".",
"Components",
"{",
"}",
"\n",
"d",
".",
"Components",
".",
"Schemas",
"=",
"&",
"openapi3",
".",
"SchemasOrReferences",
"{",
"}",
"\n",
"for",
"_",
",",
"pair",
":=",
"range",
"api",
".",
"Schemas",
".",
"AdditionalProperties",
"{",
"addOpenAPI3SchemaForSchema",
"(",
"d",
",",
"pair",
".",
"Name",
",",
"pair",
".",
"Value",
")",
"\n",
"}",
"\n\n",
"d",
".",
"Paths",
"=",
"&",
"openapi3",
".",
"Paths",
"{",
"}",
"\n",
"if",
"api",
".",
"Methods",
"!=",
"nil",
"{",
"for",
"_",
",",
"pair",
":=",
"range",
"api",
".",
"Methods",
".",
"AdditionalProperties",
"{",
"addOpenAPI3PathsForMethod",
"(",
"d",
",",
"pair",
".",
"Name",
",",
"pair",
".",
"Value",
",",
"hasDataWrapper",
")",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"pair",
":=",
"range",
"api",
".",
"Resources",
".",
"AdditionalProperties",
"{",
"addOpenAPI3PathsForResource",
"(",
"d",
",",
"pair",
".",
"Value",
",",
"hasDataWrapper",
")",
"\n",
"}",
"\n\n",
"return",
"d",
",",
"nil",
"\n",
"}"
] |
// OpenAPIv3 returns an OpenAPI v3 representation of a Discovery document
|
[
"OpenAPIv3",
"returns",
"an",
"OpenAPI",
"v3",
"representation",
"of",
"a",
"Discovery",
"document"
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/apps/disco/openapiv3.go#L261-L303
|
18,723
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
NewAdditionalPropertiesItem
|
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 have the right subtype
t, matchingError := NewSchema(m, compiler.NewContext("schema", context))
if matchingError == nil {
x.Oneof = &AdditionalPropertiesItem_Schema{Schema: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
// bool boolean = 2;
boolValue, ok := in.(bool)
if ok {
x.Oneof = &AdditionalPropertiesItem_Boolean{Boolean: boolValue}
}
if matched {
// since the oneof matched one of its possibilities, discard any matching errors
errors = make([]error, 0)
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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 have the right subtype
t, matchingError := NewSchema(m, compiler.NewContext("schema", context))
if matchingError == nil {
x.Oneof = &AdditionalPropertiesItem_Schema{Schema: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
// bool boolean = 2;
boolValue, ok := in.(bool)
if ok {
x.Oneof = &AdditionalPropertiesItem_Boolean{Boolean: boolValue}
}
if matched {
// since the oneof matched one of its possibilities, discard any matching errors
errors = make([]error, 0)
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"NewAdditionalPropertiesItem",
"(",
"in",
"interface",
"{",
"}",
",",
"context",
"*",
"compiler",
".",
"Context",
")",
"(",
"*",
"AdditionalPropertiesItem",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"x",
":=",
"&",
"AdditionalPropertiesItem",
"{",
"}",
"\n",
"matched",
":=",
"false",
"\n",
"// Schema schema = 1;",
"{",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"ok",
"{",
"// errors might be ok here, they mean we just don't have the right subtype",
"t",
",",
"matchingError",
":=",
"NewSchema",
"(",
"m",
",",
"compiler",
".",
"NewContext",
"(",
"\"",
"\"",
",",
"context",
")",
")",
"\n",
"if",
"matchingError",
"==",
"nil",
"{",
"x",
".",
"Oneof",
"=",
"&",
"AdditionalPropertiesItem_Schema",
"{",
"Schema",
":",
"t",
"}",
"\n",
"matched",
"=",
"true",
"\n",
"}",
"else",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"matchingError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"// bool boolean = 2;",
"boolValue",
",",
"ok",
":=",
"in",
".",
"(",
"bool",
")",
"\n",
"if",
"ok",
"{",
"x",
".",
"Oneof",
"=",
"&",
"AdditionalPropertiesItem_Boolean",
"{",
"Boolean",
":",
"boolValue",
"}",
"\n",
"}",
"\n",
"if",
"matched",
"{",
"// since the oneof matched one of its possibilities, discard any matching errors",
"errors",
"=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"}",
"\n",
"return",
"x",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// NewAdditionalPropertiesItem creates an object of type AdditionalPropertiesItem if possible, returning an error if not.
|
[
"NewAdditionalPropertiesItem",
"creates",
"an",
"object",
"of",
"type",
"AdditionalPropertiesItem",
"if",
"possible",
"returning",
"an",
"error",
"if",
"not",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L33-L61
|
18,724
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
NewHeaders
|
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 NamedHeader additional_properties = 1;
// MAP: Header
x.AdditionalProperties = make([]*NamedHeader, 0)
for _, item := range m {
k, ok := compiler.StringValue(item.Key)
if ok {
v := item.Value
pair := &NamedHeader{}
pair.Name = k
var err error
pair.Value, err = NewHeader(v, compiler.NewContext(k, context))
if err != nil {
errors = append(errors, err)
}
x.AdditionalProperties = append(x.AdditionalProperties, pair)
}
}
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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 NamedHeader additional_properties = 1;
// MAP: Header
x.AdditionalProperties = make([]*NamedHeader, 0)
for _, item := range m {
k, ok := compiler.StringValue(item.Key)
if ok {
v := item.Value
pair := &NamedHeader{}
pair.Name = k
var err error
pair.Value, err = NewHeader(v, compiler.NewContext(k, context))
if err != nil {
errors = append(errors, err)
}
x.AdditionalProperties = append(x.AdditionalProperties, pair)
}
}
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"NewHeaders",
"(",
"in",
"interface",
"{",
"}",
",",
"context",
"*",
"compiler",
".",
"Context",
")",
"(",
"*",
"Headers",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"x",
":=",
"&",
"Headers",
"{",
"}",
"\n",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"!",
"ok",
"{",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"in",
",",
"in",
")",
"\n",
"errors",
"=",
"append",
"(",
"errors",
",",
"compiler",
".",
"NewError",
"(",
"context",
",",
"message",
")",
")",
"\n",
"}",
"else",
"{",
"// repeated NamedHeader additional_properties = 1;",
"// MAP: Header",
"x",
".",
"AdditionalProperties",
"=",
"make",
"(",
"[",
"]",
"*",
"NamedHeader",
",",
"0",
")",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"m",
"{",
"k",
",",
"ok",
":=",
"compiler",
".",
"StringValue",
"(",
"item",
".",
"Key",
")",
"\n",
"if",
"ok",
"{",
"v",
":=",
"item",
".",
"Value",
"\n",
"pair",
":=",
"&",
"NamedHeader",
"{",
"}",
"\n",
"pair",
".",
"Name",
"=",
"k",
"\n",
"var",
"err",
"error",
"\n",
"pair",
".",
"Value",
",",
"err",
"=",
"NewHeader",
"(",
"v",
",",
"compiler",
".",
"NewContext",
"(",
"k",
",",
"context",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"x",
".",
"AdditionalProperties",
"=",
"append",
"(",
"x",
".",
"AdditionalProperties",
",",
"pair",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"x",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// NewHeaders creates an object of type Headers if possible, returning an error if not.
|
[
"NewHeaders",
"creates",
"an",
"object",
"of",
"type",
"Headers",
"if",
"possible",
"returning",
"an",
"error",
"if",
"not",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L1931-L1958
|
18,725
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
NewItemsItem
|
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))
} else {
x.Schema = make([]*Schema, 0)
y, err := NewSchema(m, compiler.NewContext("<array>", context))
if err != nil {
return nil, err
}
x.Schema = append(x.Schema, y)
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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))
} else {
x.Schema = make([]*Schema, 0)
y, err := NewSchema(m, compiler.NewContext("<array>", context))
if err != nil {
return nil, err
}
x.Schema = append(x.Schema, y)
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"NewItemsItem",
"(",
"in",
"interface",
"{",
"}",
",",
"context",
"*",
"compiler",
".",
"Context",
")",
"(",
"*",
"ItemsItem",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"x",
":=",
"&",
"ItemsItem",
"{",
"}",
"\n",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"!",
"ok",
"{",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"in",
",",
"in",
")",
"\n",
"errors",
"=",
"append",
"(",
"errors",
",",
"compiler",
".",
"NewError",
"(",
"context",
",",
"message",
")",
")",
"\n",
"}",
"else",
"{",
"x",
".",
"Schema",
"=",
"make",
"(",
"[",
"]",
"*",
"Schema",
",",
"0",
")",
"\n",
"y",
",",
"err",
":=",
"NewSchema",
"(",
"m",
",",
"compiler",
".",
"NewContext",
"(",
"\"",
"\"",
",",
"context",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"x",
".",
"Schema",
"=",
"append",
"(",
"x",
".",
"Schema",
",",
"y",
")",
"\n",
"}",
"\n",
"return",
"x",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// NewItemsItem creates an object of type ItemsItem if possible, returning an error if not.
|
[
"NewItemsItem",
"creates",
"an",
"object",
"of",
"type",
"ItemsItem",
"if",
"possible",
"returning",
"an",
"error",
"if",
"not",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L2072-L2088
|
18,726
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
NewJsonReference
|
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))
} else {
requiredKeys := []string{"$ref"}
missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
if len(missingKeys) > 0 {
message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
errors = append(errors, compiler.NewError(context, message))
}
allowedKeys := []string{"$ref", "description"}
var allowedPatterns []*regexp.Regexp
invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
if len(invalidKeys) > 0 {
message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
errors = append(errors, compiler.NewError(context, message))
}
// string _ref = 1;
v1 := compiler.MapValueForKey(m, "$ref")
if v1 != nil {
x.XRef, ok = v1.(string)
if !ok {
message := fmt.Sprintf("has unexpected value for $ref: %+v (%T)", v1, v1)
errors = append(errors, compiler.NewError(context, message))
}
}
// string description = 2;
v2 := compiler.MapValueForKey(m, "description")
if v2 != nil {
x.Description, ok = v2.(string)
if !ok {
message := fmt.Sprintf("has unexpected value for description: %+v (%T)", v2, v2)
errors = append(errors, compiler.NewError(context, message))
}
}
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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))
} else {
requiredKeys := []string{"$ref"}
missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
if len(missingKeys) > 0 {
message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
errors = append(errors, compiler.NewError(context, message))
}
allowedKeys := []string{"$ref", "description"}
var allowedPatterns []*regexp.Regexp
invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
if len(invalidKeys) > 0 {
message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
errors = append(errors, compiler.NewError(context, message))
}
// string _ref = 1;
v1 := compiler.MapValueForKey(m, "$ref")
if v1 != nil {
x.XRef, ok = v1.(string)
if !ok {
message := fmt.Sprintf("has unexpected value for $ref: %+v (%T)", v1, v1)
errors = append(errors, compiler.NewError(context, message))
}
}
// string description = 2;
v2 := compiler.MapValueForKey(m, "description")
if v2 != nil {
x.Description, ok = v2.(string)
if !ok {
message := fmt.Sprintf("has unexpected value for description: %+v (%T)", v2, v2)
errors = append(errors, compiler.NewError(context, message))
}
}
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"NewJsonReference",
"(",
"in",
"interface",
"{",
"}",
",",
"context",
"*",
"compiler",
".",
"Context",
")",
"(",
"*",
"JsonReference",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"x",
":=",
"&",
"JsonReference",
"{",
"}",
"\n",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"!",
"ok",
"{",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"in",
",",
"in",
")",
"\n",
"errors",
"=",
"append",
"(",
"errors",
",",
"compiler",
".",
"NewError",
"(",
"context",
",",
"message",
")",
")",
"\n",
"}",
"else",
"{",
"requiredKeys",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
"\n",
"missingKeys",
":=",
"compiler",
".",
"MissingKeysInMap",
"(",
"m",
",",
"requiredKeys",
")",
"\n",
"if",
"len",
"(",
"missingKeys",
")",
">",
"0",
"{",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"compiler",
".",
"PluralProperties",
"(",
"len",
"(",
"missingKeys",
")",
")",
",",
"strings",
".",
"Join",
"(",
"missingKeys",
",",
"\"",
"\"",
")",
")",
"\n",
"errors",
"=",
"append",
"(",
"errors",
",",
"compiler",
".",
"NewError",
"(",
"context",
",",
"message",
")",
")",
"\n",
"}",
"\n",
"allowedKeys",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"\n",
"var",
"allowedPatterns",
"[",
"]",
"*",
"regexp",
".",
"Regexp",
"\n",
"invalidKeys",
":=",
"compiler",
".",
"InvalidKeysInMap",
"(",
"m",
",",
"allowedKeys",
",",
"allowedPatterns",
")",
"\n",
"if",
"len",
"(",
"invalidKeys",
")",
">",
"0",
"{",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"compiler",
".",
"PluralProperties",
"(",
"len",
"(",
"invalidKeys",
")",
")",
",",
"strings",
".",
"Join",
"(",
"invalidKeys",
",",
"\"",
"\"",
")",
")",
"\n",
"errors",
"=",
"append",
"(",
"errors",
",",
"compiler",
".",
"NewError",
"(",
"context",
",",
"message",
")",
")",
"\n",
"}",
"\n",
"// string _ref = 1;",
"v1",
":=",
"compiler",
".",
"MapValueForKey",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"if",
"v1",
"!=",
"nil",
"{",
"x",
".",
"XRef",
",",
"ok",
"=",
"v1",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v1",
",",
"v1",
")",
"\n",
"errors",
"=",
"append",
"(",
"errors",
",",
"compiler",
".",
"NewError",
"(",
"context",
",",
"message",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"// string description = 2;",
"v2",
":=",
"compiler",
".",
"MapValueForKey",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"if",
"v2",
"!=",
"nil",
"{",
"x",
".",
"Description",
",",
"ok",
"=",
"v2",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v2",
",",
"v2",
")",
"\n",
"errors",
"=",
"append",
"(",
"errors",
",",
"compiler",
".",
"NewError",
"(",
"context",
",",
"message",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"x",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// NewJsonReference creates an object of type JsonReference if possible, returning an error if not.
|
[
"NewJsonReference",
"creates",
"an",
"object",
"of",
"type",
"JsonReference",
"if",
"possible",
"returning",
"an",
"error",
"if",
"not",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L2091-L2132
|
18,727
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
NewNonBodyParameter
|
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.NewError(context, message))
} else {
requiredKeys := []string{"in", "name", "type"}
missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
if len(missingKeys) > 0 {
message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
errors = append(errors, compiler.NewError(context, message))
}
// HeaderParameterSubSchema header_parameter_sub_schema = 1;
{
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewHeaderParameterSubSchema(m, compiler.NewContext("headerParameterSubSchema", context))
if matchingError == nil {
x.Oneof = &NonBodyParameter_HeaderParameterSubSchema{HeaderParameterSubSchema: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
// FormDataParameterSubSchema form_data_parameter_sub_schema = 2;
{
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewFormDataParameterSubSchema(m, compiler.NewContext("formDataParameterSubSchema", context))
if matchingError == nil {
x.Oneof = &NonBodyParameter_FormDataParameterSubSchema{FormDataParameterSubSchema: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
// QueryParameterSubSchema query_parameter_sub_schema = 3;
{
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewQueryParameterSubSchema(m, compiler.NewContext("queryParameterSubSchema", context))
if matchingError == nil {
x.Oneof = &NonBodyParameter_QueryParameterSubSchema{QueryParameterSubSchema: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
// PathParameterSubSchema path_parameter_sub_schema = 4;
{
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewPathParameterSubSchema(m, compiler.NewContext("pathParameterSubSchema", context))
if matchingError == nil {
x.Oneof = &NonBodyParameter_PathParameterSubSchema{PathParameterSubSchema: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
if matched {
// since the oneof matched one of its possibilities, discard any matching errors
errors = make([]error, 0)
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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.NewError(context, message))
} else {
requiredKeys := []string{"in", "name", "type"}
missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
if len(missingKeys) > 0 {
message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
errors = append(errors, compiler.NewError(context, message))
}
// HeaderParameterSubSchema header_parameter_sub_schema = 1;
{
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewHeaderParameterSubSchema(m, compiler.NewContext("headerParameterSubSchema", context))
if matchingError == nil {
x.Oneof = &NonBodyParameter_HeaderParameterSubSchema{HeaderParameterSubSchema: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
// FormDataParameterSubSchema form_data_parameter_sub_schema = 2;
{
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewFormDataParameterSubSchema(m, compiler.NewContext("formDataParameterSubSchema", context))
if matchingError == nil {
x.Oneof = &NonBodyParameter_FormDataParameterSubSchema{FormDataParameterSubSchema: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
// QueryParameterSubSchema query_parameter_sub_schema = 3;
{
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewQueryParameterSubSchema(m, compiler.NewContext("queryParameterSubSchema", context))
if matchingError == nil {
x.Oneof = &NonBodyParameter_QueryParameterSubSchema{QueryParameterSubSchema: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
// PathParameterSubSchema path_parameter_sub_schema = 4;
{
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewPathParameterSubSchema(m, compiler.NewContext("pathParameterSubSchema", context))
if matchingError == nil {
x.Oneof = &NonBodyParameter_PathParameterSubSchema{PathParameterSubSchema: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
if matched {
// since the oneof matched one of its possibilities, discard any matching errors
errors = make([]error, 0)
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"NewNonBodyParameter",
"(",
"in",
"interface",
"{",
"}",
",",
"context",
"*",
"compiler",
".",
"Context",
")",
"(",
"*",
"NonBodyParameter",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"x",
":=",
"&",
"NonBodyParameter",
"{",
"}",
"\n",
"matched",
":=",
"false",
"\n",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"!",
"ok",
"{",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"in",
",",
"in",
")",
"\n",
"errors",
"=",
"append",
"(",
"errors",
",",
"compiler",
".",
"NewError",
"(",
"context",
",",
"message",
")",
")",
"\n",
"}",
"else",
"{",
"requiredKeys",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"\n",
"missingKeys",
":=",
"compiler",
".",
"MissingKeysInMap",
"(",
"m",
",",
"requiredKeys",
")",
"\n",
"if",
"len",
"(",
"missingKeys",
")",
">",
"0",
"{",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"compiler",
".",
"PluralProperties",
"(",
"len",
"(",
"missingKeys",
")",
")",
",",
"strings",
".",
"Join",
"(",
"missingKeys",
",",
"\"",
"\"",
")",
")",
"\n",
"errors",
"=",
"append",
"(",
"errors",
",",
"compiler",
".",
"NewError",
"(",
"context",
",",
"message",
")",
")",
"\n",
"}",
"\n",
"// HeaderParameterSubSchema header_parameter_sub_schema = 1;",
"{",
"// errors might be ok here, they mean we just don't have the right subtype",
"t",
",",
"matchingError",
":=",
"NewHeaderParameterSubSchema",
"(",
"m",
",",
"compiler",
".",
"NewContext",
"(",
"\"",
"\"",
",",
"context",
")",
")",
"\n",
"if",
"matchingError",
"==",
"nil",
"{",
"x",
".",
"Oneof",
"=",
"&",
"NonBodyParameter_HeaderParameterSubSchema",
"{",
"HeaderParameterSubSchema",
":",
"t",
"}",
"\n",
"matched",
"=",
"true",
"\n",
"}",
"else",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"matchingError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"// FormDataParameterSubSchema form_data_parameter_sub_schema = 2;",
"{",
"// errors might be ok here, they mean we just don't have the right subtype",
"t",
",",
"matchingError",
":=",
"NewFormDataParameterSubSchema",
"(",
"m",
",",
"compiler",
".",
"NewContext",
"(",
"\"",
"\"",
",",
"context",
")",
")",
"\n",
"if",
"matchingError",
"==",
"nil",
"{",
"x",
".",
"Oneof",
"=",
"&",
"NonBodyParameter_FormDataParameterSubSchema",
"{",
"FormDataParameterSubSchema",
":",
"t",
"}",
"\n",
"matched",
"=",
"true",
"\n",
"}",
"else",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"matchingError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"// QueryParameterSubSchema query_parameter_sub_schema = 3;",
"{",
"// errors might be ok here, they mean we just don't have the right subtype",
"t",
",",
"matchingError",
":=",
"NewQueryParameterSubSchema",
"(",
"m",
",",
"compiler",
".",
"NewContext",
"(",
"\"",
"\"",
",",
"context",
")",
")",
"\n",
"if",
"matchingError",
"==",
"nil",
"{",
"x",
".",
"Oneof",
"=",
"&",
"NonBodyParameter_QueryParameterSubSchema",
"{",
"QueryParameterSubSchema",
":",
"t",
"}",
"\n",
"matched",
"=",
"true",
"\n",
"}",
"else",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"matchingError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"// PathParameterSubSchema path_parameter_sub_schema = 4;",
"{",
"// errors might be ok here, they mean we just don't have the right subtype",
"t",
",",
"matchingError",
":=",
"NewPathParameterSubSchema",
"(",
"m",
",",
"compiler",
".",
"NewContext",
"(",
"\"",
"\"",
",",
"context",
")",
")",
"\n",
"if",
"matchingError",
"==",
"nil",
"{",
"x",
".",
"Oneof",
"=",
"&",
"NonBodyParameter_PathParameterSubSchema",
"{",
"PathParameterSubSchema",
":",
"t",
"}",
"\n",
"matched",
"=",
"true",
"\n",
"}",
"else",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"matchingError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"matched",
"{",
"// since the oneof matched one of its possibilities, discard any matching errors",
"errors",
"=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"}",
"\n",
"return",
"x",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// NewNonBodyParameter creates an object of type NonBodyParameter if possible, returning an error if not.
|
[
"NewNonBodyParameter",
"creates",
"an",
"object",
"of",
"type",
"NonBodyParameter",
"if",
"possible",
"returning",
"an",
"error",
"if",
"not",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L2590-L2655
|
18,728
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
NewOauth2Scopes
|
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 {
// repeated NamedString additional_properties = 1;
// MAP: string
x.AdditionalProperties = make([]*NamedString, 0)
for _, item := range m {
k, ok := compiler.StringValue(item.Key)
if ok {
v := item.Value
pair := &NamedString{}
pair.Name = k
pair.Value = v.(string)
x.AdditionalProperties = append(x.AdditionalProperties, pair)
}
}
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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 {
// repeated NamedString additional_properties = 1;
// MAP: string
x.AdditionalProperties = make([]*NamedString, 0)
for _, item := range m {
k, ok := compiler.StringValue(item.Key)
if ok {
v := item.Value
pair := &NamedString{}
pair.Name = k
pair.Value = v.(string)
x.AdditionalProperties = append(x.AdditionalProperties, pair)
}
}
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"NewOauth2Scopes",
"(",
"in",
"interface",
"{",
"}",
",",
"context",
"*",
"compiler",
".",
"Context",
")",
"(",
"*",
"Oauth2Scopes",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"x",
":=",
"&",
"Oauth2Scopes",
"{",
"}",
"\n",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"!",
"ok",
"{",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"in",
",",
"in",
")",
"\n",
"errors",
"=",
"append",
"(",
"errors",
",",
"compiler",
".",
"NewError",
"(",
"context",
",",
"message",
")",
")",
"\n",
"}",
"else",
"{",
"// repeated NamedString additional_properties = 1;",
"// MAP: string",
"x",
".",
"AdditionalProperties",
"=",
"make",
"(",
"[",
"]",
"*",
"NamedString",
",",
"0",
")",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"m",
"{",
"k",
",",
"ok",
":=",
"compiler",
".",
"StringValue",
"(",
"item",
".",
"Key",
")",
"\n",
"if",
"ok",
"{",
"v",
":=",
"item",
".",
"Value",
"\n",
"pair",
":=",
"&",
"NamedString",
"{",
"}",
"\n",
"pair",
".",
"Name",
"=",
"k",
"\n",
"pair",
".",
"Value",
"=",
"v",
".",
"(",
"string",
")",
"\n",
"x",
".",
"AdditionalProperties",
"=",
"append",
"(",
"x",
".",
"AdditionalProperties",
",",
"pair",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"x",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// NewOauth2Scopes creates an object of type Oauth2Scopes if possible, returning an error if not.
|
[
"NewOauth2Scopes",
"creates",
"an",
"object",
"of",
"type",
"Oauth2Scopes",
"if",
"possible",
"returning",
"an",
"error",
"if",
"not",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L3123-L3146
|
18,729
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
NewParameterDefinitions
|
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(context, message))
} else {
// repeated NamedParameter additional_properties = 1;
// MAP: Parameter
x.AdditionalProperties = make([]*NamedParameter, 0)
for _, item := range m {
k, ok := compiler.StringValue(item.Key)
if ok {
v := item.Value
pair := &NamedParameter{}
pair.Name = k
var err error
pair.Value, err = NewParameter(v, compiler.NewContext(k, context))
if err != nil {
errors = append(errors, err)
}
x.AdditionalProperties = append(x.AdditionalProperties, pair)
}
}
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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(context, message))
} else {
// repeated NamedParameter additional_properties = 1;
// MAP: Parameter
x.AdditionalProperties = make([]*NamedParameter, 0)
for _, item := range m {
k, ok := compiler.StringValue(item.Key)
if ok {
v := item.Value
pair := &NamedParameter{}
pair.Name = k
var err error
pair.Value, err = NewParameter(v, compiler.NewContext(k, context))
if err != nil {
errors = append(errors, err)
}
x.AdditionalProperties = append(x.AdditionalProperties, pair)
}
}
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"NewParameterDefinitions",
"(",
"in",
"interface",
"{",
"}",
",",
"context",
"*",
"compiler",
".",
"Context",
")",
"(",
"*",
"ParameterDefinitions",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"x",
":=",
"&",
"ParameterDefinitions",
"{",
"}",
"\n",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"!",
"ok",
"{",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"in",
",",
"in",
")",
"\n",
"errors",
"=",
"append",
"(",
"errors",
",",
"compiler",
".",
"NewError",
"(",
"context",
",",
"message",
")",
")",
"\n",
"}",
"else",
"{",
"// repeated NamedParameter additional_properties = 1;",
"// MAP: Parameter",
"x",
".",
"AdditionalProperties",
"=",
"make",
"(",
"[",
"]",
"*",
"NamedParameter",
",",
"0",
")",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"m",
"{",
"k",
",",
"ok",
":=",
"compiler",
".",
"StringValue",
"(",
"item",
".",
"Key",
")",
"\n",
"if",
"ok",
"{",
"v",
":=",
"item",
".",
"Value",
"\n",
"pair",
":=",
"&",
"NamedParameter",
"{",
"}",
"\n",
"pair",
".",
"Name",
"=",
"k",
"\n",
"var",
"err",
"error",
"\n",
"pair",
".",
"Value",
",",
"err",
"=",
"NewParameter",
"(",
"v",
",",
"compiler",
".",
"NewContext",
"(",
"k",
",",
"context",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"x",
".",
"AdditionalProperties",
"=",
"append",
"(",
"x",
".",
"AdditionalProperties",
",",
"pair",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"x",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// NewParameterDefinitions creates an object of type ParameterDefinitions if possible, returning an error if not.
|
[
"NewParameterDefinitions",
"creates",
"an",
"object",
"of",
"type",
"ParameterDefinitions",
"if",
"possible",
"returning",
"an",
"error",
"if",
"not",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L3382-L3409
|
18,730
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
NewParametersItem
|
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
t, matchingError := NewParameter(m, compiler.NewContext("parameter", context))
if matchingError == nil {
x.Oneof = &ParametersItem_Parameter{Parameter: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
// JsonReference json_reference = 2;
{
m, ok := compiler.UnpackMap(in)
if ok {
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewJsonReference(m, compiler.NewContext("jsonReference", context))
if matchingError == nil {
x.Oneof = &ParametersItem_JsonReference{JsonReference: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
if matched {
// since the oneof matched one of its possibilities, discard any matching errors
errors = make([]error, 0)
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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
t, matchingError := NewParameter(m, compiler.NewContext("parameter", context))
if matchingError == nil {
x.Oneof = &ParametersItem_Parameter{Parameter: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
// JsonReference json_reference = 2;
{
m, ok := compiler.UnpackMap(in)
if ok {
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewJsonReference(m, compiler.NewContext("jsonReference", context))
if matchingError == nil {
x.Oneof = &ParametersItem_JsonReference{JsonReference: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
if matched {
// since the oneof matched one of its possibilities, discard any matching errors
errors = make([]error, 0)
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"NewParametersItem",
"(",
"in",
"interface",
"{",
"}",
",",
"context",
"*",
"compiler",
".",
"Context",
")",
"(",
"*",
"ParametersItem",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"x",
":=",
"&",
"ParametersItem",
"{",
"}",
"\n",
"matched",
":=",
"false",
"\n",
"// Parameter parameter = 1;",
"{",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"ok",
"{",
"// errors might be ok here, they mean we just don't have the right subtype",
"t",
",",
"matchingError",
":=",
"NewParameter",
"(",
"m",
",",
"compiler",
".",
"NewContext",
"(",
"\"",
"\"",
",",
"context",
")",
")",
"\n",
"if",
"matchingError",
"==",
"nil",
"{",
"x",
".",
"Oneof",
"=",
"&",
"ParametersItem_Parameter",
"{",
"Parameter",
":",
"t",
"}",
"\n",
"matched",
"=",
"true",
"\n",
"}",
"else",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"matchingError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"// JsonReference json_reference = 2;",
"{",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"ok",
"{",
"// errors might be ok here, they mean we just don't have the right subtype",
"t",
",",
"matchingError",
":=",
"NewJsonReference",
"(",
"m",
",",
"compiler",
".",
"NewContext",
"(",
"\"",
"\"",
",",
"context",
")",
")",
"\n",
"if",
"matchingError",
"==",
"nil",
"{",
"x",
".",
"Oneof",
"=",
"&",
"ParametersItem_JsonReference",
"{",
"JsonReference",
":",
"t",
"}",
"\n",
"matched",
"=",
"true",
"\n",
"}",
"else",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"matchingError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"matched",
"{",
"// since the oneof matched one of its possibilities, discard any matching errors",
"errors",
"=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"}",
"\n",
"return",
"x",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// NewParametersItem creates an object of type ParametersItem if possible, returning an error if not.
|
[
"NewParametersItem",
"creates",
"an",
"object",
"of",
"type",
"ParametersItem",
"if",
"possible",
"returning",
"an",
"error",
"if",
"not",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L3412-L3449
|
18,731
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
NewResponseDefinitions
|
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(context, message))
} else {
// repeated NamedResponse additional_properties = 1;
// MAP: Response
x.AdditionalProperties = make([]*NamedResponse, 0)
for _, item := range m {
k, ok := compiler.StringValue(item.Key)
if ok {
v := item.Value
pair := &NamedResponse{}
pair.Name = k
var err error
pair.Value, err = NewResponse(v, compiler.NewContext(k, context))
if err != nil {
errors = append(errors, err)
}
x.AdditionalProperties = append(x.AdditionalProperties, pair)
}
}
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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(context, message))
} else {
// repeated NamedResponse additional_properties = 1;
// MAP: Response
x.AdditionalProperties = make([]*NamedResponse, 0)
for _, item := range m {
k, ok := compiler.StringValue(item.Key)
if ok {
v := item.Value
pair := &NamedResponse{}
pair.Name = k
var err error
pair.Value, err = NewResponse(v, compiler.NewContext(k, context))
if err != nil {
errors = append(errors, err)
}
x.AdditionalProperties = append(x.AdditionalProperties, pair)
}
}
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"NewResponseDefinitions",
"(",
"in",
"interface",
"{",
"}",
",",
"context",
"*",
"compiler",
".",
"Context",
")",
"(",
"*",
"ResponseDefinitions",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"x",
":=",
"&",
"ResponseDefinitions",
"{",
"}",
"\n",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"!",
"ok",
"{",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"in",
",",
"in",
")",
"\n",
"errors",
"=",
"append",
"(",
"errors",
",",
"compiler",
".",
"NewError",
"(",
"context",
",",
"message",
")",
")",
"\n",
"}",
"else",
"{",
"// repeated NamedResponse additional_properties = 1;",
"// MAP: Response",
"x",
".",
"AdditionalProperties",
"=",
"make",
"(",
"[",
"]",
"*",
"NamedResponse",
",",
"0",
")",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"m",
"{",
"k",
",",
"ok",
":=",
"compiler",
".",
"StringValue",
"(",
"item",
".",
"Key",
")",
"\n",
"if",
"ok",
"{",
"v",
":=",
"item",
".",
"Value",
"\n",
"pair",
":=",
"&",
"NamedResponse",
"{",
"}",
"\n",
"pair",
".",
"Name",
"=",
"k",
"\n",
"var",
"err",
"error",
"\n",
"pair",
".",
"Value",
",",
"err",
"=",
"NewResponse",
"(",
"v",
",",
"compiler",
".",
"NewContext",
"(",
"k",
",",
"context",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"x",
".",
"AdditionalProperties",
"=",
"append",
"(",
"x",
".",
"AdditionalProperties",
",",
"pair",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"x",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// NewResponseDefinitions creates an object of type ResponseDefinitions if possible, returning an error if not.
|
[
"NewResponseDefinitions",
"creates",
"an",
"object",
"of",
"type",
"ResponseDefinitions",
"if",
"possible",
"returning",
"an",
"error",
"if",
"not",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L4702-L4729
|
18,732
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
NewResponseValue
|
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, matchingError := NewResponse(m, compiler.NewContext("response", context))
if matchingError == nil {
x.Oneof = &ResponseValue_Response{Response: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
// JsonReference json_reference = 2;
{
m, ok := compiler.UnpackMap(in)
if ok {
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewJsonReference(m, compiler.NewContext("jsonReference", context))
if matchingError == nil {
x.Oneof = &ResponseValue_JsonReference{JsonReference: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
if matched {
// since the oneof matched one of its possibilities, discard any matching errors
errors = make([]error, 0)
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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, matchingError := NewResponse(m, compiler.NewContext("response", context))
if matchingError == nil {
x.Oneof = &ResponseValue_Response{Response: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
// JsonReference json_reference = 2;
{
m, ok := compiler.UnpackMap(in)
if ok {
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewJsonReference(m, compiler.NewContext("jsonReference", context))
if matchingError == nil {
x.Oneof = &ResponseValue_JsonReference{JsonReference: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
if matched {
// since the oneof matched one of its possibilities, discard any matching errors
errors = make([]error, 0)
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"NewResponseValue",
"(",
"in",
"interface",
"{",
"}",
",",
"context",
"*",
"compiler",
".",
"Context",
")",
"(",
"*",
"ResponseValue",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"x",
":=",
"&",
"ResponseValue",
"{",
"}",
"\n",
"matched",
":=",
"false",
"\n",
"// Response response = 1;",
"{",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"ok",
"{",
"// errors might be ok here, they mean we just don't have the right subtype",
"t",
",",
"matchingError",
":=",
"NewResponse",
"(",
"m",
",",
"compiler",
".",
"NewContext",
"(",
"\"",
"\"",
",",
"context",
")",
")",
"\n",
"if",
"matchingError",
"==",
"nil",
"{",
"x",
".",
"Oneof",
"=",
"&",
"ResponseValue_Response",
"{",
"Response",
":",
"t",
"}",
"\n",
"matched",
"=",
"true",
"\n",
"}",
"else",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"matchingError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"// JsonReference json_reference = 2;",
"{",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"ok",
"{",
"// errors might be ok here, they mean we just don't have the right subtype",
"t",
",",
"matchingError",
":=",
"NewJsonReference",
"(",
"m",
",",
"compiler",
".",
"NewContext",
"(",
"\"",
"\"",
",",
"context",
")",
")",
"\n",
"if",
"matchingError",
"==",
"nil",
"{",
"x",
".",
"Oneof",
"=",
"&",
"ResponseValue_JsonReference",
"{",
"JsonReference",
":",
"t",
"}",
"\n",
"matched",
"=",
"true",
"\n",
"}",
"else",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"matchingError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"matched",
"{",
"// since the oneof matched one of its possibilities, discard any matching errors",
"errors",
"=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"}",
"\n",
"return",
"x",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// NewResponseValue creates an object of type ResponseValue if possible, returning an error if not.
|
[
"NewResponseValue",
"creates",
"an",
"object",
"of",
"type",
"ResponseValue",
"if",
"possible",
"returning",
"an",
"error",
"if",
"not",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L4732-L4769
|
18,733
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
NewSchemaItem
|
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 := NewSchema(m, compiler.NewContext("schema", context))
if matchingError == nil {
x.Oneof = &SchemaItem_Schema{Schema: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
// FileSchema file_schema = 2;
{
m, ok := compiler.UnpackMap(in)
if ok {
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewFileSchema(m, compiler.NewContext("fileSchema", context))
if matchingError == nil {
x.Oneof = &SchemaItem_FileSchema{FileSchema: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
if matched {
// since the oneof matched one of its possibilities, discard any matching errors
errors = make([]error, 0)
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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 := NewSchema(m, compiler.NewContext("schema", context))
if matchingError == nil {
x.Oneof = &SchemaItem_Schema{Schema: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
// FileSchema file_schema = 2;
{
m, ok := compiler.UnpackMap(in)
if ok {
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewFileSchema(m, compiler.NewContext("fileSchema", context))
if matchingError == nil {
x.Oneof = &SchemaItem_FileSchema{FileSchema: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
if matched {
// since the oneof matched one of its possibilities, discard any matching errors
errors = make([]error, 0)
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"NewSchemaItem",
"(",
"in",
"interface",
"{",
"}",
",",
"context",
"*",
"compiler",
".",
"Context",
")",
"(",
"*",
"SchemaItem",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"x",
":=",
"&",
"SchemaItem",
"{",
"}",
"\n",
"matched",
":=",
"false",
"\n",
"// Schema schema = 1;",
"{",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"ok",
"{",
"// errors might be ok here, they mean we just don't have the right subtype",
"t",
",",
"matchingError",
":=",
"NewSchema",
"(",
"m",
",",
"compiler",
".",
"NewContext",
"(",
"\"",
"\"",
",",
"context",
")",
")",
"\n",
"if",
"matchingError",
"==",
"nil",
"{",
"x",
".",
"Oneof",
"=",
"&",
"SchemaItem_Schema",
"{",
"Schema",
":",
"t",
"}",
"\n",
"matched",
"=",
"true",
"\n",
"}",
"else",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"matchingError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"// FileSchema file_schema = 2;",
"{",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"ok",
"{",
"// errors might be ok here, they mean we just don't have the right subtype",
"t",
",",
"matchingError",
":=",
"NewFileSchema",
"(",
"m",
",",
"compiler",
".",
"NewContext",
"(",
"\"",
"\"",
",",
"context",
")",
")",
"\n",
"if",
"matchingError",
"==",
"nil",
"{",
"x",
".",
"Oneof",
"=",
"&",
"SchemaItem_FileSchema",
"{",
"FileSchema",
":",
"t",
"}",
"\n",
"matched",
"=",
"true",
"\n",
"}",
"else",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"matchingError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"matched",
"{",
"// since the oneof matched one of its possibilities, discard any matching errors",
"errors",
"=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"}",
"\n",
"return",
"x",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// NewSchemaItem creates an object of type SchemaItem if possible, returning an error if not.
|
[
"NewSchemaItem",
"creates",
"an",
"object",
"of",
"type",
"SchemaItem",
"if",
"possible",
"returning",
"an",
"error",
"if",
"not",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L5233-L5270
|
18,734
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
NewSecurityDefinitions
|
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(context, message))
} else {
// repeated NamedSecurityDefinitionsItem additional_properties = 1;
// MAP: SecurityDefinitionsItem
x.AdditionalProperties = make([]*NamedSecurityDefinitionsItem, 0)
for _, item := range m {
k, ok := compiler.StringValue(item.Key)
if ok {
v := item.Value
pair := &NamedSecurityDefinitionsItem{}
pair.Name = k
var err error
pair.Value, err = NewSecurityDefinitionsItem(v, compiler.NewContext(k, context))
if err != nil {
errors = append(errors, err)
}
x.AdditionalProperties = append(x.AdditionalProperties, pair)
}
}
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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(context, message))
} else {
// repeated NamedSecurityDefinitionsItem additional_properties = 1;
// MAP: SecurityDefinitionsItem
x.AdditionalProperties = make([]*NamedSecurityDefinitionsItem, 0)
for _, item := range m {
k, ok := compiler.StringValue(item.Key)
if ok {
v := item.Value
pair := &NamedSecurityDefinitionsItem{}
pair.Name = k
var err error
pair.Value, err = NewSecurityDefinitionsItem(v, compiler.NewContext(k, context))
if err != nil {
errors = append(errors, err)
}
x.AdditionalProperties = append(x.AdditionalProperties, pair)
}
}
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"NewSecurityDefinitions",
"(",
"in",
"interface",
"{",
"}",
",",
"context",
"*",
"compiler",
".",
"Context",
")",
"(",
"*",
"SecurityDefinitions",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"x",
":=",
"&",
"SecurityDefinitions",
"{",
"}",
"\n",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"!",
"ok",
"{",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"in",
",",
"in",
")",
"\n",
"errors",
"=",
"append",
"(",
"errors",
",",
"compiler",
".",
"NewError",
"(",
"context",
",",
"message",
")",
")",
"\n",
"}",
"else",
"{",
"// repeated NamedSecurityDefinitionsItem additional_properties = 1;",
"// MAP: SecurityDefinitionsItem",
"x",
".",
"AdditionalProperties",
"=",
"make",
"(",
"[",
"]",
"*",
"NamedSecurityDefinitionsItem",
",",
"0",
")",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"m",
"{",
"k",
",",
"ok",
":=",
"compiler",
".",
"StringValue",
"(",
"item",
".",
"Key",
")",
"\n",
"if",
"ok",
"{",
"v",
":=",
"item",
".",
"Value",
"\n",
"pair",
":=",
"&",
"NamedSecurityDefinitionsItem",
"{",
"}",
"\n",
"pair",
".",
"Name",
"=",
"k",
"\n",
"var",
"err",
"error",
"\n",
"pair",
".",
"Value",
",",
"err",
"=",
"NewSecurityDefinitionsItem",
"(",
"v",
",",
"compiler",
".",
"NewContext",
"(",
"k",
",",
"context",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"x",
".",
"AdditionalProperties",
"=",
"append",
"(",
"x",
".",
"AdditionalProperties",
",",
"pair",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"x",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// NewSecurityDefinitions creates an object of type SecurityDefinitions if possible, returning an error if not.
|
[
"NewSecurityDefinitions",
"creates",
"an",
"object",
"of",
"type",
"SecurityDefinitions",
"if",
"possible",
"returning",
"an",
"error",
"if",
"not",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L5273-L5300
|
18,735
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
NewSecurityDefinitionsItem
|
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 might be ok here, they mean we just don't have the right subtype
t, matchingError := NewBasicAuthenticationSecurity(m, compiler.NewContext("basicAuthenticationSecurity", context))
if matchingError == nil {
x.Oneof = &SecurityDefinitionsItem_BasicAuthenticationSecurity{BasicAuthenticationSecurity: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
// ApiKeySecurity api_key_security = 2;
{
m, ok := compiler.UnpackMap(in)
if ok {
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewApiKeySecurity(m, compiler.NewContext("apiKeySecurity", context))
if matchingError == nil {
x.Oneof = &SecurityDefinitionsItem_ApiKeySecurity{ApiKeySecurity: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
// Oauth2ImplicitSecurity oauth2_implicit_security = 3;
{
m, ok := compiler.UnpackMap(in)
if ok {
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewOauth2ImplicitSecurity(m, compiler.NewContext("oauth2ImplicitSecurity", context))
if matchingError == nil {
x.Oneof = &SecurityDefinitionsItem_Oauth2ImplicitSecurity{Oauth2ImplicitSecurity: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
// Oauth2PasswordSecurity oauth2_password_security = 4;
{
m, ok := compiler.UnpackMap(in)
if ok {
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewOauth2PasswordSecurity(m, compiler.NewContext("oauth2PasswordSecurity", context))
if matchingError == nil {
x.Oneof = &SecurityDefinitionsItem_Oauth2PasswordSecurity{Oauth2PasswordSecurity: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
// Oauth2ApplicationSecurity oauth2_application_security = 5;
{
m, ok := compiler.UnpackMap(in)
if ok {
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewOauth2ApplicationSecurity(m, compiler.NewContext("oauth2ApplicationSecurity", context))
if matchingError == nil {
x.Oneof = &SecurityDefinitionsItem_Oauth2ApplicationSecurity{Oauth2ApplicationSecurity: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
// Oauth2AccessCodeSecurity oauth2_access_code_security = 6;
{
m, ok := compiler.UnpackMap(in)
if ok {
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewOauth2AccessCodeSecurity(m, compiler.NewContext("oauth2AccessCodeSecurity", context))
if matchingError == nil {
x.Oneof = &SecurityDefinitionsItem_Oauth2AccessCodeSecurity{Oauth2AccessCodeSecurity: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
if matched {
// since the oneof matched one of its possibilities, discard any matching errors
errors = make([]error, 0)
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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 might be ok here, they mean we just don't have the right subtype
t, matchingError := NewBasicAuthenticationSecurity(m, compiler.NewContext("basicAuthenticationSecurity", context))
if matchingError == nil {
x.Oneof = &SecurityDefinitionsItem_BasicAuthenticationSecurity{BasicAuthenticationSecurity: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
// ApiKeySecurity api_key_security = 2;
{
m, ok := compiler.UnpackMap(in)
if ok {
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewApiKeySecurity(m, compiler.NewContext("apiKeySecurity", context))
if matchingError == nil {
x.Oneof = &SecurityDefinitionsItem_ApiKeySecurity{ApiKeySecurity: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
// Oauth2ImplicitSecurity oauth2_implicit_security = 3;
{
m, ok := compiler.UnpackMap(in)
if ok {
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewOauth2ImplicitSecurity(m, compiler.NewContext("oauth2ImplicitSecurity", context))
if matchingError == nil {
x.Oneof = &SecurityDefinitionsItem_Oauth2ImplicitSecurity{Oauth2ImplicitSecurity: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
// Oauth2PasswordSecurity oauth2_password_security = 4;
{
m, ok := compiler.UnpackMap(in)
if ok {
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewOauth2PasswordSecurity(m, compiler.NewContext("oauth2PasswordSecurity", context))
if matchingError == nil {
x.Oneof = &SecurityDefinitionsItem_Oauth2PasswordSecurity{Oauth2PasswordSecurity: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
// Oauth2ApplicationSecurity oauth2_application_security = 5;
{
m, ok := compiler.UnpackMap(in)
if ok {
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewOauth2ApplicationSecurity(m, compiler.NewContext("oauth2ApplicationSecurity", context))
if matchingError == nil {
x.Oneof = &SecurityDefinitionsItem_Oauth2ApplicationSecurity{Oauth2ApplicationSecurity: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
// Oauth2AccessCodeSecurity oauth2_access_code_security = 6;
{
m, ok := compiler.UnpackMap(in)
if ok {
// errors might be ok here, they mean we just don't have the right subtype
t, matchingError := NewOauth2AccessCodeSecurity(m, compiler.NewContext("oauth2AccessCodeSecurity", context))
if matchingError == nil {
x.Oneof = &SecurityDefinitionsItem_Oauth2AccessCodeSecurity{Oauth2AccessCodeSecurity: t}
matched = true
} else {
errors = append(errors, matchingError)
}
}
}
if matched {
// since the oneof matched one of its possibilities, discard any matching errors
errors = make([]error, 0)
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"NewSecurityDefinitionsItem",
"(",
"in",
"interface",
"{",
"}",
",",
"context",
"*",
"compiler",
".",
"Context",
")",
"(",
"*",
"SecurityDefinitionsItem",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"x",
":=",
"&",
"SecurityDefinitionsItem",
"{",
"}",
"\n",
"matched",
":=",
"false",
"\n",
"// BasicAuthenticationSecurity basic_authentication_security = 1;",
"{",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"ok",
"{",
"// errors might be ok here, they mean we just don't have the right subtype",
"t",
",",
"matchingError",
":=",
"NewBasicAuthenticationSecurity",
"(",
"m",
",",
"compiler",
".",
"NewContext",
"(",
"\"",
"\"",
",",
"context",
")",
")",
"\n",
"if",
"matchingError",
"==",
"nil",
"{",
"x",
".",
"Oneof",
"=",
"&",
"SecurityDefinitionsItem_BasicAuthenticationSecurity",
"{",
"BasicAuthenticationSecurity",
":",
"t",
"}",
"\n",
"matched",
"=",
"true",
"\n",
"}",
"else",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"matchingError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"// ApiKeySecurity api_key_security = 2;",
"{",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"ok",
"{",
"// errors might be ok here, they mean we just don't have the right subtype",
"t",
",",
"matchingError",
":=",
"NewApiKeySecurity",
"(",
"m",
",",
"compiler",
".",
"NewContext",
"(",
"\"",
"\"",
",",
"context",
")",
")",
"\n",
"if",
"matchingError",
"==",
"nil",
"{",
"x",
".",
"Oneof",
"=",
"&",
"SecurityDefinitionsItem_ApiKeySecurity",
"{",
"ApiKeySecurity",
":",
"t",
"}",
"\n",
"matched",
"=",
"true",
"\n",
"}",
"else",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"matchingError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"// Oauth2ImplicitSecurity oauth2_implicit_security = 3;",
"{",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"ok",
"{",
"// errors might be ok here, they mean we just don't have the right subtype",
"t",
",",
"matchingError",
":=",
"NewOauth2ImplicitSecurity",
"(",
"m",
",",
"compiler",
".",
"NewContext",
"(",
"\"",
"\"",
",",
"context",
")",
")",
"\n",
"if",
"matchingError",
"==",
"nil",
"{",
"x",
".",
"Oneof",
"=",
"&",
"SecurityDefinitionsItem_Oauth2ImplicitSecurity",
"{",
"Oauth2ImplicitSecurity",
":",
"t",
"}",
"\n",
"matched",
"=",
"true",
"\n",
"}",
"else",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"matchingError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"// Oauth2PasswordSecurity oauth2_password_security = 4;",
"{",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"ok",
"{",
"// errors might be ok here, they mean we just don't have the right subtype",
"t",
",",
"matchingError",
":=",
"NewOauth2PasswordSecurity",
"(",
"m",
",",
"compiler",
".",
"NewContext",
"(",
"\"",
"\"",
",",
"context",
")",
")",
"\n",
"if",
"matchingError",
"==",
"nil",
"{",
"x",
".",
"Oneof",
"=",
"&",
"SecurityDefinitionsItem_Oauth2PasswordSecurity",
"{",
"Oauth2PasswordSecurity",
":",
"t",
"}",
"\n",
"matched",
"=",
"true",
"\n",
"}",
"else",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"matchingError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"// Oauth2ApplicationSecurity oauth2_application_security = 5;",
"{",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"ok",
"{",
"// errors might be ok here, they mean we just don't have the right subtype",
"t",
",",
"matchingError",
":=",
"NewOauth2ApplicationSecurity",
"(",
"m",
",",
"compiler",
".",
"NewContext",
"(",
"\"",
"\"",
",",
"context",
")",
")",
"\n",
"if",
"matchingError",
"==",
"nil",
"{",
"x",
".",
"Oneof",
"=",
"&",
"SecurityDefinitionsItem_Oauth2ApplicationSecurity",
"{",
"Oauth2ApplicationSecurity",
":",
"t",
"}",
"\n",
"matched",
"=",
"true",
"\n",
"}",
"else",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"matchingError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"// Oauth2AccessCodeSecurity oauth2_access_code_security = 6;",
"{",
"m",
",",
"ok",
":=",
"compiler",
".",
"UnpackMap",
"(",
"in",
")",
"\n",
"if",
"ok",
"{",
"// errors might be ok here, they mean we just don't have the right subtype",
"t",
",",
"matchingError",
":=",
"NewOauth2AccessCodeSecurity",
"(",
"m",
",",
"compiler",
".",
"NewContext",
"(",
"\"",
"\"",
",",
"context",
")",
")",
"\n",
"if",
"matchingError",
"==",
"nil",
"{",
"x",
".",
"Oneof",
"=",
"&",
"SecurityDefinitionsItem_Oauth2AccessCodeSecurity",
"{",
"Oauth2AccessCodeSecurity",
":",
"t",
"}",
"\n",
"matched",
"=",
"true",
"\n",
"}",
"else",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"matchingError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"matched",
"{",
"// since the oneof matched one of its possibilities, discard any matching errors",
"errors",
"=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"}",
"\n",
"return",
"x",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// NewSecurityDefinitionsItem creates an object of type SecurityDefinitionsItem if possible, returning an error if not.
|
[
"NewSecurityDefinitionsItem",
"creates",
"an",
"object",
"of",
"type",
"SecurityDefinitionsItem",
"if",
"possible",
"returning",
"an",
"error",
"if",
"not",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L5303-L5396
|
18,736
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
NewTypeItem
|
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 := v.(string)
if ok {
x.Value = append(x.Value, value)
} else {
message := fmt.Sprintf("has unexpected value for string array element: %+v (%T)", value, value)
errors = append(errors, compiler.NewError(context, message))
}
}
default:
message := fmt.Sprintf("has unexpected value for string array: %+v (%T)", in, in)
errors = append(errors, compiler.NewError(context, message))
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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 := v.(string)
if ok {
x.Value = append(x.Value, value)
} else {
message := fmt.Sprintf("has unexpected value for string array element: %+v (%T)", value, value)
errors = append(errors, compiler.NewError(context, message))
}
}
default:
message := fmt.Sprintf("has unexpected value for string array: %+v (%T)", in, in)
errors = append(errors, compiler.NewError(context, message))
}
return x, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"NewTypeItem",
"(",
"in",
"interface",
"{",
"}",
",",
"context",
"*",
"compiler",
".",
"Context",
")",
"(",
"*",
"TypeItem",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"x",
":=",
"&",
"TypeItem",
"{",
"}",
"\n",
"switch",
"in",
":=",
"in",
".",
"(",
"type",
")",
"{",
"case",
"string",
":",
"x",
".",
"Value",
"=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"x",
".",
"Value",
"=",
"append",
"(",
"x",
".",
"Value",
",",
"in",
")",
"\n",
"case",
"[",
"]",
"interface",
"{",
"}",
":",
"x",
".",
"Value",
"=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"in",
"{",
"value",
",",
"ok",
":=",
"v",
".",
"(",
"string",
")",
"\n",
"if",
"ok",
"{",
"x",
".",
"Value",
"=",
"append",
"(",
"x",
".",
"Value",
",",
"value",
")",
"\n",
"}",
"else",
"{",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"value",
",",
"value",
")",
"\n",
"errors",
"=",
"append",
"(",
"errors",
",",
"compiler",
".",
"NewError",
"(",
"context",
",",
"message",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"default",
":",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"in",
",",
"in",
")",
"\n",
"errors",
"=",
"append",
"(",
"errors",
",",
"compiler",
".",
"NewError",
"(",
"context",
",",
"message",
")",
")",
"\n",
"}",
"\n",
"return",
"x",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// NewTypeItem creates an object of type TypeItem if possible, returning an error if not.
|
[
"NewTypeItem",
"creates",
"an",
"object",
"of",
"type",
"TypeItem",
"if",
"possible",
"returning",
"an",
"error",
"if",
"not",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L5530-L5553
|
18,737
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ResolveReferences
|
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.ResolveReferences(root)
if err != nil {
errors = append(errors, err)
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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.ResolveReferences(root)
if err != nil {
errors = append(errors, err)
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"(",
"m",
"*",
"BodyParameter",
")",
"ResolveReferences",
"(",
"root",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"if",
"m",
".",
"Schema",
"!=",
"nil",
"{",
"_",
",",
"err",
":=",
"m",
".",
"Schema",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"m",
".",
"VendorExtension",
"{",
"if",
"item",
"!=",
"nil",
"{",
"_",
",",
"err",
":=",
"item",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// ResolveReferences resolves references found inside BodyParameter objects.
|
[
"ResolveReferences",
"resolves",
"references",
"found",
"inside",
"BodyParameter",
"objects",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L5743-L5760
|
18,738
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ResolveReferences
|
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 != nil {
errors = append(errors, err)
}
}
if m.Example != nil {
_, err := m.Example.ResolveReferences(root)
if err != nil {
errors = append(errors, err)
}
}
for _, item := range m.VendorExtension {
if item != nil {
_, err := item.ResolveReferences(root)
if err != nil {
errors = append(errors, err)
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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 != nil {
errors = append(errors, err)
}
}
if m.Example != nil {
_, err := m.Example.ResolveReferences(root)
if err != nil {
errors = append(errors, err)
}
}
for _, item := range m.VendorExtension {
if item != nil {
_, err := item.ResolveReferences(root)
if err != nil {
errors = append(errors, err)
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"(",
"m",
"*",
"FileSchema",
")",
"ResolveReferences",
"(",
"root",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"if",
"m",
".",
"Default",
"!=",
"nil",
"{",
"_",
",",
"err",
":=",
"m",
".",
"Default",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"m",
".",
"ExternalDocs",
"!=",
"nil",
"{",
"_",
",",
"err",
":=",
"m",
".",
"ExternalDocs",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"m",
".",
"Example",
"!=",
"nil",
"{",
"_",
",",
"err",
":=",
"m",
".",
"Example",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"m",
".",
"VendorExtension",
"{",
"if",
"item",
"!=",
"nil",
"{",
"_",
",",
"err",
":=",
"item",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// ResolveReferences resolves references found inside FileSchema objects.
|
[
"ResolveReferences",
"resolves",
"references",
"found",
"inside",
"FileSchema",
"objects",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L5905-L5934
|
18,739
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ResolveReferences
|
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 = append(errors, err)
}
}
for _, item := range m.VendorExtension {
if item != nil {
_, err := item.ResolveReferences(root)
if err != nil {
errors = append(errors, err)
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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 = append(errors, err)
}
}
for _, item := range m.VendorExtension {
if item != nil {
_, err := item.ResolveReferences(root)
if err != nil {
errors = append(errors, err)
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"(",
"m",
"*",
"Info",
")",
"ResolveReferences",
"(",
"root",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"if",
"m",
".",
"Contact",
"!=",
"nil",
"{",
"_",
",",
"err",
":=",
"m",
".",
"Contact",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"m",
".",
"License",
"!=",
"nil",
"{",
"_",
",",
"err",
":=",
"m",
".",
"License",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"m",
".",
"VendorExtension",
"{",
"if",
"item",
"!=",
"nil",
"{",
"_",
",",
"err",
":=",
"item",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// ResolveReferences resolves references found inside Info objects.
|
[
"ResolveReferences",
"resolves",
"references",
"found",
"inside",
"Info",
"objects",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L6053-L6076
|
18,740
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ResolveReferences
|
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
|
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)
}
|
[
"func",
"(",
"m",
"*",
"ItemsItem",
")",
"ResolveReferences",
"(",
"root",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"m",
".",
"Schema",
"{",
"if",
"item",
"!=",
"nil",
"{",
"_",
",",
"err",
":=",
"item",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// ResolveReferences resolves references found inside ItemsItem objects.
|
[
"ResolveReferences",
"resolves",
"references",
"found",
"inside",
"ItemsItem",
"objects",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L6079-L6090
|
18,741
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ResolveReferences
|
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 = *replacement
return m.ResolveReferences(root)
}
}
return info, nil
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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 = *replacement
return m.ResolveReferences(root)
}
}
return info, nil
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"(",
"m",
"*",
"JsonReference",
")",
"ResolveReferences",
"(",
"root",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"if",
"m",
".",
"XRef",
"!=",
"\"",
"\"",
"{",
"info",
",",
"err",
":=",
"compiler",
".",
"ReadInfoForRef",
"(",
"root",
",",
"m",
".",
"XRef",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"info",
"!=",
"nil",
"{",
"replacement",
",",
"err",
":=",
"NewJsonReference",
"(",
"info",
",",
"nil",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"*",
"m",
"=",
"*",
"replacement",
"\n",
"return",
"m",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"info",
",",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// ResolveReferences resolves references found inside JsonReference objects.
|
[
"ResolveReferences",
"resolves",
"references",
"found",
"inside",
"JsonReference",
"objects",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L6093-L6110
|
18,742
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ResolveReferences
|
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.Oneof.(*NonBodyParameter_FormDataParameterSubSchema)
if ok {
_, err := p.FormDataParameterSubSchema.ResolveReferences(root)
if err != nil {
return nil, err
}
}
}
{
p, ok := m.Oneof.(*NonBodyParameter_QueryParameterSubSchema)
if ok {
_, err := p.QueryParameterSubSchema.ResolveReferences(root)
if err != nil {
return nil, err
}
}
}
{
p, ok := m.Oneof.(*NonBodyParameter_PathParameterSubSchema)
if ok {
_, err := p.PathParameterSubSchema.ResolveReferences(root)
if err != nil {
return nil, err
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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.Oneof.(*NonBodyParameter_FormDataParameterSubSchema)
if ok {
_, err := p.FormDataParameterSubSchema.ResolveReferences(root)
if err != nil {
return nil, err
}
}
}
{
p, ok := m.Oneof.(*NonBodyParameter_QueryParameterSubSchema)
if ok {
_, err := p.QueryParameterSubSchema.ResolveReferences(root)
if err != nil {
return nil, err
}
}
}
{
p, ok := m.Oneof.(*NonBodyParameter_PathParameterSubSchema)
if ok {
_, err := p.PathParameterSubSchema.ResolveReferences(root)
if err != nil {
return nil, err
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"(",
"m",
"*",
"NonBodyParameter",
")",
"ResolveReferences",
"(",
"root",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"{",
"p",
",",
"ok",
":=",
"m",
".",
"Oneof",
".",
"(",
"*",
"NonBodyParameter_HeaderParameterSubSchema",
")",
"\n",
"if",
"ok",
"{",
"_",
",",
"err",
":=",
"p",
".",
"HeaderParameterSubSchema",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"{",
"p",
",",
"ok",
":=",
"m",
".",
"Oneof",
".",
"(",
"*",
"NonBodyParameter_FormDataParameterSubSchema",
")",
"\n",
"if",
"ok",
"{",
"_",
",",
"err",
":=",
"p",
".",
"FormDataParameterSubSchema",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"{",
"p",
",",
"ok",
":=",
"m",
".",
"Oneof",
".",
"(",
"*",
"NonBodyParameter_QueryParameterSubSchema",
")",
"\n",
"if",
"ok",
"{",
"_",
",",
"err",
":=",
"p",
".",
"QueryParameterSubSchema",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"{",
"p",
",",
"ok",
":=",
"m",
".",
"Oneof",
".",
"(",
"*",
"NonBodyParameter_PathParameterSubSchema",
")",
"\n",
"if",
"ok",
"{",
"_",
",",
"err",
":=",
"p",
".",
"PathParameterSubSchema",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// ResolveReferences resolves references found inside NonBodyParameter objects.
|
[
"ResolveReferences",
"resolves",
"references",
"found",
"inside",
"NonBodyParameter",
"objects",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L6241-L6280
|
18,743
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ResolveReferences
|
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.ResolveReferences(root)
if err != nil {
errors = append(errors, err)
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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.ResolveReferences(root)
if err != nil {
errors = append(errors, err)
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"(",
"m",
"*",
"Oauth2ImplicitSecurity",
")",
"ResolveReferences",
"(",
"root",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"if",
"m",
".",
"Scopes",
"!=",
"nil",
"{",
"_",
",",
"err",
":=",
"m",
".",
"Scopes",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"m",
".",
"VendorExtension",
"{",
"if",
"item",
"!=",
"nil",
"{",
"_",
",",
"err",
":=",
"item",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// ResolveReferences resolves references found inside Oauth2ImplicitSecurity objects.
|
[
"ResolveReferences",
"resolves",
"references",
"found",
"inside",
"Oauth2ImplicitSecurity",
"objects",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L6323-L6340
|
18,744
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ResolveReferences
|
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)
if ok {
info, err := p.JsonReference.ResolveReferences(root)
if err != nil {
return nil, err
} else if info != nil {
n, err := NewParametersItem(info, nil)
if err != nil {
return nil, err
} else if n != nil {
*m = *n
return nil, nil
}
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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)
if ok {
info, err := p.JsonReference.ResolveReferences(root)
if err != nil {
return nil, err
} else if info != nil {
n, err := NewParametersItem(info, nil)
if err != nil {
return nil, err
} else if n != nil {
*m = *n
return nil, nil
}
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"(",
"m",
"*",
"ParametersItem",
")",
"ResolveReferences",
"(",
"root",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"{",
"p",
",",
"ok",
":=",
"m",
".",
"Oneof",
".",
"(",
"*",
"ParametersItem_Parameter",
")",
"\n",
"if",
"ok",
"{",
"_",
",",
"err",
":=",
"p",
".",
"Parameter",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"{",
"p",
",",
"ok",
":=",
"m",
".",
"Oneof",
".",
"(",
"*",
"ParametersItem_JsonReference",
")",
"\n",
"if",
"ok",
"{",
"info",
",",
"err",
":=",
"p",
".",
"JsonReference",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"else",
"if",
"info",
"!=",
"nil",
"{",
"n",
",",
"err",
":=",
"NewParametersItem",
"(",
"info",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"else",
"if",
"n",
"!=",
"nil",
"{",
"*",
"m",
"=",
"*",
"n",
"\n",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// ResolveReferences resolves references found inside ParametersItem objects.
|
[
"ResolveReferences",
"resolves",
"references",
"found",
"inside",
"ParametersItem",
"objects",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L6457-L6486
|
18,745
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ResolveReferences
|
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 != nil {
errors = append(errors, err)
}
}
for _, item := range m.Enum {
if item != nil {
_, err := item.ResolveReferences(root)
if err != nil {
errors = append(errors, err)
}
}
}
for _, item := range m.VendorExtension {
if item != nil {
_, err := item.ResolveReferences(root)
if err != nil {
errors = append(errors, err)
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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 != nil {
errors = append(errors, err)
}
}
for _, item := range m.Enum {
if item != nil {
_, err := item.ResolveReferences(root)
if err != nil {
errors = append(errors, err)
}
}
}
for _, item := range m.VendorExtension {
if item != nil {
_, err := item.ResolveReferences(root)
if err != nil {
errors = append(errors, err)
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"(",
"m",
"*",
"PathParameterSubSchema",
")",
"ResolveReferences",
"(",
"root",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"if",
"m",
".",
"Items",
"!=",
"nil",
"{",
"_",
",",
"err",
":=",
"m",
".",
"Items",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"m",
".",
"Default",
"!=",
"nil",
"{",
"_",
",",
"err",
":=",
"m",
".",
"Default",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"m",
".",
"Enum",
"{",
"if",
"item",
"!=",
"nil",
"{",
"_",
",",
"err",
":=",
"item",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"m",
".",
"VendorExtension",
"{",
"if",
"item",
"!=",
"nil",
"{",
"_",
",",
"err",
":=",
"item",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// ResolveReferences resolves references found inside PathParameterSubSchema objects.
|
[
"ResolveReferences",
"resolves",
"references",
"found",
"inside",
"PathParameterSubSchema",
"objects",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L6567-L6598
|
18,746
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ResolveReferences
|
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 {
_, err := item.ResolveReferences(root)
if err != nil {
errors = append(errors, err)
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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 {
_, err := item.ResolveReferences(root)
if err != nil {
errors = append(errors, err)
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"(",
"m",
"*",
"Paths",
")",
"ResolveReferences",
"(",
"root",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"m",
".",
"VendorExtension",
"{",
"if",
"item",
"!=",
"nil",
"{",
"_",
",",
"err",
":=",
"item",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"m",
".",
"Path",
"{",
"if",
"item",
"!=",
"nil",
"{",
"_",
",",
"err",
":=",
"item",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// ResolveReferences resolves references found inside Paths objects.
|
[
"ResolveReferences",
"resolves",
"references",
"found",
"inside",
"Paths",
"objects",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L6601-L6620
|
18,747
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ResolveReferences
|
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 ok {
info, err := p.JsonReference.ResolveReferences(root)
if err != nil {
return nil, err
} else if info != nil {
n, err := NewResponseValue(info, nil)
if err != nil {
return nil, err
} else if n != nil {
*m = *n
return nil, nil
}
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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 ok {
info, err := p.JsonReference.ResolveReferences(root)
if err != nil {
return nil, err
} else if info != nil {
n, err := NewResponseValue(info, nil)
if err != nil {
return nil, err
} else if n != nil {
*m = *n
return nil, nil
}
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"(",
"m",
"*",
"ResponseValue",
")",
"ResolveReferences",
"(",
"root",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"{",
"p",
",",
"ok",
":=",
"m",
".",
"Oneof",
".",
"(",
"*",
"ResponseValue_Response",
")",
"\n",
"if",
"ok",
"{",
"_",
",",
"err",
":=",
"p",
".",
"Response",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"{",
"p",
",",
"ok",
":=",
"m",
".",
"Oneof",
".",
"(",
"*",
"ResponseValue_JsonReference",
")",
"\n",
"if",
"ok",
"{",
"info",
",",
"err",
":=",
"p",
".",
"JsonReference",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"else",
"if",
"info",
"!=",
"nil",
"{",
"n",
",",
"err",
":=",
"NewResponseValue",
"(",
"info",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"else",
"if",
"n",
"!=",
"nil",
"{",
"*",
"m",
"=",
"*",
"n",
"\n",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// ResolveReferences resolves references found inside ResponseValue objects.
|
[
"ResolveReferences",
"resolves",
"references",
"found",
"inside",
"ResponseValue",
"objects",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L6751-L6780
|
18,748
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ResolveReferences
|
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 := p.FileSchema.ResolveReferences(root)
if err != nil {
return nil, err
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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 := p.FileSchema.ResolveReferences(root)
if err != nil {
return nil, err
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"(",
"m",
"*",
"SchemaItem",
")",
"ResolveReferences",
"(",
"root",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"{",
"p",
",",
"ok",
":=",
"m",
".",
"Oneof",
".",
"(",
"*",
"SchemaItem_Schema",
")",
"\n",
"if",
"ok",
"{",
"_",
",",
"err",
":=",
"p",
".",
"Schema",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"{",
"p",
",",
"ok",
":=",
"m",
".",
"Oneof",
".",
"(",
"*",
"SchemaItem_FileSchema",
")",
"\n",
"if",
"ok",
"{",
"_",
",",
"err",
":=",
"p",
".",
"FileSchema",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// ResolveReferences resolves references found inside SchemaItem objects.
|
[
"ResolveReferences",
"resolves",
"references",
"found",
"inside",
"SchemaItem",
"objects",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L6897-L6918
|
18,749
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ResolveReferences
|
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
}
}
}
{
p, ok := m.Oneof.(*SecurityDefinitionsItem_ApiKeySecurity)
if ok {
_, err := p.ApiKeySecurity.ResolveReferences(root)
if err != nil {
return nil, err
}
}
}
{
p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2ImplicitSecurity)
if ok {
_, err := p.Oauth2ImplicitSecurity.ResolveReferences(root)
if err != nil {
return nil, err
}
}
}
{
p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2PasswordSecurity)
if ok {
_, err := p.Oauth2PasswordSecurity.ResolveReferences(root)
if err != nil {
return nil, err
}
}
}
{
p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2ApplicationSecurity)
if ok {
_, err := p.Oauth2ApplicationSecurity.ResolveReferences(root)
if err != nil {
return nil, err
}
}
}
{
p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2AccessCodeSecurity)
if ok {
_, err := p.Oauth2AccessCodeSecurity.ResolveReferences(root)
if err != nil {
return nil, err
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
go
|
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
}
}
}
{
p, ok := m.Oneof.(*SecurityDefinitionsItem_ApiKeySecurity)
if ok {
_, err := p.ApiKeySecurity.ResolveReferences(root)
if err != nil {
return nil, err
}
}
}
{
p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2ImplicitSecurity)
if ok {
_, err := p.Oauth2ImplicitSecurity.ResolveReferences(root)
if err != nil {
return nil, err
}
}
}
{
p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2PasswordSecurity)
if ok {
_, err := p.Oauth2PasswordSecurity.ResolveReferences(root)
if err != nil {
return nil, err
}
}
}
{
p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2ApplicationSecurity)
if ok {
_, err := p.Oauth2ApplicationSecurity.ResolveReferences(root)
if err != nil {
return nil, err
}
}
}
{
p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2AccessCodeSecurity)
if ok {
_, err := p.Oauth2AccessCodeSecurity.ResolveReferences(root)
if err != nil {
return nil, err
}
}
}
return nil, compiler.NewErrorGroupOrNil(errors)
}
|
[
"func",
"(",
"m",
"*",
"SecurityDefinitionsItem",
")",
"ResolveReferences",
"(",
"root",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"errors",
":=",
"make",
"(",
"[",
"]",
"error",
",",
"0",
")",
"\n",
"{",
"p",
",",
"ok",
":=",
"m",
".",
"Oneof",
".",
"(",
"*",
"SecurityDefinitionsItem_BasicAuthenticationSecurity",
")",
"\n",
"if",
"ok",
"{",
"_",
",",
"err",
":=",
"p",
".",
"BasicAuthenticationSecurity",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"{",
"p",
",",
"ok",
":=",
"m",
".",
"Oneof",
".",
"(",
"*",
"SecurityDefinitionsItem_ApiKeySecurity",
")",
"\n",
"if",
"ok",
"{",
"_",
",",
"err",
":=",
"p",
".",
"ApiKeySecurity",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"{",
"p",
",",
"ok",
":=",
"m",
".",
"Oneof",
".",
"(",
"*",
"SecurityDefinitionsItem_Oauth2ImplicitSecurity",
")",
"\n",
"if",
"ok",
"{",
"_",
",",
"err",
":=",
"p",
".",
"Oauth2ImplicitSecurity",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"{",
"p",
",",
"ok",
":=",
"m",
".",
"Oneof",
".",
"(",
"*",
"SecurityDefinitionsItem_Oauth2PasswordSecurity",
")",
"\n",
"if",
"ok",
"{",
"_",
",",
"err",
":=",
"p",
".",
"Oauth2PasswordSecurity",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"{",
"p",
",",
"ok",
":=",
"m",
".",
"Oneof",
".",
"(",
"*",
"SecurityDefinitionsItem_Oauth2ApplicationSecurity",
")",
"\n",
"if",
"ok",
"{",
"_",
",",
"err",
":=",
"p",
".",
"Oauth2ApplicationSecurity",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"{",
"p",
",",
"ok",
":=",
"m",
".",
"Oneof",
".",
"(",
"*",
"SecurityDefinitionsItem_Oauth2AccessCodeSecurity",
")",
"\n",
"if",
"ok",
"{",
"_",
",",
"err",
":=",
"p",
".",
"Oauth2AccessCodeSecurity",
".",
"ResolveReferences",
"(",
"root",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"compiler",
".",
"NewErrorGroupOrNil",
"(",
"errors",
")",
"\n",
"}"
] |
// ResolveReferences resolves references found inside SecurityDefinitionsItem objects.
|
[
"ResolveReferences",
"resolves",
"references",
"found",
"inside",
"SecurityDefinitionsItem",
"objects",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L6935-L6992
|
18,750
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ToRawInfo
|
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 StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if v1, ok := m.GetOneof().(*AdditionalPropertiesItem_Boolean); ok {
return v1.Boolean
}
return nil
}
|
go
|
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 StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if v1, ok := m.GetOneof().(*AdditionalPropertiesItem_Boolean); ok {
return v1.Boolean
}
return nil
}
|
[
"func",
"(",
"m",
"*",
"AdditionalPropertiesItem",
")",
"ToRawInfo",
"(",
")",
"interface",
"{",
"}",
"{",
"// ONE OF WRAPPER",
"// AdditionalPropertiesItem",
"// {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"v0",
":=",
"m",
".",
"GetSchema",
"(",
")",
"\n",
"if",
"v0",
"!=",
"nil",
"{",
"return",
"v0",
".",
"ToRawInfo",
"(",
")",
"\n",
"}",
"\n",
"// {Name:boolean Type:bool StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"if",
"v1",
",",
"ok",
":=",
"m",
".",
"GetOneof",
"(",
")",
".",
"(",
"*",
"AdditionalPropertiesItem_Boolean",
")",
";",
"ok",
"{",
"return",
"v1",
".",
"Boolean",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
// ToRawInfo returns a description of AdditionalPropertiesItem suitable for JSON or YAML export.
|
[
"ToRawInfo",
"returns",
"a",
"description",
"of",
"AdditionalPropertiesItem",
"suitable",
"for",
"JSON",
"or",
"YAML",
"export",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L7069-L7082
|
18,751
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ToRawInfo
|
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})
// always include this required field.
info = append(info, yaml.MapItem{Key: "in", Value: m.In})
if m.Description != "" {
info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
}
if m.VendorExtension != nil {
for _, item := range m.VendorExtension {
info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
}
}
// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
return info
}
|
go
|
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})
// always include this required field.
info = append(info, yaml.MapItem{Key: "in", Value: m.In})
if m.Description != "" {
info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
}
if m.VendorExtension != nil {
for _, item := range m.VendorExtension {
info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
}
}
// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
return info
}
|
[
"func",
"(",
"m",
"*",
"ApiKeySecurity",
")",
"ToRawInfo",
"(",
")",
"interface",
"{",
"}",
"{",
"info",
":=",
"yaml",
".",
"MapSlice",
"{",
"}",
"\n",
"if",
"m",
"==",
"nil",
"{",
"return",
"info",
"\n",
"}",
"\n",
"// always include this required field.",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Type",
"}",
")",
"\n",
"// always include this required field.",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Name",
"}",
")",
"\n",
"// always include this required field.",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"In",
"}",
")",
"\n",
"if",
"m",
".",
"Description",
"!=",
"\"",
"\"",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Description",
"}",
")",
"\n",
"}",
"\n",
"if",
"m",
".",
"VendorExtension",
"!=",
"nil",
"{",
"for",
"_",
",",
"item",
":=",
"range",
"m",
".",
"VendorExtension",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"item",
".",
"Name",
",",
"Value",
":",
"item",
".",
"Value",
".",
"ToRawInfo",
"(",
")",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}",
"return",
"info",
"\n",
"}"
] |
// ToRawInfo returns a description of ApiKeySecurity suitable for JSON or YAML export.
|
[
"ToRawInfo",
"returns",
"a",
"description",
"of",
"ApiKeySecurity",
"suitable",
"for",
"JSON",
"or",
"YAML",
"export",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L7106-L7127
|
18,752
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ToRawInfo
|
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})
// always include this required field.
info = append(info, yaml.MapItem{Key: "in", Value: m.In})
if m.Required != false {
info = append(info, yaml.MapItem{Key: "required", Value: m.Required})
}
// always include this required field.
info = append(info, yaml.MapItem{Key: "schema", Value: m.Schema.ToRawInfo()})
// &{Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.VendorExtension != nil {
for _, item := range m.VendorExtension {
info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
}
}
// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
return info
}
|
go
|
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})
// always include this required field.
info = append(info, yaml.MapItem{Key: "in", Value: m.In})
if m.Required != false {
info = append(info, yaml.MapItem{Key: "required", Value: m.Required})
}
// always include this required field.
info = append(info, yaml.MapItem{Key: "schema", Value: m.Schema.ToRawInfo()})
// &{Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.VendorExtension != nil {
for _, item := range m.VendorExtension {
info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
}
}
// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
return info
}
|
[
"func",
"(",
"m",
"*",
"BodyParameter",
")",
"ToRawInfo",
"(",
")",
"interface",
"{",
"}",
"{",
"info",
":=",
"yaml",
".",
"MapSlice",
"{",
"}",
"\n",
"if",
"m",
"==",
"nil",
"{",
"return",
"info",
"\n",
"}",
"\n",
"if",
"m",
".",
"Description",
"!=",
"\"",
"\"",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Description",
"}",
")",
"\n",
"}",
"\n",
"// always include this required field.",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Name",
"}",
")",
"\n",
"// always include this required field.",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"In",
"}",
")",
"\n",
"if",
"m",
".",
"Required",
"!=",
"false",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Required",
"}",
")",
"\n",
"}",
"\n",
"// always include this required field.",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Schema",
".",
"ToRawInfo",
"(",
")",
"}",
")",
"\n",
"// &{Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"if",
"m",
".",
"VendorExtension",
"!=",
"nil",
"{",
"for",
"_",
",",
"item",
":=",
"range",
"m",
".",
"VendorExtension",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"item",
".",
"Name",
",",
"Value",
":",
"item",
".",
"Value",
".",
"ToRawInfo",
"(",
")",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}",
"return",
"info",
"\n",
"}"
] |
// ToRawInfo returns a description of BodyParameter suitable for JSON or YAML export.
|
[
"ToRawInfo",
"returns",
"a",
"description",
"of",
"BodyParameter",
"suitable",
"for",
"JSON",
"or",
"YAML",
"export",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L7150-L7175
|
18,753
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ToRawInfo
|
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 = append(info, yaml.MapItem{Key: "description", Value: m.Description})
}
if m.Default != nil {
info = append(info, yaml.MapItem{Key: "default", Value: m.Default.ToRawInfo()})
}
// &{Name:default Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if len(m.Required) != 0 {
info = append(info, yaml.MapItem{Key: "required", Value: m.Required})
}
// always include this required field.
info = append(info, yaml.MapItem{Key: "type", Value: m.Type})
if m.ReadOnly != false {
info = append(info, yaml.MapItem{Key: "readOnly", Value: m.ReadOnly})
}
if m.ExternalDocs != nil {
info = append(info, yaml.MapItem{Key: "externalDocs", Value: m.ExternalDocs.ToRawInfo()})
}
// &{Name:externalDocs Type:ExternalDocs StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.Example != nil {
info = append(info, yaml.MapItem{Key: "example", Value: m.Example.ToRawInfo()})
}
// &{Name:example Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.VendorExtension != nil {
for _, item := range m.VendorExtension {
info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
}
}
// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
return info
}
|
go
|
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 = append(info, yaml.MapItem{Key: "description", Value: m.Description})
}
if m.Default != nil {
info = append(info, yaml.MapItem{Key: "default", Value: m.Default.ToRawInfo()})
}
// &{Name:default Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if len(m.Required) != 0 {
info = append(info, yaml.MapItem{Key: "required", Value: m.Required})
}
// always include this required field.
info = append(info, yaml.MapItem{Key: "type", Value: m.Type})
if m.ReadOnly != false {
info = append(info, yaml.MapItem{Key: "readOnly", Value: m.ReadOnly})
}
if m.ExternalDocs != nil {
info = append(info, yaml.MapItem{Key: "externalDocs", Value: m.ExternalDocs.ToRawInfo()})
}
// &{Name:externalDocs Type:ExternalDocs StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.Example != nil {
info = append(info, yaml.MapItem{Key: "example", Value: m.Example.ToRawInfo()})
}
// &{Name:example Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.VendorExtension != nil {
for _, item := range m.VendorExtension {
info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
}
}
// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
return info
}
|
[
"func",
"(",
"m",
"*",
"FileSchema",
")",
"ToRawInfo",
"(",
")",
"interface",
"{",
"}",
"{",
"info",
":=",
"yaml",
".",
"MapSlice",
"{",
"}",
"\n",
"if",
"m",
"==",
"nil",
"{",
"return",
"info",
"\n",
"}",
"\n",
"if",
"m",
".",
"Format",
"!=",
"\"",
"\"",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Format",
"}",
")",
"\n",
"}",
"\n",
"if",
"m",
".",
"Title",
"!=",
"\"",
"\"",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Title",
"}",
")",
"\n",
"}",
"\n",
"if",
"m",
".",
"Description",
"!=",
"\"",
"\"",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Description",
"}",
")",
"\n",
"}",
"\n",
"if",
"m",
".",
"Default",
"!=",
"nil",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Default",
".",
"ToRawInfo",
"(",
")",
"}",
")",
"\n",
"}",
"\n",
"// &{Name:default Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"if",
"len",
"(",
"m",
".",
"Required",
")",
"!=",
"0",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Required",
"}",
")",
"\n",
"}",
"\n",
"// always include this required field.",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Type",
"}",
")",
"\n",
"if",
"m",
".",
"ReadOnly",
"!=",
"false",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"ReadOnly",
"}",
")",
"\n",
"}",
"\n",
"if",
"m",
".",
"ExternalDocs",
"!=",
"nil",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"ExternalDocs",
".",
"ToRawInfo",
"(",
")",
"}",
")",
"\n",
"}",
"\n",
"// &{Name:externalDocs Type:ExternalDocs StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"if",
"m",
".",
"Example",
"!=",
"nil",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Example",
".",
"ToRawInfo",
"(",
")",
"}",
")",
"\n",
"}",
"\n",
"// &{Name:example Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"if",
"m",
".",
"VendorExtension",
"!=",
"nil",
"{",
"for",
"_",
",",
"item",
":=",
"range",
"m",
".",
"VendorExtension",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"item",
".",
"Name",
",",
"Value",
":",
"item",
".",
"Value",
".",
"ToRawInfo",
"(",
")",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}",
"return",
"info",
"\n",
"}"
] |
// ToRawInfo returns a description of FileSchema suitable for JSON or YAML export.
|
[
"ToRawInfo",
"returns",
"a",
"description",
"of",
"FileSchema",
"suitable",
"for",
"JSON",
"or",
"YAML",
"export",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L7341-L7382
|
18,754
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ToRawInfo
|
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.Description != "" {
info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
}
if m.TermsOfService != "" {
info = append(info, yaml.MapItem{Key: "termsOfService", Value: m.TermsOfService})
}
if m.Contact != nil {
info = append(info, yaml.MapItem{Key: "contact", Value: m.Contact.ToRawInfo()})
}
// &{Name:contact Type:Contact StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.License != nil {
info = append(info, yaml.MapItem{Key: "license", Value: m.License.ToRawInfo()})
}
// &{Name:license Type:License StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.VendorExtension != nil {
for _, item := range m.VendorExtension {
info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
}
}
// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
return info
}
|
go
|
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.Description != "" {
info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
}
if m.TermsOfService != "" {
info = append(info, yaml.MapItem{Key: "termsOfService", Value: m.TermsOfService})
}
if m.Contact != nil {
info = append(info, yaml.MapItem{Key: "contact", Value: m.Contact.ToRawInfo()})
}
// &{Name:contact Type:Contact StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.License != nil {
info = append(info, yaml.MapItem{Key: "license", Value: m.License.ToRawInfo()})
}
// &{Name:license Type:License StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
if m.VendorExtension != nil {
for _, item := range m.VendorExtension {
info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
}
}
// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
return info
}
|
[
"func",
"(",
"m",
"*",
"Info",
")",
"ToRawInfo",
"(",
")",
"interface",
"{",
"}",
"{",
"info",
":=",
"yaml",
".",
"MapSlice",
"{",
"}",
"\n",
"if",
"m",
"==",
"nil",
"{",
"return",
"info",
"\n",
"}",
"\n",
"// always include this required field.",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Title",
"}",
")",
"\n",
"// always include this required field.",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Version",
"}",
")",
"\n",
"if",
"m",
".",
"Description",
"!=",
"\"",
"\"",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Description",
"}",
")",
"\n",
"}",
"\n",
"if",
"m",
".",
"TermsOfService",
"!=",
"\"",
"\"",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"TermsOfService",
"}",
")",
"\n",
"}",
"\n",
"if",
"m",
".",
"Contact",
"!=",
"nil",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Contact",
".",
"ToRawInfo",
"(",
")",
"}",
")",
"\n",
"}",
"\n",
"// &{Name:contact Type:Contact StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"if",
"m",
".",
"License",
"!=",
"nil",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"License",
".",
"ToRawInfo",
"(",
")",
"}",
")",
"\n",
"}",
"\n",
"// &{Name:license Type:License StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"if",
"m",
".",
"VendorExtension",
"!=",
"nil",
"{",
"for",
"_",
",",
"item",
":=",
"range",
"m",
".",
"VendorExtension",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"item",
".",
"Name",
",",
"Value",
":",
"item",
".",
"Value",
".",
"ToRawInfo",
"(",
")",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}",
"return",
"info",
"\n",
"}"
] |
// ToRawInfo returns a description of Info suitable for JSON or YAML export.
|
[
"ToRawInfo",
"returns",
"a",
"description",
"of",
"Info",
"suitable",
"for",
"JSON",
"or",
"YAML",
"export",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L7648-L7678
|
18,755
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ToRawInfo
|
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})
}
// &{Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:true Pattern: Implicit:false Description:}
return info
}
|
go
|
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})
}
// &{Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:true Pattern: Implicit:false Description:}
return info
}
|
[
"func",
"(",
"m",
"*",
"ItemsItem",
")",
"ToRawInfo",
"(",
")",
"interface",
"{",
"}",
"{",
"info",
":=",
"yaml",
".",
"MapSlice",
"{",
"}",
"\n",
"if",
"m",
"==",
"nil",
"{",
"return",
"info",
"\n",
"}",
"\n",
"if",
"len",
"(",
"m",
".",
"Schema",
")",
"!=",
"0",
"{",
"items",
":=",
"make",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"0",
")",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"m",
".",
"Schema",
"{",
"items",
"=",
"append",
"(",
"items",
",",
"item",
".",
"ToRawInfo",
"(",
")",
")",
"\n",
"}",
"\n",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"items",
"}",
")",
"\n",
"}",
"\n",
"// &{Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:true Pattern: Implicit:false Description:}",
"return",
"info",
"\n",
"}"
] |
// ToRawInfo returns a description of ItemsItem suitable for JSON or YAML export.
|
[
"ToRawInfo",
"returns",
"a",
"description",
"of",
"ItemsItem",
"suitable",
"for",
"JSON",
"or",
"YAML",
"export",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L7681-L7695
|
18,756
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ToRawInfo
|
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})
}
return info
}
|
go
|
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})
}
return info
}
|
[
"func",
"(",
"m",
"*",
"JsonReference",
")",
"ToRawInfo",
"(",
")",
"interface",
"{",
"}",
"{",
"info",
":=",
"yaml",
".",
"MapSlice",
"{",
"}",
"\n",
"if",
"m",
"==",
"nil",
"{",
"return",
"info",
"\n",
"}",
"\n",
"// always include this required field.",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"XRef",
"}",
")",
"\n",
"if",
"m",
".",
"Description",
"!=",
"\"",
"\"",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Description",
"}",
")",
"\n",
"}",
"\n",
"return",
"info",
"\n",
"}"
] |
// ToRawInfo returns a description of JsonReference suitable for JSON or YAML export.
|
[
"ToRawInfo",
"returns",
"a",
"description",
"of",
"JsonReference",
"suitable",
"for",
"JSON",
"or",
"YAML",
"export",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L7698-L7709
|
18,757
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ToRawInfo
|
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 {
for _, item := range m.VendorExtension {
info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
}
}
// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
return info
}
|
go
|
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 {
for _, item := range m.VendorExtension {
info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
}
}
// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
return info
}
|
[
"func",
"(",
"m",
"*",
"License",
")",
"ToRawInfo",
"(",
")",
"interface",
"{",
"}",
"{",
"info",
":=",
"yaml",
".",
"MapSlice",
"{",
"}",
"\n",
"if",
"m",
"==",
"nil",
"{",
"return",
"info",
"\n",
"}",
"\n",
"// always include this required field.",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Name",
"}",
")",
"\n",
"if",
"m",
".",
"Url",
"!=",
"\"",
"\"",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Url",
"}",
")",
"\n",
"}",
"\n",
"if",
"m",
".",
"VendorExtension",
"!=",
"nil",
"{",
"for",
"_",
",",
"item",
":=",
"range",
"m",
".",
"VendorExtension",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"item",
".",
"Name",
",",
"Value",
":",
"item",
".",
"Value",
".",
"ToRawInfo",
"(",
")",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}",
"return",
"info",
"\n",
"}"
] |
// ToRawInfo returns a description of License suitable for JSON or YAML export.
|
[
"ToRawInfo",
"returns",
"a",
"description",
"of",
"License",
"suitable",
"for",
"JSON",
"or",
"YAML",
"export",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L7712-L7729
|
18,758
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ToRawInfo
|
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()
}
// {Name:formDataParameterSubSchema Type:FormDataParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v1 := m.GetFormDataParameterSubSchema()
if v1 != nil {
return v1.ToRawInfo()
}
// {Name:queryParameterSubSchema Type:QueryParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v2 := m.GetQueryParameterSubSchema()
if v2 != nil {
return v2.ToRawInfo()
}
// {Name:pathParameterSubSchema Type:PathParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v3 := m.GetPathParameterSubSchema()
if v3 != nil {
return v3.ToRawInfo()
}
return nil
}
|
go
|
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()
}
// {Name:formDataParameterSubSchema Type:FormDataParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v1 := m.GetFormDataParameterSubSchema()
if v1 != nil {
return v1.ToRawInfo()
}
// {Name:queryParameterSubSchema Type:QueryParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v2 := m.GetQueryParameterSubSchema()
if v2 != nil {
return v2.ToRawInfo()
}
// {Name:pathParameterSubSchema Type:PathParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v3 := m.GetPathParameterSubSchema()
if v3 != nil {
return v3.ToRawInfo()
}
return nil
}
|
[
"func",
"(",
"m",
"*",
"NonBodyParameter",
")",
"ToRawInfo",
"(",
")",
"interface",
"{",
"}",
"{",
"// ONE OF WRAPPER",
"// NonBodyParameter",
"// {Name:headerParameterSubSchema Type:HeaderParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"v0",
":=",
"m",
".",
"GetHeaderParameterSubSchema",
"(",
")",
"\n",
"if",
"v0",
"!=",
"nil",
"{",
"return",
"v0",
".",
"ToRawInfo",
"(",
")",
"\n",
"}",
"\n",
"// {Name:formDataParameterSubSchema Type:FormDataParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"v1",
":=",
"m",
".",
"GetFormDataParameterSubSchema",
"(",
")",
"\n",
"if",
"v1",
"!=",
"nil",
"{",
"return",
"v1",
".",
"ToRawInfo",
"(",
")",
"\n",
"}",
"\n",
"// {Name:queryParameterSubSchema Type:QueryParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"v2",
":=",
"m",
".",
"GetQueryParameterSubSchema",
"(",
")",
"\n",
"if",
"v2",
"!=",
"nil",
"{",
"return",
"v2",
".",
"ToRawInfo",
"(",
")",
"\n",
"}",
"\n",
"// {Name:pathParameterSubSchema Type:PathParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"v3",
":=",
"m",
".",
"GetPathParameterSubSchema",
"(",
")",
"\n",
"if",
"v3",
"!=",
"nil",
"{",
"return",
"v3",
".",
"ToRawInfo",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
// ToRawInfo returns a description of NonBodyParameter suitable for JSON or YAML export.
|
[
"ToRawInfo",
"returns",
"a",
"description",
"of",
"NonBodyParameter",
"suitable",
"for",
"JSON",
"or",
"YAML",
"export",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L7864-L7888
|
18,759
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ToRawInfo
|
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.Flow})
if m.Scopes != nil {
info = append(info, yaml.MapItem{Key: "scopes", Value: m.Scopes.ToRawInfo()})
}
// &{Name:scopes Type:Oauth2Scopes StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
// always include this required field.
info = append(info, yaml.MapItem{Key: "authorizationUrl", Value: m.AuthorizationUrl})
// always include this required field.
info = append(info, yaml.MapItem{Key: "tokenUrl", Value: m.TokenUrl})
if m.Description != "" {
info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
}
if m.VendorExtension != nil {
for _, item := range m.VendorExtension {
info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
}
}
// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
return info
}
|
go
|
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.Flow})
if m.Scopes != nil {
info = append(info, yaml.MapItem{Key: "scopes", Value: m.Scopes.ToRawInfo()})
}
// &{Name:scopes Type:Oauth2Scopes StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
// always include this required field.
info = append(info, yaml.MapItem{Key: "authorizationUrl", Value: m.AuthorizationUrl})
// always include this required field.
info = append(info, yaml.MapItem{Key: "tokenUrl", Value: m.TokenUrl})
if m.Description != "" {
info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
}
if m.VendorExtension != nil {
for _, item := range m.VendorExtension {
info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
}
}
// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
return info
}
|
[
"func",
"(",
"m",
"*",
"Oauth2AccessCodeSecurity",
")",
"ToRawInfo",
"(",
")",
"interface",
"{",
"}",
"{",
"info",
":=",
"yaml",
".",
"MapSlice",
"{",
"}",
"\n",
"if",
"m",
"==",
"nil",
"{",
"return",
"info",
"\n",
"}",
"\n",
"// always include this required field.",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Type",
"}",
")",
"\n",
"// always include this required field.",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Flow",
"}",
")",
"\n",
"if",
"m",
".",
"Scopes",
"!=",
"nil",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Scopes",
".",
"ToRawInfo",
"(",
")",
"}",
")",
"\n",
"}",
"\n",
"// &{Name:scopes Type:Oauth2Scopes StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"// always include this required field.",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"AuthorizationUrl",
"}",
")",
"\n",
"// always include this required field.",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"TokenUrl",
"}",
")",
"\n",
"if",
"m",
".",
"Description",
"!=",
"\"",
"\"",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Description",
"}",
")",
"\n",
"}",
"\n",
"if",
"m",
".",
"VendorExtension",
"!=",
"nil",
"{",
"for",
"_",
",",
"item",
":=",
"range",
"m",
".",
"VendorExtension",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"item",
".",
"Name",
",",
"Value",
":",
"item",
".",
"Value",
".",
"ToRawInfo",
"(",
")",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"// &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}",
"return",
"info",
"\n",
"}"
] |
// ToRawInfo returns a description of Oauth2AccessCodeSecurity suitable for JSON or YAML export.
|
[
"ToRawInfo",
"returns",
"a",
"description",
"of",
"Oauth2AccessCodeSecurity",
"suitable",
"for",
"JSON",
"or",
"YAML",
"export",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L7891-L7918
|
18,760
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ToRawInfo
|
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
|
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
}
|
[
"func",
"(",
"m",
"*",
"Oauth2Scopes",
")",
"ToRawInfo",
"(",
")",
"interface",
"{",
"}",
"{",
"info",
":=",
"yaml",
".",
"MapSlice",
"{",
"}",
"\n",
"if",
"m",
"==",
"nil",
"{",
"return",
"info",
"\n",
"}",
"\n",
"// &{Name:additionalProperties Type:NamedString StringEnumValues:[] MapType:string Repeated:true Pattern: Implicit:true Description:}",
"return",
"info",
"\n",
"}"
] |
// ToRawInfo returns a description of Oauth2Scopes suitable for JSON or YAML export.
|
[
"ToRawInfo",
"returns",
"a",
"description",
"of",
"Oauth2Scopes",
"suitable",
"for",
"JSON",
"or",
"YAML",
"export",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L8005-L8012
|
18,761
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ToRawInfo
|
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 StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v1 := m.GetJsonReference()
if v1 != nil {
return v1.ToRawInfo()
}
return nil
}
|
go
|
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 StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v1 := m.GetJsonReference()
if v1 != nil {
return v1.ToRawInfo()
}
return nil
}
|
[
"func",
"(",
"m",
"*",
"ParametersItem",
")",
"ToRawInfo",
"(",
")",
"interface",
"{",
"}",
"{",
"// ONE OF WRAPPER",
"// ParametersItem",
"// {Name:parameter Type:Parameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"v0",
":=",
"m",
".",
"GetParameter",
"(",
")",
"\n",
"if",
"v0",
"!=",
"nil",
"{",
"return",
"v0",
".",
"ToRawInfo",
"(",
")",
"\n",
"}",
"\n",
"// {Name:jsonReference Type:JsonReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"v1",
":=",
"m",
".",
"GetJsonReference",
"(",
")",
"\n",
"if",
"v1",
"!=",
"nil",
"{",
"return",
"v1",
".",
"ToRawInfo",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
// ToRawInfo returns a description of ParametersItem suitable for JSON or YAML export.
|
[
"ToRawInfo",
"returns",
"a",
"description",
"of",
"ParametersItem",
"suitable",
"for",
"JSON",
"or",
"YAML",
"export",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L8109-L8123
|
18,762
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ToRawInfo
|
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 StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v1 := m.GetJsonReference()
if v1 != nil {
return v1.ToRawInfo()
}
return nil
}
|
go
|
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 StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v1 := m.GetJsonReference()
if v1 != nil {
return v1.ToRawInfo()
}
return nil
}
|
[
"func",
"(",
"m",
"*",
"ResponseValue",
")",
"ToRawInfo",
"(",
")",
"interface",
"{",
"}",
"{",
"// ONE OF WRAPPER",
"// ResponseValue",
"// {Name:response Type:Response StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"v0",
":=",
"m",
".",
"GetResponse",
"(",
")",
"\n",
"if",
"v0",
"!=",
"nil",
"{",
"return",
"v0",
".",
"ToRawInfo",
"(",
")",
"\n",
"}",
"\n",
"// {Name:jsonReference Type:JsonReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"v1",
":=",
"m",
".",
"GetJsonReference",
"(",
")",
"\n",
"if",
"v1",
"!=",
"nil",
"{",
"return",
"v1",
".",
"ToRawInfo",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
// ToRawInfo returns a description of ResponseValue suitable for JSON or YAML export.
|
[
"ToRawInfo",
"returns",
"a",
"description",
"of",
"ResponseValue",
"suitable",
"for",
"JSON",
"or",
"YAML",
"export",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L8505-L8519
|
18,763
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ToRawInfo
|
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: Repeated:false Pattern: Implicit:false Description:}
v1 := m.GetFileSchema()
if v1 != nil {
return v1.ToRawInfo()
}
return nil
}
|
go
|
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: Repeated:false Pattern: Implicit:false Description:}
v1 := m.GetFileSchema()
if v1 != nil {
return v1.ToRawInfo()
}
return nil
}
|
[
"func",
"(",
"m",
"*",
"SchemaItem",
")",
"ToRawInfo",
"(",
")",
"interface",
"{",
"}",
"{",
"// ONE OF WRAPPER",
"// SchemaItem",
"// {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"v0",
":=",
"m",
".",
"GetSchema",
"(",
")",
"\n",
"if",
"v0",
"!=",
"nil",
"{",
"return",
"v0",
".",
"ToRawInfo",
"(",
")",
"\n",
"}",
"\n",
"// {Name:fileSchema Type:FileSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"v1",
":=",
"m",
".",
"GetFileSchema",
"(",
")",
"\n",
"if",
"v1",
"!=",
"nil",
"{",
"return",
"v1",
".",
"ToRawInfo",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
// ToRawInfo returns a description of SchemaItem suitable for JSON or YAML export.
|
[
"ToRawInfo",
"returns",
"a",
"description",
"of",
"SchemaItem",
"suitable",
"for",
"JSON",
"or",
"YAML",
"export",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L8674-L8688
|
18,764
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ToRawInfo
|
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 {
return v0.ToRawInfo()
}
// {Name:apiKeySecurity Type:ApiKeySecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v1 := m.GetApiKeySecurity()
if v1 != nil {
return v1.ToRawInfo()
}
// {Name:oauth2ImplicitSecurity Type:Oauth2ImplicitSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v2 := m.GetOauth2ImplicitSecurity()
if v2 != nil {
return v2.ToRawInfo()
}
// {Name:oauth2PasswordSecurity Type:Oauth2PasswordSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v3 := m.GetOauth2PasswordSecurity()
if v3 != nil {
return v3.ToRawInfo()
}
// {Name:oauth2ApplicationSecurity Type:Oauth2ApplicationSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v4 := m.GetOauth2ApplicationSecurity()
if v4 != nil {
return v4.ToRawInfo()
}
// {Name:oauth2AccessCodeSecurity Type:Oauth2AccessCodeSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v5 := m.GetOauth2AccessCodeSecurity()
if v5 != nil {
return v5.ToRawInfo()
}
return nil
}
|
go
|
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 {
return v0.ToRawInfo()
}
// {Name:apiKeySecurity Type:ApiKeySecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v1 := m.GetApiKeySecurity()
if v1 != nil {
return v1.ToRawInfo()
}
// {Name:oauth2ImplicitSecurity Type:Oauth2ImplicitSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v2 := m.GetOauth2ImplicitSecurity()
if v2 != nil {
return v2.ToRawInfo()
}
// {Name:oauth2PasswordSecurity Type:Oauth2PasswordSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v3 := m.GetOauth2PasswordSecurity()
if v3 != nil {
return v3.ToRawInfo()
}
// {Name:oauth2ApplicationSecurity Type:Oauth2ApplicationSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v4 := m.GetOauth2ApplicationSecurity()
if v4 != nil {
return v4.ToRawInfo()
}
// {Name:oauth2AccessCodeSecurity Type:Oauth2AccessCodeSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
v5 := m.GetOauth2AccessCodeSecurity()
if v5 != nil {
return v5.ToRawInfo()
}
return nil
}
|
[
"func",
"(",
"m",
"*",
"SecurityDefinitionsItem",
")",
"ToRawInfo",
"(",
")",
"interface",
"{",
"}",
"{",
"// ONE OF WRAPPER",
"// SecurityDefinitionsItem",
"// {Name:basicAuthenticationSecurity Type:BasicAuthenticationSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"v0",
":=",
"m",
".",
"GetBasicAuthenticationSecurity",
"(",
")",
"\n",
"if",
"v0",
"!=",
"nil",
"{",
"return",
"v0",
".",
"ToRawInfo",
"(",
")",
"\n",
"}",
"\n",
"// {Name:apiKeySecurity Type:ApiKeySecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"v1",
":=",
"m",
".",
"GetApiKeySecurity",
"(",
")",
"\n",
"if",
"v1",
"!=",
"nil",
"{",
"return",
"v1",
".",
"ToRawInfo",
"(",
")",
"\n",
"}",
"\n",
"// {Name:oauth2ImplicitSecurity Type:Oauth2ImplicitSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"v2",
":=",
"m",
".",
"GetOauth2ImplicitSecurity",
"(",
")",
"\n",
"if",
"v2",
"!=",
"nil",
"{",
"return",
"v2",
".",
"ToRawInfo",
"(",
")",
"\n",
"}",
"\n",
"// {Name:oauth2PasswordSecurity Type:Oauth2PasswordSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"v3",
":=",
"m",
".",
"GetOauth2PasswordSecurity",
"(",
")",
"\n",
"if",
"v3",
"!=",
"nil",
"{",
"return",
"v3",
".",
"ToRawInfo",
"(",
")",
"\n",
"}",
"\n",
"// {Name:oauth2ApplicationSecurity Type:Oauth2ApplicationSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"v4",
":=",
"m",
".",
"GetOauth2ApplicationSecurity",
"(",
")",
"\n",
"if",
"v4",
"!=",
"nil",
"{",
"return",
"v4",
".",
"ToRawInfo",
"(",
")",
"\n",
"}",
"\n",
"// {Name:oauth2AccessCodeSecurity Type:Oauth2AccessCodeSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}",
"v5",
":=",
"m",
".",
"GetOauth2AccessCodeSecurity",
"(",
")",
"\n",
"if",
"v5",
"!=",
"nil",
"{",
"return",
"v5",
".",
"ToRawInfo",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
// ToRawInfo returns a description of SecurityDefinitionsItem suitable for JSON or YAML export.
|
[
"ToRawInfo",
"returns",
"a",
"description",
"of",
"SecurityDefinitionsItem",
"suitable",
"for",
"JSON",
"or",
"YAML",
"export",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L8706-L8740
|
18,765
|
googleapis/gnostic
|
OpenAPIv2/OpenAPIv2.go
|
ToRawInfo
|
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
|
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
}
|
[
"func",
"(",
"m",
"*",
"TypeItem",
")",
"ToRawInfo",
"(",
")",
"interface",
"{",
"}",
"{",
"info",
":=",
"yaml",
".",
"MapSlice",
"{",
"}",
"\n",
"if",
"m",
"==",
"nil",
"{",
"return",
"info",
"\n",
"}",
"\n",
"if",
"len",
"(",
"m",
".",
"Value",
")",
"!=",
"0",
"{",
"info",
"=",
"append",
"(",
"info",
",",
"yaml",
".",
"MapItem",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"m",
".",
"Value",
"}",
")",
"\n",
"}",
"\n",
"return",
"info",
"\n",
"}"
] |
// ToRawInfo returns a description of TypeItem suitable for JSON or YAML export.
|
[
"ToRawInfo",
"returns",
"a",
"description",
"of",
"TypeItem",
"suitable",
"for",
"JSON",
"or",
"YAML",
"export",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/OpenAPIv2/OpenAPIv2.go#L8787-L8796
|
18,766
|
googleapis/gnostic
|
surface/model_openapiv3.go
|
build
|
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.buildTypeFromSchemaOrReference(pair.Name, pair.Value)
if err != nil {
return err
}
if t != nil {
b.model.addType(t)
}
}
}
// Collect service method descriptions from each PathItem.
if document.Paths != nil {
for _, pair := range document.Paths.Path {
b.buildMethodFromPathItem(pair.Name, pair.Value)
}
}
return err
}
|
go
|
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.buildTypeFromSchemaOrReference(pair.Name, pair.Value)
if err != nil {
return err
}
if t != nil {
b.model.addType(t)
}
}
}
// Collect service method descriptions from each PathItem.
if document.Paths != nil {
for _, pair := range document.Paths.Path {
b.buildMethodFromPathItem(pair.Name, pair.Value)
}
}
return err
}
|
[
"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",
".",
"buildTypeFromSchemaOrReference",
"(",
"pair",
".",
"Name",
",",
"pair",
".",
"Value",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"t",
"!=",
"nil",
"{",
"b",
".",
"model",
".",
"addType",
"(",
"t",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"// Collect service method descriptions from each PathItem.",
"if",
"document",
".",
"Paths",
"!=",
"nil",
"{",
"for",
"_",
",",
"pair",
":=",
"range",
"document",
".",
"Paths",
".",
"Path",
"{",
"b",
".",
"buildMethodFromPathItem",
"(",
"pair",
".",
"Name",
",",
"pair",
".",
"Value",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
// build builds an API service description, preprocessing its types and methods for code generation.
|
[
"build",
"builds",
"an",
"API",
"service",
"description",
"preprocessing",
"its",
"types",
"and",
"methods",
"for",
"code",
"generation",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/surface/model_openapiv3.go#L53-L73
|
18,767
|
googleapis/gnostic
|
surface/model_openapiv3.go
|
buildTypeFromSchemaOrReference
|
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([]*Field, 0)
if schema.Properties != nil {
if len(schema.Properties.AdditionalProperties) > 0 {
// If the schema has properties, generate a struct.
t.Kind = TypeKind_STRUCT
}
for _, pair2 := range schema.Properties.AdditionalProperties {
if schema := pair2.Value; schema != nil {
var f Field
f.Name = pair2.Name
f.Kind, f.Type, f.Format = b.typeForSchemaOrReference(schema)
f.Serialize = true
t.addField(&f)
}
}
}
if len(t.Fields) == 0 {
if schema.AdditionalProperties != nil {
// If the schema has no fixed properties and additional properties of a specified type,
// generate a map pointing to objects of that type.
t.Kind = TypeKind_OBJECT
t.ContentType = typeForRef(schema.AdditionalProperties.GetSchemaOrReference().GetReference().GetXRef())
}
}
return t, err
} else {
return nil, errors.New("unable to determine service type for referenced schema " + name)
}
}
|
go
|
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([]*Field, 0)
if schema.Properties != nil {
if len(schema.Properties.AdditionalProperties) > 0 {
// If the schema has properties, generate a struct.
t.Kind = TypeKind_STRUCT
}
for _, pair2 := range schema.Properties.AdditionalProperties {
if schema := pair2.Value; schema != nil {
var f Field
f.Name = pair2.Name
f.Kind, f.Type, f.Format = b.typeForSchemaOrReference(schema)
f.Serialize = true
t.addField(&f)
}
}
}
if len(t.Fields) == 0 {
if schema.AdditionalProperties != nil {
// If the schema has no fixed properties and additional properties of a specified type,
// generate a map pointing to objects of that type.
t.Kind = TypeKind_OBJECT
t.ContentType = typeForRef(schema.AdditionalProperties.GetSchemaOrReference().GetReference().GetXRef())
}
}
return t, err
} else {
return nil, errors.New("unable to determine service type for referenced schema " + name)
}
}
|
[
"func",
"(",
"b",
"*",
"OpenAPI3Builder",
")",
"buildTypeFromSchemaOrReference",
"(",
"name",
"string",
",",
"schemaOrReference",
"*",
"openapiv3",
".",
"SchemaOrReference",
")",
"(",
"t",
"*",
"Type",
",",
"err",
"error",
")",
"{",
"if",
"schema",
":=",
"schemaOrReference",
".",
"GetSchema",
"(",
")",
";",
"schema",
"!=",
"nil",
"{",
"t",
"=",
"&",
"Type",
"{",
"}",
"\n",
"t",
".",
"Name",
"=",
"name",
"\n",
"t",
".",
"Description",
"=",
"\"",
"\"",
"+",
"name",
"\n",
"t",
".",
"Fields",
"=",
"make",
"(",
"[",
"]",
"*",
"Field",
",",
"0",
")",
"\n",
"if",
"schema",
".",
"Properties",
"!=",
"nil",
"{",
"if",
"len",
"(",
"schema",
".",
"Properties",
".",
"AdditionalProperties",
")",
">",
"0",
"{",
"// If the schema has properties, generate a struct.",
"t",
".",
"Kind",
"=",
"TypeKind_STRUCT",
"\n",
"}",
"\n",
"for",
"_",
",",
"pair2",
":=",
"range",
"schema",
".",
"Properties",
".",
"AdditionalProperties",
"{",
"if",
"schema",
":=",
"pair2",
".",
"Value",
";",
"schema",
"!=",
"nil",
"{",
"var",
"f",
"Field",
"\n",
"f",
".",
"Name",
"=",
"pair2",
".",
"Name",
"\n",
"f",
".",
"Kind",
",",
"f",
".",
"Type",
",",
"f",
".",
"Format",
"=",
"b",
".",
"typeForSchemaOrReference",
"(",
"schema",
")",
"\n",
"f",
".",
"Serialize",
"=",
"true",
"\n",
"t",
".",
"addField",
"(",
"&",
"f",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"t",
".",
"Fields",
")",
"==",
"0",
"{",
"if",
"schema",
".",
"AdditionalProperties",
"!=",
"nil",
"{",
"// If the schema has no fixed properties and additional properties of a specified type,",
"// generate a map pointing to objects of that type.",
"t",
".",
"Kind",
"=",
"TypeKind_OBJECT",
"\n",
"t",
".",
"ContentType",
"=",
"typeForRef",
"(",
"schema",
".",
"AdditionalProperties",
".",
"GetSchemaOrReference",
"(",
")",
".",
"GetReference",
"(",
")",
".",
"GetXRef",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"t",
",",
"err",
"\n",
"}",
"else",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
"+",
"name",
")",
"\n",
"}",
"\n",
"}"
] |
// buildTypeFromSchemaOrReference builds a service type description from a schema in the API description.
|
[
"buildTypeFromSchemaOrReference",
"builds",
"a",
"service",
"type",
"description",
"from",
"a",
"schema",
"in",
"the",
"API",
"description",
"."
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/surface/model_openapiv3.go#L76-L111
|
18,768
|
googleapis/gnostic
|
surface/model_openapiv3.go
|
buildMethodFromPathItem
|
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 = pathItem.Put
case "POST":
op = pathItem.Post
case "DELETE":
op = pathItem.Delete
case "OPTIONS":
op = pathItem.Options
case "HEAD":
op = pathItem.Head
case "PATCH":
op = pathItem.Patch
case "TRACE":
op = pathItem.Trace
}
if op != nil {
var m Method
m.Operation = op.OperationId
m.Path = path
m.Method = method
m.Name = sanitizeOperationName(op.OperationId)
if m.Name == "" {
m.Name = generateOperationName(method, path)
}
m.Description = op.Description
m.ParametersTypeName, err = b.buildTypeFromParameters(m.Name, op.Parameters, op.RequestBody)
m.ResponsesTypeName, err = b.buildTypeFromResponses(&m, m.Name, op.Responses)
b.model.addMethod(&m)
}
}
return err
}
|
go
|
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 = pathItem.Put
case "POST":
op = pathItem.Post
case "DELETE":
op = pathItem.Delete
case "OPTIONS":
op = pathItem.Options
case "HEAD":
op = pathItem.Head
case "PATCH":
op = pathItem.Patch
case "TRACE":
op = pathItem.Trace
}
if op != nil {
var m Method
m.Operation = op.OperationId
m.Path = path
m.Method = method
m.Name = sanitizeOperationName(op.OperationId)
if m.Name == "" {
m.Name = generateOperationName(method, path)
}
m.Description = op.Description
m.ParametersTypeName, err = b.buildTypeFromParameters(m.Name, op.Parameters, op.RequestBody)
m.ResponsesTypeName, err = b.buildTypeFromResponses(&m, m.Name, op.Responses)
b.model.addMethod(&m)
}
}
return err
}
|
[
"func",
"(",
"b",
"*",
"OpenAPI3Builder",
")",
"buildMethodFromPathItem",
"(",
"path",
"string",
",",
"pathItem",
"*",
"openapiv3",
".",
"PathItem",
")",
"(",
"err",
"error",
")",
"{",
"for",
"_",
",",
"method",
":=",
"range",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"{",
"var",
"op",
"*",
"openapiv3",
".",
"Operation",
"\n",
"switch",
"method",
"{",
"case",
"\"",
"\"",
":",
"op",
"=",
"pathItem",
".",
"Get",
"\n",
"case",
"\"",
"\"",
":",
"op",
"=",
"pathItem",
".",
"Put",
"\n",
"case",
"\"",
"\"",
":",
"op",
"=",
"pathItem",
".",
"Post",
"\n",
"case",
"\"",
"\"",
":",
"op",
"=",
"pathItem",
".",
"Delete",
"\n",
"case",
"\"",
"\"",
":",
"op",
"=",
"pathItem",
".",
"Options",
"\n",
"case",
"\"",
"\"",
":",
"op",
"=",
"pathItem",
".",
"Head",
"\n",
"case",
"\"",
"\"",
":",
"op",
"=",
"pathItem",
".",
"Patch",
"\n",
"case",
"\"",
"\"",
":",
"op",
"=",
"pathItem",
".",
"Trace",
"\n",
"}",
"\n",
"if",
"op",
"!=",
"nil",
"{",
"var",
"m",
"Method",
"\n",
"m",
".",
"Operation",
"=",
"op",
".",
"OperationId",
"\n",
"m",
".",
"Path",
"=",
"path",
"\n",
"m",
".",
"Method",
"=",
"method",
"\n",
"m",
".",
"Name",
"=",
"sanitizeOperationName",
"(",
"op",
".",
"OperationId",
")",
"\n",
"if",
"m",
".",
"Name",
"==",
"\"",
"\"",
"{",
"m",
".",
"Name",
"=",
"generateOperationName",
"(",
"method",
",",
"path",
")",
"\n",
"}",
"\n",
"m",
".",
"Description",
"=",
"op",
".",
"Description",
"\n",
"m",
".",
"ParametersTypeName",
",",
"err",
"=",
"b",
".",
"buildTypeFromParameters",
"(",
"m",
".",
"Name",
",",
"op",
".",
"Parameters",
",",
"op",
".",
"RequestBody",
")",
"\n",
"m",
".",
"ResponsesTypeName",
",",
"err",
"=",
"b",
".",
"buildTypeFromResponses",
"(",
"&",
"m",
",",
"m",
".",
"Name",
",",
"op",
".",
"Responses",
")",
"\n",
"b",
".",
"model",
".",
"addMethod",
"(",
"&",
"m",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
// buildMethodFromOperation builds a service method description
|
[
"buildMethodFromOperation",
"builds",
"a",
"service",
"method",
"description"
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/surface/model_openapiv3.go#L114-L153
|
18,769
|
googleapis/gnostic
|
surface/model_openapiv3.go
|
buildTypeFromParameters
|
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.Fields = make([]*Field, 0)
for _, parametersItem := range parameters {
var f Field
f.Type = fmt.Sprintf("%+v", parametersItem)
parameter := parametersItem.GetParameter()
if parameter != nil {
switch parameter.In {
case "body":
f.Position = Position_BODY
case "header":
f.Position = Position_HEADER
case "formdata":
f.Position = Position_FORMDATA
case "query":
f.Position = Position_QUERY
case "path":
f.Position = Position_PATH
}
f.Name = parameter.Name
if parameter.GetSchema() != nil && parameter.GetSchema() != nil {
f.Kind, f.Type, f.Format = b.typeForSchemaOrReference(parameter.GetSchema())
}
f.Serialize = true
t.addField(&f)
}
}
if requestBody != nil {
content := requestBody.GetRequestBody().GetContent()
if content != nil {
for _, pair2 := range content.GetAdditionalProperties() {
if pair2.Name != "application/json" {
log.Printf("unimplemented: %q requestBody(%s)", name, pair2.Name)
continue
}
var f Field
f.Position = Position_BODY
f.Kind, f.Type, f.Format = b.typeForSchemaOrReference(pair2.GetValue().GetSchema())
f.Name = strings.ToLower(f.Type) // use the schema name as the parameter name, since none is directly specified
f.Serialize = true
t.addField(&f)
}
}
}
if len(t.Fields) > 0 {
b.model.addType(t)
return t.Name, err
}
return "", err
}
|
go
|
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.Fields = make([]*Field, 0)
for _, parametersItem := range parameters {
var f Field
f.Type = fmt.Sprintf("%+v", parametersItem)
parameter := parametersItem.GetParameter()
if parameter != nil {
switch parameter.In {
case "body":
f.Position = Position_BODY
case "header":
f.Position = Position_HEADER
case "formdata":
f.Position = Position_FORMDATA
case "query":
f.Position = Position_QUERY
case "path":
f.Position = Position_PATH
}
f.Name = parameter.Name
if parameter.GetSchema() != nil && parameter.GetSchema() != nil {
f.Kind, f.Type, f.Format = b.typeForSchemaOrReference(parameter.GetSchema())
}
f.Serialize = true
t.addField(&f)
}
}
if requestBody != nil {
content := requestBody.GetRequestBody().GetContent()
if content != nil {
for _, pair2 := range content.GetAdditionalProperties() {
if pair2.Name != "application/json" {
log.Printf("unimplemented: %q requestBody(%s)", name, pair2.Name)
continue
}
var f Field
f.Position = Position_BODY
f.Kind, f.Type, f.Format = b.typeForSchemaOrReference(pair2.GetValue().GetSchema())
f.Name = strings.ToLower(f.Type) // use the schema name as the parameter name, since none is directly specified
f.Serialize = true
t.addField(&f)
}
}
}
if len(t.Fields) > 0 {
b.model.addType(t)
return t.Name, err
}
return "", err
}
|
[
"func",
"(",
"b",
"*",
"OpenAPI3Builder",
")",
"buildTypeFromParameters",
"(",
"name",
"string",
",",
"parameters",
"[",
"]",
"*",
"openapiv3",
".",
"ParameterOrReference",
",",
"requestBody",
"*",
"openapiv3",
".",
"RequestBodyOrReference",
")",
"(",
"typeName",
"string",
",",
"err",
"error",
")",
"{",
"t",
":=",
"&",
"Type",
"{",
"}",
"\n",
"t",
".",
"Name",
"=",
"name",
"+",
"\"",
"\"",
"\n",
"t",
".",
"Description",
"=",
"t",
".",
"Name",
"+",
"\"",
"\"",
"+",
"name",
"\n",
"t",
".",
"Kind",
"=",
"TypeKind_STRUCT",
"\n",
"t",
".",
"Fields",
"=",
"make",
"(",
"[",
"]",
"*",
"Field",
",",
"0",
")",
"\n",
"for",
"_",
",",
"parametersItem",
":=",
"range",
"parameters",
"{",
"var",
"f",
"Field",
"\n",
"f",
".",
"Type",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"parametersItem",
")",
"\n",
"parameter",
":=",
"parametersItem",
".",
"GetParameter",
"(",
")",
"\n",
"if",
"parameter",
"!=",
"nil",
"{",
"switch",
"parameter",
".",
"In",
"{",
"case",
"\"",
"\"",
":",
"f",
".",
"Position",
"=",
"Position_BODY",
"\n",
"case",
"\"",
"\"",
":",
"f",
".",
"Position",
"=",
"Position_HEADER",
"\n",
"case",
"\"",
"\"",
":",
"f",
".",
"Position",
"=",
"Position_FORMDATA",
"\n",
"case",
"\"",
"\"",
":",
"f",
".",
"Position",
"=",
"Position_QUERY",
"\n",
"case",
"\"",
"\"",
":",
"f",
".",
"Position",
"=",
"Position_PATH",
"\n",
"}",
"\n",
"f",
".",
"Name",
"=",
"parameter",
".",
"Name",
"\n",
"if",
"parameter",
".",
"GetSchema",
"(",
")",
"!=",
"nil",
"&&",
"parameter",
".",
"GetSchema",
"(",
")",
"!=",
"nil",
"{",
"f",
".",
"Kind",
",",
"f",
".",
"Type",
",",
"f",
".",
"Format",
"=",
"b",
".",
"typeForSchemaOrReference",
"(",
"parameter",
".",
"GetSchema",
"(",
")",
")",
"\n",
"}",
"\n",
"f",
".",
"Serialize",
"=",
"true",
"\n",
"t",
".",
"addField",
"(",
"&",
"f",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"requestBody",
"!=",
"nil",
"{",
"content",
":=",
"requestBody",
".",
"GetRequestBody",
"(",
")",
".",
"GetContent",
"(",
")",
"\n",
"if",
"content",
"!=",
"nil",
"{",
"for",
"_",
",",
"pair2",
":=",
"range",
"content",
".",
"GetAdditionalProperties",
"(",
")",
"{",
"if",
"pair2",
".",
"Name",
"!=",
"\"",
"\"",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"name",
",",
"pair2",
".",
"Name",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"var",
"f",
"Field",
"\n",
"f",
".",
"Position",
"=",
"Position_BODY",
"\n",
"f",
".",
"Kind",
",",
"f",
".",
"Type",
",",
"f",
".",
"Format",
"=",
"b",
".",
"typeForSchemaOrReference",
"(",
"pair2",
".",
"GetValue",
"(",
")",
".",
"GetSchema",
"(",
")",
")",
"\n",
"f",
".",
"Name",
"=",
"strings",
".",
"ToLower",
"(",
"f",
".",
"Type",
")",
"// use the schema name as the parameter name, since none is directly specified",
"\n",
"f",
".",
"Serialize",
"=",
"true",
"\n",
"t",
".",
"addField",
"(",
"&",
"f",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"t",
".",
"Fields",
")",
">",
"0",
"{",
"b",
".",
"model",
".",
"addType",
"(",
"t",
")",
"\n",
"return",
"t",
".",
"Name",
",",
"err",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}"
] |
// buildTypeFromParameters builds a service type description from the parameters of an API method
|
[
"buildTypeFromParameters",
"builds",
"a",
"service",
"type",
"description",
"from",
"the",
"parameters",
"of",
"an",
"API",
"method"
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/surface/model_openapiv3.go#L156-L212
|
18,770
|
googleapis/gnostic
|
surface/model_openapiv3.go
|
buildTypeFromResponses
|
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(name string, value *openapiv3.ResponseOrReference) {
var f Field
f.Name = name
f.Serialize = false
response := value.GetResponse()
if response != nil && response.GetContent() != nil {
for _, pair2 := range response.GetContent().GetAdditionalProperties() {
f.Kind, f.Type, f.Format = b.typeForSchemaOrReference(pair2.GetValue().GetSchema())
f.Kind = FieldKind_REFERENCE
t.addField(&f)
}
}
}
for _, pair := range responses.ResponseOrReference {
addResponse(pair.Name, pair.Value)
}
if responses.Default != nil {
addResponse("default", responses.Default)
}
if len(t.Fields) > 0 {
b.model.addType(t)
return t.Name, err
}
return "", err
}
|
go
|
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(name string, value *openapiv3.ResponseOrReference) {
var f Field
f.Name = name
f.Serialize = false
response := value.GetResponse()
if response != nil && response.GetContent() != nil {
for _, pair2 := range response.GetContent().GetAdditionalProperties() {
f.Kind, f.Type, f.Format = b.typeForSchemaOrReference(pair2.GetValue().GetSchema())
f.Kind = FieldKind_REFERENCE
t.addField(&f)
}
}
}
for _, pair := range responses.ResponseOrReference {
addResponse(pair.Name, pair.Value)
}
if responses.Default != nil {
addResponse("default", responses.Default)
}
if len(t.Fields) > 0 {
b.model.addType(t)
return t.Name, err
}
return "", err
}
|
[
"func",
"(",
"b",
"*",
"OpenAPI3Builder",
")",
"buildTypeFromResponses",
"(",
"m",
"*",
"Method",
",",
"name",
"string",
",",
"responses",
"*",
"openapiv3",
".",
"Responses",
")",
"(",
"typeName",
"string",
",",
"err",
"error",
")",
"{",
"t",
":=",
"&",
"Type",
"{",
"}",
"\n",
"t",
".",
"Name",
"=",
"name",
"+",
"\"",
"\"",
"\n",
"t",
".",
"Description",
"=",
"t",
".",
"Name",
"+",
"\"",
"\"",
"+",
"name",
"\n",
"t",
".",
"Kind",
"=",
"TypeKind_STRUCT",
"\n",
"t",
".",
"Fields",
"=",
"make",
"(",
"[",
"]",
"*",
"Field",
",",
"0",
")",
"\n\n",
"addResponse",
":=",
"func",
"(",
"name",
"string",
",",
"value",
"*",
"openapiv3",
".",
"ResponseOrReference",
")",
"{",
"var",
"f",
"Field",
"\n",
"f",
".",
"Name",
"=",
"name",
"\n",
"f",
".",
"Serialize",
"=",
"false",
"\n",
"response",
":=",
"value",
".",
"GetResponse",
"(",
")",
"\n",
"if",
"response",
"!=",
"nil",
"&&",
"response",
".",
"GetContent",
"(",
")",
"!=",
"nil",
"{",
"for",
"_",
",",
"pair2",
":=",
"range",
"response",
".",
"GetContent",
"(",
")",
".",
"GetAdditionalProperties",
"(",
")",
"{",
"f",
".",
"Kind",
",",
"f",
".",
"Type",
",",
"f",
".",
"Format",
"=",
"b",
".",
"typeForSchemaOrReference",
"(",
"pair2",
".",
"GetValue",
"(",
")",
".",
"GetSchema",
"(",
")",
")",
"\n",
"f",
".",
"Kind",
"=",
"FieldKind_REFERENCE",
"\n",
"t",
".",
"addField",
"(",
"&",
"f",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"pair",
":=",
"range",
"responses",
".",
"ResponseOrReference",
"{",
"addResponse",
"(",
"pair",
".",
"Name",
",",
"pair",
".",
"Value",
")",
"\n",
"}",
"\n",
"if",
"responses",
".",
"Default",
"!=",
"nil",
"{",
"addResponse",
"(",
"\"",
"\"",
",",
"responses",
".",
"Default",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"t",
".",
"Fields",
")",
">",
"0",
"{",
"b",
".",
"model",
".",
"addType",
"(",
"t",
")",
"\n",
"return",
"t",
".",
"Name",
",",
"err",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}"
] |
// buildTypeFromResponses builds a service type description from the responses of an API method
|
[
"buildTypeFromResponses",
"builds",
"a",
"service",
"type",
"description",
"from",
"the",
"responses",
"of",
"an",
"API",
"method"
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/surface/model_openapiv3.go#L215-L251
|
18,771
|
googleapis/gnostic
|
surface/model_openapiv3.go
|
typeForSchemaOrReference
|
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), ""
}
return FieldKind_SCALAR, "todo", ""
}
|
go
|
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), ""
}
return FieldKind_SCALAR, "todo", ""
}
|
[
"func",
"(",
"b",
"*",
"OpenAPI3Builder",
")",
"typeForSchemaOrReference",
"(",
"value",
"*",
"openapiv3",
".",
"SchemaOrReference",
")",
"(",
"kind",
"FieldKind",
",",
"typeName",
",",
"format",
"string",
")",
"{",
"if",
"value",
".",
"GetSchema",
"(",
")",
"!=",
"nil",
"{",
"return",
"b",
".",
"typeForSchema",
"(",
"value",
".",
"GetSchema",
"(",
")",
")",
"\n",
"}",
"\n",
"if",
"value",
".",
"GetReference",
"(",
")",
"!=",
"nil",
"{",
"return",
"FieldKind_SCALAR",
",",
"typeForRef",
"(",
"value",
".",
"GetReference",
"(",
")",
".",
"XRef",
")",
",",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"FieldKind_SCALAR",
",",
"\"",
"\"",
",",
"\"",
"\"",
"\n",
"}"
] |
// typeForSchemaOrReference determines the language-specific type of a schema or reference
|
[
"typeForSchemaOrReference",
"determines",
"the",
"language",
"-",
"specific",
"type",
"of",
"a",
"schema",
"or",
"reference"
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/surface/model_openapiv3.go#L254-L262
|
18,772
|
googleapis/gnostic
|
surface/model_openapiv3.go
|
typeForSchema
|
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 "number":
return FieldKind_SCALAR, "number", format
case "boolean":
return FieldKind_SCALAR, "boolean", format
case "array":
if schema.Items != nil {
// we have an array.., but of what?
items := schema.Items
if items != nil {
a := items.GetSchemaOrReference()
if a[0].GetReference().GetXRef() != "" {
return FieldKind_ARRAY, typeForRef(a[0].GetReference().GetXRef()), format
} else if a[0].GetSchema().Type == "string" {
return FieldKind_ARRAY, "string", format
} else if a[0].GetSchema().Type == "object" {
return FieldKind_ARRAY, "object", format
}
}
}
case "object":
if schema.AdditionalProperties == nil {
return FieldKind_MAP, "object", format
}
default:
}
}
if schema.AdditionalProperties != nil {
additionalProperties := schema.AdditionalProperties
if propertySchema := additionalProperties.GetSchemaOrReference().GetReference(); propertySchema != nil {
if ref := propertySchema.XRef; ref != "" {
return FieldKind_MAP, "map[string]" + typeForRef(ref), ""
}
}
}
// this function is incomplete... use generic interface{} for now
log.Printf("unimplemented: %v", schema)
return FieldKind_SCALAR, "object", ""
}
|
go
|
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 "number":
return FieldKind_SCALAR, "number", format
case "boolean":
return FieldKind_SCALAR, "boolean", format
case "array":
if schema.Items != nil {
// we have an array.., but of what?
items := schema.Items
if items != nil {
a := items.GetSchemaOrReference()
if a[0].GetReference().GetXRef() != "" {
return FieldKind_ARRAY, typeForRef(a[0].GetReference().GetXRef()), format
} else if a[0].GetSchema().Type == "string" {
return FieldKind_ARRAY, "string", format
} else if a[0].GetSchema().Type == "object" {
return FieldKind_ARRAY, "object", format
}
}
}
case "object":
if schema.AdditionalProperties == nil {
return FieldKind_MAP, "object", format
}
default:
}
}
if schema.AdditionalProperties != nil {
additionalProperties := schema.AdditionalProperties
if propertySchema := additionalProperties.GetSchemaOrReference().GetReference(); propertySchema != nil {
if ref := propertySchema.XRef; ref != "" {
return FieldKind_MAP, "map[string]" + typeForRef(ref), ""
}
}
}
// this function is incomplete... use generic interface{} for now
log.Printf("unimplemented: %v", schema)
return FieldKind_SCALAR, "object", ""
}
|
[
"func",
"(",
"b",
"*",
"OpenAPI3Builder",
")",
"typeForSchema",
"(",
"schema",
"*",
"openapiv3",
".",
"Schema",
")",
"(",
"kind",
"FieldKind",
",",
"typeName",
",",
"format",
"string",
")",
"{",
"if",
"schema",
".",
"Type",
"!=",
"\"",
"\"",
"{",
"format",
":=",
"schema",
".",
"Format",
"\n",
"switch",
"schema",
".",
"Type",
"{",
"case",
"\"",
"\"",
":",
"return",
"FieldKind_SCALAR",
",",
"\"",
"\"",
",",
"format",
"\n",
"case",
"\"",
"\"",
":",
"return",
"FieldKind_SCALAR",
",",
"\"",
"\"",
",",
"format",
"\n",
"case",
"\"",
"\"",
":",
"return",
"FieldKind_SCALAR",
",",
"\"",
"\"",
",",
"format",
"\n",
"case",
"\"",
"\"",
":",
"return",
"FieldKind_SCALAR",
",",
"\"",
"\"",
",",
"format",
"\n",
"case",
"\"",
"\"",
":",
"if",
"schema",
".",
"Items",
"!=",
"nil",
"{",
"// we have an array.., but of what?",
"items",
":=",
"schema",
".",
"Items",
"\n",
"if",
"items",
"!=",
"nil",
"{",
"a",
":=",
"items",
".",
"GetSchemaOrReference",
"(",
")",
"\n",
"if",
"a",
"[",
"0",
"]",
".",
"GetReference",
"(",
")",
".",
"GetXRef",
"(",
")",
"!=",
"\"",
"\"",
"{",
"return",
"FieldKind_ARRAY",
",",
"typeForRef",
"(",
"a",
"[",
"0",
"]",
".",
"GetReference",
"(",
")",
".",
"GetXRef",
"(",
")",
")",
",",
"format",
"\n",
"}",
"else",
"if",
"a",
"[",
"0",
"]",
".",
"GetSchema",
"(",
")",
".",
"Type",
"==",
"\"",
"\"",
"{",
"return",
"FieldKind_ARRAY",
",",
"\"",
"\"",
",",
"format",
"\n",
"}",
"else",
"if",
"a",
"[",
"0",
"]",
".",
"GetSchema",
"(",
")",
".",
"Type",
"==",
"\"",
"\"",
"{",
"return",
"FieldKind_ARRAY",
",",
"\"",
"\"",
",",
"format",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"if",
"schema",
".",
"AdditionalProperties",
"==",
"nil",
"{",
"return",
"FieldKind_MAP",
",",
"\"",
"\"",
",",
"format",
"\n",
"}",
"\n",
"default",
":",
"}",
"\n",
"}",
"\n",
"if",
"schema",
".",
"AdditionalProperties",
"!=",
"nil",
"{",
"additionalProperties",
":=",
"schema",
".",
"AdditionalProperties",
"\n",
"if",
"propertySchema",
":=",
"additionalProperties",
".",
"GetSchemaOrReference",
"(",
")",
".",
"GetReference",
"(",
")",
";",
"propertySchema",
"!=",
"nil",
"{",
"if",
"ref",
":=",
"propertySchema",
".",
"XRef",
";",
"ref",
"!=",
"\"",
"\"",
"{",
"return",
"FieldKind_MAP",
",",
"\"",
"\"",
"+",
"typeForRef",
"(",
"ref",
")",
",",
"\"",
"\"",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"// this function is incomplete... use generic interface{} for now",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"schema",
")",
"\n",
"return",
"FieldKind_SCALAR",
",",
"\"",
"\"",
",",
"\"",
"\"",
"\n",
"}"
] |
// typeForSchema determines the language-specific type of a schema
|
[
"typeForSchema",
"determines",
"the",
"language",
"-",
"specific",
"type",
"of",
"a",
"schema"
] |
909070f02b666e4e9adf7eda93c304a8ba2a8063
|
https://github.com/googleapis/gnostic/blob/909070f02b666e4e9adf7eda93c304a8ba2a8063/surface/model_openapiv3.go#L265-L311
|
18,773
|
mafredri/cdp
|
protocol/domdebugger/domain.go
|
GetEventListeners
|
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.getEventListeners", nil, reply, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "DOMDebugger", Op: "GetEventListeners", Err: err}
}
return
}
|
go
|
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.getEventListeners", nil, reply, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "DOMDebugger", Op: "GetEventListeners", Err: err}
}
return
}
|
[
"func",
"(",
"d",
"*",
"domainClient",
")",
"GetEventListeners",
"(",
"ctx",
"context",
".",
"Context",
",",
"args",
"*",
"GetEventListenersArgs",
")",
"(",
"reply",
"*",
"GetEventListenersReply",
",",
"err",
"error",
")",
"{",
"reply",
"=",
"new",
"(",
"GetEventListenersReply",
")",
"\n",
"if",
"args",
"!=",
"nil",
"{",
"err",
"=",
"rpcc",
".",
"Invoke",
"(",
"ctx",
",",
"\"",
"\"",
",",
"args",
",",
"reply",
",",
"d",
".",
"conn",
")",
"\n",
"}",
"else",
"{",
"err",
"=",
"rpcc",
".",
"Invoke",
"(",
"ctx",
",",
"\"",
"\"",
",",
"nil",
",",
"reply",
",",
"d",
".",
"conn",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"&",
"internal",
".",
"OpError",
"{",
"Domain",
":",
"\"",
"\"",
",",
"Op",
":",
"\"",
"\"",
",",
"Err",
":",
"err",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// GetEventListeners invokes the DOMDebugger method. Returns event listeners
// of the given object.
|
[
"GetEventListeners",
"invokes",
"the",
"DOMDebugger",
"method",
".",
"Returns",
"event",
"listeners",
"of",
"the",
"given",
"object",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/domdebugger/domain.go#L29-L40
|
18,774
|
mafredri/cdp
|
protocol/headlessexperimental/domain.go
|
Disable
|
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
|
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
}
|
[
"func",
"(",
"d",
"*",
"domainClient",
")",
"Disable",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"err",
"=",
"rpcc",
".",
"Invoke",
"(",
"ctx",
",",
"\"",
"\"",
",",
"nil",
",",
"nil",
",",
"d",
".",
"conn",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"&",
"internal",
".",
"OpError",
"{",
"Domain",
":",
"\"",
"\"",
",",
"Op",
":",
"\"",
"\"",
",",
"Err",
":",
"err",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// Disable invokes the HeadlessExperimental method. Disables headless events
// for the target.
|
[
"Disable",
"invokes",
"the",
"HeadlessExperimental",
"method",
".",
"Disables",
"headless",
"events",
"for",
"the",
"target",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/headlessexperimental/domain.go#L44-L50
|
18,775
|
mafredri/cdp
|
protocol/runtime/domain.go
|
AwaitPromise
|
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)
}
if err != nil {
err = &internal.OpError{Domain: "Runtime", Op: "AwaitPromise", Err: err}
}
return
}
|
go
|
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)
}
if err != nil {
err = &internal.OpError{Domain: "Runtime", Op: "AwaitPromise", Err: err}
}
return
}
|
[
"func",
"(",
"d",
"*",
"domainClient",
")",
"AwaitPromise",
"(",
"ctx",
"context",
".",
"Context",
",",
"args",
"*",
"AwaitPromiseArgs",
")",
"(",
"reply",
"*",
"AwaitPromiseReply",
",",
"err",
"error",
")",
"{",
"reply",
"=",
"new",
"(",
"AwaitPromiseReply",
")",
"\n",
"if",
"args",
"!=",
"nil",
"{",
"err",
"=",
"rpcc",
".",
"Invoke",
"(",
"ctx",
",",
"\"",
"\"",
",",
"args",
",",
"reply",
",",
"d",
".",
"conn",
")",
"\n",
"}",
"else",
"{",
"err",
"=",
"rpcc",
".",
"Invoke",
"(",
"ctx",
",",
"\"",
"\"",
",",
"nil",
",",
"reply",
",",
"d",
".",
"conn",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"&",
"internal",
".",
"OpError",
"{",
"Domain",
":",
"\"",
"\"",
",",
"Op",
":",
"\"",
"\"",
",",
"Err",
":",
"err",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// AwaitPromise invokes the Runtime method. Add handler to promise with given
// promise object id.
|
[
"AwaitPromise",
"invokes",
"the",
"Runtime",
"method",
".",
"Add",
"handler",
"to",
"promise",
"with",
"given",
"promise",
"object",
"id",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/runtime/domain.go#L35-L46
|
18,776
|
mafredri/cdp
|
protocol/runtime/domain.go
|
CallFunctionOn
|
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, reply, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Runtime", Op: "CallFunctionOn", Err: err}
}
return
}
|
go
|
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, reply, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Runtime", Op: "CallFunctionOn", Err: err}
}
return
}
|
[
"func",
"(",
"d",
"*",
"domainClient",
")",
"CallFunctionOn",
"(",
"ctx",
"context",
".",
"Context",
",",
"args",
"*",
"CallFunctionOnArgs",
")",
"(",
"reply",
"*",
"CallFunctionOnReply",
",",
"err",
"error",
")",
"{",
"reply",
"=",
"new",
"(",
"CallFunctionOnReply",
")",
"\n",
"if",
"args",
"!=",
"nil",
"{",
"err",
"=",
"rpcc",
".",
"Invoke",
"(",
"ctx",
",",
"\"",
"\"",
",",
"args",
",",
"reply",
",",
"d",
".",
"conn",
")",
"\n",
"}",
"else",
"{",
"err",
"=",
"rpcc",
".",
"Invoke",
"(",
"ctx",
",",
"\"",
"\"",
",",
"nil",
",",
"reply",
",",
"d",
".",
"conn",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"&",
"internal",
".",
"OpError",
"{",
"Domain",
":",
"\"",
"\"",
",",
"Op",
":",
"\"",
"\"",
",",
"Err",
":",
"err",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// CallFunctionOn invokes the Runtime method. Calls function with given
// declaration on the given object. Object group of the result is inherited
// from the target object.
|
[
"CallFunctionOn",
"invokes",
"the",
"Runtime",
"method",
".",
"Calls",
"function",
"with",
"given",
"declaration",
"on",
"the",
"given",
"object",
".",
"Object",
"group",
"of",
"the",
"result",
"is",
"inherited",
"from",
"the",
"target",
"object",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/runtime/domain.go#L51-L62
|
18,777
|
mafredri/cdp
|
protocol/runtime/domain.go
|
CompileScript
|
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.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Runtime", Op: "CompileScript", Err: err}
}
return
}
|
go
|
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.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Runtime", Op: "CompileScript", Err: err}
}
return
}
|
[
"func",
"(",
"d",
"*",
"domainClient",
")",
"CompileScript",
"(",
"ctx",
"context",
".",
"Context",
",",
"args",
"*",
"CompileScriptArgs",
")",
"(",
"reply",
"*",
"CompileScriptReply",
",",
"err",
"error",
")",
"{",
"reply",
"=",
"new",
"(",
"CompileScriptReply",
")",
"\n",
"if",
"args",
"!=",
"nil",
"{",
"err",
"=",
"rpcc",
".",
"Invoke",
"(",
"ctx",
",",
"\"",
"\"",
",",
"args",
",",
"reply",
",",
"d",
".",
"conn",
")",
"\n",
"}",
"else",
"{",
"err",
"=",
"rpcc",
".",
"Invoke",
"(",
"ctx",
",",
"\"",
"\"",
",",
"nil",
",",
"reply",
",",
"d",
".",
"conn",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"&",
"internal",
".",
"OpError",
"{",
"Domain",
":",
"\"",
"\"",
",",
"Op",
":",
"\"",
"\"",
",",
"Err",
":",
"err",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// CompileScript invokes the Runtime method. Compiles expression.
|
[
"CompileScript",
"invokes",
"the",
"Runtime",
"method",
".",
"Compiles",
"expression",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/runtime/domain.go#L65-L76
|
18,778
|
mafredri/cdp
|
protocol/runtime/domain.go
|
Evaluate
|
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 {
err = &internal.OpError{Domain: "Runtime", Op: "Evaluate", Err: err}
}
return
}
|
go
|
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 {
err = &internal.OpError{Domain: "Runtime", Op: "Evaluate", Err: err}
}
return
}
|
[
"func",
"(",
"d",
"*",
"domainClient",
")",
"Evaluate",
"(",
"ctx",
"context",
".",
"Context",
",",
"args",
"*",
"EvaluateArgs",
")",
"(",
"reply",
"*",
"EvaluateReply",
",",
"err",
"error",
")",
"{",
"reply",
"=",
"new",
"(",
"EvaluateReply",
")",
"\n",
"if",
"args",
"!=",
"nil",
"{",
"err",
"=",
"rpcc",
".",
"Invoke",
"(",
"ctx",
",",
"\"",
"\"",
",",
"args",
",",
"reply",
",",
"d",
".",
"conn",
")",
"\n",
"}",
"else",
"{",
"err",
"=",
"rpcc",
".",
"Invoke",
"(",
"ctx",
",",
"\"",
"\"",
",",
"nil",
",",
"reply",
",",
"d",
".",
"conn",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"&",
"internal",
".",
"OpError",
"{",
"Domain",
":",
"\"",
"\"",
",",
"Op",
":",
"\"",
"\"",
",",
"Err",
":",
"err",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// Evaluate invokes the Runtime method. Evaluates expression on global object.
|
[
"Evaluate",
"invokes",
"the",
"Runtime",
"method",
".",
"Evaluates",
"expression",
"on",
"global",
"object",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/runtime/domain.go#L111-L122
|
18,779
|
mafredri/cdp
|
protocol/runtime/domain.go
|
GetProperties
|
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.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Runtime", Op: "GetProperties", Err: err}
}
return
}
|
go
|
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.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Runtime", Op: "GetProperties", Err: err}
}
return
}
|
[
"func",
"(",
"d",
"*",
"domainClient",
")",
"GetProperties",
"(",
"ctx",
"context",
".",
"Context",
",",
"args",
"*",
"GetPropertiesArgs",
")",
"(",
"reply",
"*",
"GetPropertiesReply",
",",
"err",
"error",
")",
"{",
"reply",
"=",
"new",
"(",
"GetPropertiesReply",
")",
"\n",
"if",
"args",
"!=",
"nil",
"{",
"err",
"=",
"rpcc",
".",
"Invoke",
"(",
"ctx",
",",
"\"",
"\"",
",",
"args",
",",
"reply",
",",
"d",
".",
"conn",
")",
"\n",
"}",
"else",
"{",
"err",
"=",
"rpcc",
".",
"Invoke",
"(",
"ctx",
",",
"\"",
"\"",
",",
"nil",
",",
"reply",
",",
"d",
".",
"conn",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"&",
"internal",
".",
"OpError",
"{",
"Domain",
":",
"\"",
"\"",
",",
"Op",
":",
"\"",
"\"",
",",
"Err",
":",
"err",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// GetProperties invokes the Runtime method. Returns properties of a given
// object. Object group of the result is inherited from the target object.
|
[
"GetProperties",
"invokes",
"the",
"Runtime",
"method",
".",
"Returns",
"properties",
"of",
"a",
"given",
"object",
".",
"Object",
"group",
"of",
"the",
"result",
"is",
"inherited",
"from",
"the",
"target",
"object",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/runtime/domain.go#L148-L159
|
18,780
|
mafredri/cdp
|
protocol/runtime/domain.go
|
GlobalLexicalScopeNames
|
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.Invoke(ctx, "Runtime.globalLexicalScopeNames", nil, reply, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Runtime", Op: "GlobalLexicalScopeNames", Err: err}
}
return
}
|
go
|
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.Invoke(ctx, "Runtime.globalLexicalScopeNames", nil, reply, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Runtime", Op: "GlobalLexicalScopeNames", Err: err}
}
return
}
|
[
"func",
"(",
"d",
"*",
"domainClient",
")",
"GlobalLexicalScopeNames",
"(",
"ctx",
"context",
".",
"Context",
",",
"args",
"*",
"GlobalLexicalScopeNamesArgs",
")",
"(",
"reply",
"*",
"GlobalLexicalScopeNamesReply",
",",
"err",
"error",
")",
"{",
"reply",
"=",
"new",
"(",
"GlobalLexicalScopeNamesReply",
")",
"\n",
"if",
"args",
"!=",
"nil",
"{",
"err",
"=",
"rpcc",
".",
"Invoke",
"(",
"ctx",
",",
"\"",
"\"",
",",
"args",
",",
"reply",
",",
"d",
".",
"conn",
")",
"\n",
"}",
"else",
"{",
"err",
"=",
"rpcc",
".",
"Invoke",
"(",
"ctx",
",",
"\"",
"\"",
",",
"nil",
",",
"reply",
",",
"d",
".",
"conn",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"&",
"internal",
".",
"OpError",
"{",
"Domain",
":",
"\"",
"\"",
",",
"Op",
":",
"\"",
"\"",
",",
"Err",
":",
"err",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// GlobalLexicalScopeNames invokes the Runtime method. Returns all let, const
// and class variables from global scope.
|
[
"GlobalLexicalScopeNames",
"invokes",
"the",
"Runtime",
"method",
".",
"Returns",
"all",
"let",
"const",
"and",
"class",
"variables",
"from",
"global",
"scope",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/runtime/domain.go#L163-L174
|
18,781
|
mafredri/cdp
|
protocol/runtime/domain.go
|
QueryObjects
|
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)
}
if err != nil {
err = &internal.OpError{Domain: "Runtime", Op: "QueryObjects", Err: err}
}
return
}
|
go
|
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)
}
if err != nil {
err = &internal.OpError{Domain: "Runtime", Op: "QueryObjects", Err: err}
}
return
}
|
[
"func",
"(",
"d",
"*",
"domainClient",
")",
"QueryObjects",
"(",
"ctx",
"context",
".",
"Context",
",",
"args",
"*",
"QueryObjectsArgs",
")",
"(",
"reply",
"*",
"QueryObjectsReply",
",",
"err",
"error",
")",
"{",
"reply",
"=",
"new",
"(",
"QueryObjectsReply",
")",
"\n",
"if",
"args",
"!=",
"nil",
"{",
"err",
"=",
"rpcc",
".",
"Invoke",
"(",
"ctx",
",",
"\"",
"\"",
",",
"args",
",",
"reply",
",",
"d",
".",
"conn",
")",
"\n",
"}",
"else",
"{",
"err",
"=",
"rpcc",
".",
"Invoke",
"(",
"ctx",
",",
"\"",
"\"",
",",
"nil",
",",
"reply",
",",
"d",
".",
"conn",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"&",
"internal",
".",
"OpError",
"{",
"Domain",
":",
"\"",
"\"",
",",
"Op",
":",
"\"",
"\"",
",",
"Err",
":",
"err",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// QueryObjects invokes the Runtime method.
|
[
"QueryObjects",
"invokes",
"the",
"Runtime",
"method",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/runtime/domain.go#L177-L188
|
18,782
|
mafredri/cdp
|
protocol/runtime/domain.go
|
RunScript
|
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 {
err = &internal.OpError{Domain: "Runtime", Op: "RunScript", Err: err}
}
return
}
|
go
|
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 {
err = &internal.OpError{Domain: "Runtime", Op: "RunScript", Err: err}
}
return
}
|
[
"func",
"(",
"d",
"*",
"domainClient",
")",
"RunScript",
"(",
"ctx",
"context",
".",
"Context",
",",
"args",
"*",
"RunScriptArgs",
")",
"(",
"reply",
"*",
"RunScriptReply",
",",
"err",
"error",
")",
"{",
"reply",
"=",
"new",
"(",
"RunScriptReply",
")",
"\n",
"if",
"args",
"!=",
"nil",
"{",
"err",
"=",
"rpcc",
".",
"Invoke",
"(",
"ctx",
",",
"\"",
"\"",
",",
"args",
",",
"reply",
",",
"d",
".",
"conn",
")",
"\n",
"}",
"else",
"{",
"err",
"=",
"rpcc",
".",
"Invoke",
"(",
"ctx",
",",
"\"",
"\"",
",",
"nil",
",",
"reply",
",",
"d",
".",
"conn",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"&",
"internal",
".",
"OpError",
"{",
"Domain",
":",
"\"",
"\"",
",",
"Op",
":",
"\"",
"\"",
",",
"Err",
":",
"err",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// RunScript invokes the Runtime method. Runs script with given id in a given
// context.
|
[
"RunScript",
"invokes",
"the",
"Runtime",
"method",
".",
"Runs",
"script",
"with",
"given",
"id",
"in",
"a",
"given",
"context",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/runtime/domain.go#L230-L241
|
18,783
|
mafredri/cdp
|
protocol/animation/command.go
|
NewGetCurrentTimeArgs
|
func NewGetCurrentTimeArgs(id string) *GetCurrentTimeArgs {
args := new(GetCurrentTimeArgs)
args.ID = id
return args
}
|
go
|
func NewGetCurrentTimeArgs(id string) *GetCurrentTimeArgs {
args := new(GetCurrentTimeArgs)
args.ID = id
return args
}
|
[
"func",
"NewGetCurrentTimeArgs",
"(",
"id",
"string",
")",
"*",
"GetCurrentTimeArgs",
"{",
"args",
":=",
"new",
"(",
"GetCurrentTimeArgs",
")",
"\n",
"args",
".",
"ID",
"=",
"id",
"\n",
"return",
"args",
"\n",
"}"
] |
// NewGetCurrentTimeArgs initializes GetCurrentTimeArgs with the required arguments.
|
[
"NewGetCurrentTimeArgs",
"initializes",
"GetCurrentTimeArgs",
"with",
"the",
"required",
"arguments",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/animation/command.go#L15-L19
|
18,784
|
mafredri/cdp
|
protocol/animation/command.go
|
NewReleaseAnimationsArgs
|
func NewReleaseAnimationsArgs(animations []string) *ReleaseAnimationsArgs {
args := new(ReleaseAnimationsArgs)
args.Animations = animations
return args
}
|
go
|
func NewReleaseAnimationsArgs(animations []string) *ReleaseAnimationsArgs {
args := new(ReleaseAnimationsArgs)
args.Animations = animations
return args
}
|
[
"func",
"NewReleaseAnimationsArgs",
"(",
"animations",
"[",
"]",
"string",
")",
"*",
"ReleaseAnimationsArgs",
"{",
"args",
":=",
"new",
"(",
"ReleaseAnimationsArgs",
")",
"\n",
"args",
".",
"Animations",
"=",
"animations",
"\n",
"return",
"args",
"\n",
"}"
] |
// NewReleaseAnimationsArgs initializes ReleaseAnimationsArgs with the required arguments.
|
[
"NewReleaseAnimationsArgs",
"initializes",
"ReleaseAnimationsArgs",
"with",
"the",
"required",
"arguments",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/animation/command.go#L37-L41
|
18,785
|
mafredri/cdp
|
protocol/animation/command.go
|
NewResolveAnimationArgs
|
func NewResolveAnimationArgs(animationID string) *ResolveAnimationArgs {
args := new(ResolveAnimationArgs)
args.AnimationID = animationID
return args
}
|
go
|
func NewResolveAnimationArgs(animationID string) *ResolveAnimationArgs {
args := new(ResolveAnimationArgs)
args.AnimationID = animationID
return args
}
|
[
"func",
"NewResolveAnimationArgs",
"(",
"animationID",
"string",
")",
"*",
"ResolveAnimationArgs",
"{",
"args",
":=",
"new",
"(",
"ResolveAnimationArgs",
")",
"\n",
"args",
".",
"AnimationID",
"=",
"animationID",
"\n",
"return",
"args",
"\n",
"}"
] |
// NewResolveAnimationArgs initializes ResolveAnimationArgs with the required arguments.
|
[
"NewResolveAnimationArgs",
"initializes",
"ResolveAnimationArgs",
"with",
"the",
"required",
"arguments",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/animation/command.go#L49-L53
|
18,786
|
mafredri/cdp
|
protocol/animation/command.go
|
NewSeekAnimationsArgs
|
func NewSeekAnimationsArgs(animations []string, currentTime float64) *SeekAnimationsArgs {
args := new(SeekAnimationsArgs)
args.Animations = animations
args.CurrentTime = currentTime
return args
}
|
go
|
func NewSeekAnimationsArgs(animations []string, currentTime float64) *SeekAnimationsArgs {
args := new(SeekAnimationsArgs)
args.Animations = animations
args.CurrentTime = currentTime
return args
}
|
[
"func",
"NewSeekAnimationsArgs",
"(",
"animations",
"[",
"]",
"string",
",",
"currentTime",
"float64",
")",
"*",
"SeekAnimationsArgs",
"{",
"args",
":=",
"new",
"(",
"SeekAnimationsArgs",
")",
"\n",
"args",
".",
"Animations",
"=",
"animations",
"\n",
"args",
".",
"CurrentTime",
"=",
"currentTime",
"\n",
"return",
"args",
"\n",
"}"
] |
// NewSeekAnimationsArgs initializes SeekAnimationsArgs with the required arguments.
|
[
"NewSeekAnimationsArgs",
"initializes",
"SeekAnimationsArgs",
"with",
"the",
"required",
"arguments",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/animation/command.go#L67-L72
|
18,787
|
mafredri/cdp
|
protocol/animation/command.go
|
NewSetPausedArgs
|
func NewSetPausedArgs(animations []string, paused bool) *SetPausedArgs {
args := new(SetPausedArgs)
args.Animations = animations
args.Paused = paused
return args
}
|
go
|
func NewSetPausedArgs(animations []string, paused bool) *SetPausedArgs {
args := new(SetPausedArgs)
args.Animations = animations
args.Paused = paused
return args
}
|
[
"func",
"NewSetPausedArgs",
"(",
"animations",
"[",
"]",
"string",
",",
"paused",
"bool",
")",
"*",
"SetPausedArgs",
"{",
"args",
":=",
"new",
"(",
"SetPausedArgs",
")",
"\n",
"args",
".",
"Animations",
"=",
"animations",
"\n",
"args",
".",
"Paused",
"=",
"paused",
"\n",
"return",
"args",
"\n",
"}"
] |
// NewSetPausedArgs initializes SetPausedArgs with the required arguments.
|
[
"NewSetPausedArgs",
"initializes",
"SetPausedArgs",
"with",
"the",
"required",
"arguments",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/animation/command.go#L81-L86
|
18,788
|
mafredri/cdp
|
protocol/animation/command.go
|
NewSetPlaybackRateArgs
|
func NewSetPlaybackRateArgs(playbackRate float64) *SetPlaybackRateArgs {
args := new(SetPlaybackRateArgs)
args.PlaybackRate = playbackRate
return args
}
|
go
|
func NewSetPlaybackRateArgs(playbackRate float64) *SetPlaybackRateArgs {
args := new(SetPlaybackRateArgs)
args.PlaybackRate = playbackRate
return args
}
|
[
"func",
"NewSetPlaybackRateArgs",
"(",
"playbackRate",
"float64",
")",
"*",
"SetPlaybackRateArgs",
"{",
"args",
":=",
"new",
"(",
"SetPlaybackRateArgs",
")",
"\n",
"args",
".",
"PlaybackRate",
"=",
"playbackRate",
"\n",
"return",
"args",
"\n",
"}"
] |
// NewSetPlaybackRateArgs initializes SetPlaybackRateArgs with the required arguments.
|
[
"NewSetPlaybackRateArgs",
"initializes",
"SetPlaybackRateArgs",
"with",
"the",
"required",
"arguments",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/animation/command.go#L94-L98
|
18,789
|
mafredri/cdp
|
protocol/animation/command.go
|
NewSetTimingArgs
|
func NewSetTimingArgs(animationID string, duration float64, delay float64) *SetTimingArgs {
args := new(SetTimingArgs)
args.AnimationID = animationID
args.Duration = duration
args.Delay = delay
return args
}
|
go
|
func NewSetTimingArgs(animationID string, duration float64, delay float64) *SetTimingArgs {
args := new(SetTimingArgs)
args.AnimationID = animationID
args.Duration = duration
args.Delay = delay
return args
}
|
[
"func",
"NewSetTimingArgs",
"(",
"animationID",
"string",
",",
"duration",
"float64",
",",
"delay",
"float64",
")",
"*",
"SetTimingArgs",
"{",
"args",
":=",
"new",
"(",
"SetTimingArgs",
")",
"\n",
"args",
".",
"AnimationID",
"=",
"animationID",
"\n",
"args",
".",
"Duration",
"=",
"duration",
"\n",
"args",
".",
"Delay",
"=",
"delay",
"\n",
"return",
"args",
"\n",
"}"
] |
// NewSetTimingArgs initializes SetTimingArgs with the required arguments.
|
[
"NewSetTimingArgs",
"initializes",
"SetTimingArgs",
"with",
"the",
"required",
"arguments",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/animation/command.go#L108-L114
|
18,790
|
mafredri/cdp
|
protocol/debugger/command.go
|
NewContinueToLocationArgs
|
func NewContinueToLocationArgs(location Location) *ContinueToLocationArgs {
args := new(ContinueToLocationArgs)
args.Location = location
return args
}
|
go
|
func NewContinueToLocationArgs(location Location) *ContinueToLocationArgs {
args := new(ContinueToLocationArgs)
args.Location = location
return args
}
|
[
"func",
"NewContinueToLocationArgs",
"(",
"location",
"Location",
")",
"*",
"ContinueToLocationArgs",
"{",
"args",
":=",
"new",
"(",
"ContinueToLocationArgs",
")",
"\n",
"args",
".",
"Location",
"=",
"location",
"\n",
"return",
"args",
"\n",
"}"
] |
// NewContinueToLocationArgs initializes ContinueToLocationArgs with the required arguments.
|
[
"NewContinueToLocationArgs",
"initializes",
"ContinueToLocationArgs",
"with",
"the",
"required",
"arguments",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/debugger/command.go#L19-L23
|
18,791
|
mafredri/cdp
|
protocol/debugger/command.go
|
NewEvaluateOnCallFrameArgs
|
func NewEvaluateOnCallFrameArgs(callFrameID CallFrameID, expression string) *EvaluateOnCallFrameArgs {
args := new(EvaluateOnCallFrameArgs)
args.CallFrameID = callFrameID
args.Expression = expression
return args
}
|
go
|
func NewEvaluateOnCallFrameArgs(callFrameID CallFrameID, expression string) *EvaluateOnCallFrameArgs {
args := new(EvaluateOnCallFrameArgs)
args.CallFrameID = callFrameID
args.Expression = expression
return args
}
|
[
"func",
"NewEvaluateOnCallFrameArgs",
"(",
"callFrameID",
"CallFrameID",
",",
"expression",
"string",
")",
"*",
"EvaluateOnCallFrameArgs",
"{",
"args",
":=",
"new",
"(",
"EvaluateOnCallFrameArgs",
")",
"\n",
"args",
".",
"CallFrameID",
"=",
"callFrameID",
"\n",
"args",
".",
"Expression",
"=",
"expression",
"\n",
"return",
"args",
"\n",
"}"
] |
// NewEvaluateOnCallFrameArgs initializes EvaluateOnCallFrameArgs with the required arguments.
|
[
"NewEvaluateOnCallFrameArgs",
"initializes",
"EvaluateOnCallFrameArgs",
"with",
"the",
"required",
"arguments",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/debugger/command.go#L90-L95
|
18,792
|
mafredri/cdp
|
protocol/debugger/command.go
|
SetIncludeCommandLineAPI
|
func (a *EvaluateOnCallFrameArgs) SetIncludeCommandLineAPI(includeCommandLineAPI bool) *EvaluateOnCallFrameArgs {
a.IncludeCommandLineAPI = &includeCommandLineAPI
return a
}
|
go
|
func (a *EvaluateOnCallFrameArgs) SetIncludeCommandLineAPI(includeCommandLineAPI bool) *EvaluateOnCallFrameArgs {
a.IncludeCommandLineAPI = &includeCommandLineAPI
return a
}
|
[
"func",
"(",
"a",
"*",
"EvaluateOnCallFrameArgs",
")",
"SetIncludeCommandLineAPI",
"(",
"includeCommandLineAPI",
"bool",
")",
"*",
"EvaluateOnCallFrameArgs",
"{",
"a",
".",
"IncludeCommandLineAPI",
"=",
"&",
"includeCommandLineAPI",
"\n",
"return",
"a",
"\n",
"}"
] |
// SetIncludeCommandLineAPI sets the IncludeCommandLineAPI optional argument.
// Specifies whether command line API should be available to the
// evaluated expression, defaults to false.
|
[
"SetIncludeCommandLineAPI",
"sets",
"the",
"IncludeCommandLineAPI",
"optional",
"argument",
".",
"Specifies",
"whether",
"command",
"line",
"API",
"should",
"be",
"available",
"to",
"the",
"evaluated",
"expression",
"defaults",
"to",
"false",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/debugger/command.go#L108-L111
|
18,793
|
mafredri/cdp
|
protocol/debugger/command.go
|
SetThrowOnSideEffect
|
func (a *EvaluateOnCallFrameArgs) SetThrowOnSideEffect(throwOnSideEffect bool) *EvaluateOnCallFrameArgs {
a.ThrowOnSideEffect = &throwOnSideEffect
return a
}
|
go
|
func (a *EvaluateOnCallFrameArgs) SetThrowOnSideEffect(throwOnSideEffect bool) *EvaluateOnCallFrameArgs {
a.ThrowOnSideEffect = &throwOnSideEffect
return a
}
|
[
"func",
"(",
"a",
"*",
"EvaluateOnCallFrameArgs",
")",
"SetThrowOnSideEffect",
"(",
"throwOnSideEffect",
"bool",
")",
"*",
"EvaluateOnCallFrameArgs",
"{",
"a",
".",
"ThrowOnSideEffect",
"=",
"&",
"throwOnSideEffect",
"\n",
"return",
"a",
"\n",
"}"
] |
// SetThrowOnSideEffect sets the ThrowOnSideEffect optional argument.
// Whether to throw an exception if side effect cannot be ruled out
// during evaluation.
|
[
"SetThrowOnSideEffect",
"sets",
"the",
"ThrowOnSideEffect",
"optional",
"argument",
".",
"Whether",
"to",
"throw",
"an",
"exception",
"if",
"side",
"effect",
"cannot",
"be",
"ruled",
"out",
"during",
"evaluation",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/debugger/command.go#L141-L144
|
18,794
|
mafredri/cdp
|
protocol/debugger/command.go
|
NewGetPossibleBreakpointsArgs
|
func NewGetPossibleBreakpointsArgs(start Location) *GetPossibleBreakpointsArgs {
args := new(GetPossibleBreakpointsArgs)
args.Start = start
return args
}
|
go
|
func NewGetPossibleBreakpointsArgs(start Location) *GetPossibleBreakpointsArgs {
args := new(GetPossibleBreakpointsArgs)
args.Start = start
return args
}
|
[
"func",
"NewGetPossibleBreakpointsArgs",
"(",
"start",
"Location",
")",
"*",
"GetPossibleBreakpointsArgs",
"{",
"args",
":=",
"new",
"(",
"GetPossibleBreakpointsArgs",
")",
"\n",
"args",
".",
"Start",
"=",
"start",
"\n",
"return",
"args",
"\n",
"}"
] |
// NewGetPossibleBreakpointsArgs initializes GetPossibleBreakpointsArgs with the required arguments.
|
[
"NewGetPossibleBreakpointsArgs",
"initializes",
"GetPossibleBreakpointsArgs",
"with",
"the",
"required",
"arguments",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/debugger/command.go#L169-L173
|
18,795
|
mafredri/cdp
|
protocol/debugger/command.go
|
NewGetScriptSourceArgs
|
func NewGetScriptSourceArgs(scriptID runtime.ScriptID) *GetScriptSourceArgs {
args := new(GetScriptSourceArgs)
args.ScriptID = scriptID
return args
}
|
go
|
func NewGetScriptSourceArgs(scriptID runtime.ScriptID) *GetScriptSourceArgs {
args := new(GetScriptSourceArgs)
args.ScriptID = scriptID
return args
}
|
[
"func",
"NewGetScriptSourceArgs",
"(",
"scriptID",
"runtime",
".",
"ScriptID",
")",
"*",
"GetScriptSourceArgs",
"{",
"args",
":=",
"new",
"(",
"GetScriptSourceArgs",
")",
"\n",
"args",
".",
"ScriptID",
"=",
"scriptID",
"\n",
"return",
"args",
"\n",
"}"
] |
// NewGetScriptSourceArgs initializes GetScriptSourceArgs with the required arguments.
|
[
"NewGetScriptSourceArgs",
"initializes",
"GetScriptSourceArgs",
"with",
"the",
"required",
"arguments",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/debugger/command.go#L202-L206
|
18,796
|
mafredri/cdp
|
protocol/debugger/command.go
|
NewGetStackTraceArgs
|
func NewGetStackTraceArgs(stackTraceID runtime.StackTraceID) *GetStackTraceArgs {
args := new(GetStackTraceArgs)
args.StackTraceID = stackTraceID
return args
}
|
go
|
func NewGetStackTraceArgs(stackTraceID runtime.StackTraceID) *GetStackTraceArgs {
args := new(GetStackTraceArgs)
args.StackTraceID = stackTraceID
return args
}
|
[
"func",
"NewGetStackTraceArgs",
"(",
"stackTraceID",
"runtime",
".",
"StackTraceID",
")",
"*",
"GetStackTraceArgs",
"{",
"args",
":=",
"new",
"(",
"GetStackTraceArgs",
")",
"\n",
"args",
".",
"StackTraceID",
"=",
"stackTraceID",
"\n",
"return",
"args",
"\n",
"}"
] |
// NewGetStackTraceArgs initializes GetStackTraceArgs with the required arguments.
|
[
"NewGetStackTraceArgs",
"initializes",
"GetStackTraceArgs",
"with",
"the",
"required",
"arguments",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/debugger/command.go#L219-L223
|
18,797
|
mafredri/cdp
|
protocol/debugger/command.go
|
NewPauseOnAsyncCallArgs
|
func NewPauseOnAsyncCallArgs(parentStackTraceID runtime.StackTraceID) *PauseOnAsyncCallArgs {
args := new(PauseOnAsyncCallArgs)
args.ParentStackTraceID = parentStackTraceID
return args
}
|
go
|
func NewPauseOnAsyncCallArgs(parentStackTraceID runtime.StackTraceID) *PauseOnAsyncCallArgs {
args := new(PauseOnAsyncCallArgs)
args.ParentStackTraceID = parentStackTraceID
return args
}
|
[
"func",
"NewPauseOnAsyncCallArgs",
"(",
"parentStackTraceID",
"runtime",
".",
"StackTraceID",
")",
"*",
"PauseOnAsyncCallArgs",
"{",
"args",
":=",
"new",
"(",
"PauseOnAsyncCallArgs",
")",
"\n",
"args",
".",
"ParentStackTraceID",
"=",
"parentStackTraceID",
"\n",
"return",
"args",
"\n",
"}"
] |
// NewPauseOnAsyncCallArgs initializes PauseOnAsyncCallArgs with the required arguments.
|
[
"NewPauseOnAsyncCallArgs",
"initializes",
"PauseOnAsyncCallArgs",
"with",
"the",
"required",
"arguments",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/debugger/command.go#L236-L240
|
18,798
|
mafredri/cdp
|
protocol/debugger/command.go
|
NewRemoveBreakpointArgs
|
func NewRemoveBreakpointArgs(breakpointID BreakpointID) *RemoveBreakpointArgs {
args := new(RemoveBreakpointArgs)
args.BreakpointID = breakpointID
return args
}
|
go
|
func NewRemoveBreakpointArgs(breakpointID BreakpointID) *RemoveBreakpointArgs {
args := new(RemoveBreakpointArgs)
args.BreakpointID = breakpointID
return args
}
|
[
"func",
"NewRemoveBreakpointArgs",
"(",
"breakpointID",
"BreakpointID",
")",
"*",
"RemoveBreakpointArgs",
"{",
"args",
":=",
"new",
"(",
"RemoveBreakpointArgs",
")",
"\n",
"args",
".",
"BreakpointID",
"=",
"breakpointID",
"\n",
"return",
"args",
"\n",
"}"
] |
// NewRemoveBreakpointArgs initializes RemoveBreakpointArgs with the required arguments.
|
[
"NewRemoveBreakpointArgs",
"initializes",
"RemoveBreakpointArgs",
"with",
"the",
"required",
"arguments",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/debugger/command.go#L248-L252
|
18,799
|
mafredri/cdp
|
protocol/debugger/command.go
|
NewRestartFrameArgs
|
func NewRestartFrameArgs(callFrameID CallFrameID) *RestartFrameArgs {
args := new(RestartFrameArgs)
args.CallFrameID = callFrameID
return args
}
|
go
|
func NewRestartFrameArgs(callFrameID CallFrameID) *RestartFrameArgs {
args := new(RestartFrameArgs)
args.CallFrameID = callFrameID
return args
}
|
[
"func",
"NewRestartFrameArgs",
"(",
"callFrameID",
"CallFrameID",
")",
"*",
"RestartFrameArgs",
"{",
"args",
":=",
"new",
"(",
"RestartFrameArgs",
")",
"\n",
"args",
".",
"CallFrameID",
"=",
"callFrameID",
"\n",
"return",
"args",
"\n",
"}"
] |
// NewRestartFrameArgs initializes RestartFrameArgs with the required arguments.
|
[
"NewRestartFrameArgs",
"initializes",
"RestartFrameArgs",
"with",
"the",
"required",
"arguments",
"."
] |
a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514
|
https://github.com/mafredri/cdp/blob/a3cd6cc58c0b7537b9614e7fa5da84bdd3c18514/protocol/debugger/command.go#L260-L264
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.