@@ -43,7 +43,6 @@ func init() {
4343}
4444
4545// NewEndpoint creates a new API endpoint.
46- //
4746func NewEndpoint (f io.Reader ) (* Endpoint , error ) {
4847 var endpoint Endpoint
4948 var spec map [string ]Endpoint
@@ -101,6 +100,20 @@ func NewEndpoint(f io.Reader) (*Endpoint, error) {
101100 endpoint .URL .Params = endpoint .Params
102101 }
103102
103+ // These are implemented statically.
104+ paramSkipList := map [string ]bool {
105+ "human" : true ,
106+ "pretty" : true ,
107+ "error_trace" : true ,
108+ "filter_path" : true ,
109+ }
110+ for name , _ := range endpoint .Params {
111+ // remove from endpoint if it's in the skip list
112+ if _ , ok := paramSkipList [name ]; ok {
113+ delete (endpoint .Params , name )
114+ }
115+ }
116+
104117 if fpath , ok := f .(* os.File ); ok {
105118 if strings .Contains (fpath .Name (), "x-pack" ) {
106119 endpoint .Type = "xpack"
@@ -221,7 +234,6 @@ func NewEndpoint(f io.Reader) (*Endpoint, error) {
221234}
222235
223236// Endpoint represents an API endpoint.
224- //
225237type Endpoint struct {
226238 Name string `json:"-"`
227239 Type string `json:"-"`
@@ -239,7 +251,6 @@ type Endpoint struct {
239251}
240252
241253// URL represents API endpoint URL.
242- //
243254type URL struct {
244255 Endpoint * Endpoint `json:"-"`
245256
@@ -268,7 +279,6 @@ type Path struct {
268279}
269280
270281// Part represents part of the API endpoint URL.
271- //
272282type Part struct {
273283 Endpoint * Endpoint `json:"-"`
274284
@@ -283,7 +293,6 @@ type Part struct {
283293}
284294
285295// Param represents API endpoint parameter.
286- //
287296type Param struct {
288297 Endpoint * Endpoint `json:"-"`
289298
@@ -297,7 +306,6 @@ type Param struct {
297306}
298307
299308// Body represents API endpoint body.
300- //
301309type Body struct {
302310 Endpoint * Endpoint `json:"-"`
303311
@@ -307,7 +315,6 @@ type Body struct {
307315}
308316
309317// MethodArgument represents a method argument for API endpoint.
310- //
311318type MethodArgument struct {
312319 Endpoint * Endpoint
313320
@@ -320,14 +327,12 @@ type MethodArgument struct {
320327}
321328
322329// Namespace returns the API endpoint namespace.
323- //
324330func (e * Endpoint ) Namespace () string {
325331 ep := strings .Split (e .Name , "." )
326332 return utils .NameToGo (ep [0 ])
327333}
328334
329335// MethodName returns the API endpoint method name.
330- //
331336func (e * Endpoint ) MethodName () string {
332337 ep := strings .Split (e .Name , "." )
333338 ep = append (ep [:0 ], ep [1 :]... )
@@ -344,13 +349,11 @@ func (e *Endpoint) MethodName() string {
344349}
345350
346351// MethodWithNamespace returns the API endpoint method name with namespace.
347- //
348352func (e * Endpoint ) MethodWithNamespace () string {
349353 return utils .APIToGo (e .Name )
350354}
351355
352356// HumanMethodWithNamespace returns the API endpoint method name in humanized form.
353- //
354357func (e * Endpoint ) HumanMethodWithNamespace () string {
355358 var (
356359 src = e .MethodWithNamespace ()
@@ -371,7 +374,6 @@ func (e *Endpoint) HumanMethodWithNamespace() string {
371374}
372375
373376// RequiredArguments return the list of required method arguments.
374- //
375377func (e * Endpoint ) RequiredArguments () []MethodArgument {
376378 var args = make ([]MethodArgument , 0 )
377379 var prominentArgs = []string {
@@ -468,7 +470,6 @@ func (e *Endpoint) RequiredArguments() []MethodArgument {
468470}
469471
470472// GoName returns a Go name for part.
471- //
472473func (p * Part ) GoName () string {
473474 switch {
474475 case p .Name == "context" :
@@ -479,13 +480,11 @@ func (p *Part) GoName() string {
479480}
480481
481482// GoType returns a Go type for part.
482- //
483483func (p * Part ) GoType (comment ... bool ) string {
484484 return utils .TypeToGo (p .Type )
485485}
486486
487487// GoName returns a Go name for parameter.
488- //
489488func (p * Param ) GoName () string {
490489 switch {
491490 case p .Name == "context" :
@@ -498,7 +497,6 @@ func (p *Param) GoName() string {
498497}
499498
500499// GoType returns a Go type for parameter.
501- //
502500func (p * Param ) GoType (comment ... bool ) string {
503501 if f := (& Generator {Endpoint : p .Endpoint }).GetOverride ("polymorphic-param" , p .Endpoint .Name ); f != nil {
504502 if out := f (p .Endpoint , p .Name ); out != "" {
@@ -509,13 +507,11 @@ func (p *Param) GoType(comment ...bool) string {
509507}
510508
511509// GoName returns a Go name for method argument.
512- //
513510func (p * MethodArgument ) GoName () string {
514511 return utils .NameToGo (p .Name , p .Endpoint .MethodWithNamespace ())
515512}
516513
517514// GoType returns a Go type for method argument.
518- //
519515func (p * MethodArgument ) GoType (comment ... bool ) string {
520516 return utils .TypeToGo (p .Type )
521517}
0 commit comments