@@ -77,6 +77,8 @@ func main() {
7777 // Unwrapping delete document parameters
7878 log .Println ("Unwrapping documents delete parameters" )
7979 unwrapDeleteDocument (& m )
80+ log .Println ("Unwrapping collections get parameters" )
81+ unwrapGetCollections (& m )
8082 // Remove additionalProperties from SearchResultHit -> document
8183 log .Println ("Removing additionalProperties from SearchResultHit" )
8284 searchResultHit (& m )
@@ -274,6 +276,22 @@ func unwrapMultiSearchParameters(m *yml) {
274276 (* m )["paths" ].(yml )["/multi_search" ].(yml )["post" ].(yml )["parameters" ] = parameters
275277}
276278
279+ func unwrapGetCollections (m * yml ) {
280+ parameters := (* m )["paths" ].(yml )["/collections" ].(yml )["get" ].(yml )["parameters" ].([]interface {})
281+ deleteParameters := parameters [0 ].(yml )["schema" ].(yml )["properties" ].(yml )
282+ for _ , obj := range sortedSlice (deleteParameters ) {
283+ newMap := make (yml )
284+ newMap ["name" ] = obj .Key
285+ newMap ["in" ] = query
286+ newMap ["schema" ] = make (yml )
287+ newMap ["schema" ].(yml )["type" ] = obj .Value .(yml )["type" ].(string )
288+ // newMap["schema"].(yml)["description"] = obj.Value.(yml)["description"].(string)
289+ parameters = append (parameters , newMap )
290+ }
291+ parameters = parameters [1 :]
292+ (* m )["paths" ].(yml )["/collections" ].(yml )["get" ].(yml )["parameters" ] = parameters
293+ }
294+
277295func oAPICodeGen () {
278296 cmd := exec .Command ("pwd" )
279297 stdout , err := cmd .Output ()
0 commit comments