MCPcopy Create free account
hub / github.com/pydio/cells / parseSchema

Function parseSchema

common/utils/docs/openapi.go:106–127  ·  view source on GitHub ↗
(document *loads.Document, schema *spec.Schema, dir string)

Source from the content-addressed store, hash-verified

104}
105
106func parseSchema(document *loads.Document, schema *spec.Schema, dir string) (description string, structure map[string]*Parameter, example interface{}) {
107 def, _, ok := getDefinition(document, schema.Ref)
108 if !ok {
109 return
110 }
111 description = schema.Ref.Ref.GetPointer().String()
112 example = createSample(document, schema, dir)
113 structure = make(map[string]*Parameter, len(def.SchemaProps.Properties))
114 for name, p := range def.SchemaProps.Properties {
115 par := &Parameter{
116 Name: name,
117 Description: p.Title,
118 }
119 if len(p.Type) > 0 {
120 par.TypeName = p.Type[0]
121 } else {
122 par.TypeName = p.Ref.String()
123 }
124 structure[name] = par
125 }
126 return
127}
128
129func createSample(document *loads.Document, data *spec.Schema, dir string, chain ...string) interface{} {
130 if refScheme, refName, ok := getDefinition(document, data.Ref); ok {

Callers 1

parseOperationFunction · 0.85

Calls 4

getDefinitionFunction · 0.85
createSampleFunction · 0.85
makeFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…