forked from go-swagger/go-swagger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
support.go
47 lines (43 loc) · 1.9 KB
/
support.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2015 go-swagger maintainers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package generate
import "github.com/go-swagger/go-swagger/generator"
// Support generates the supporting files
type Support struct {
shared
Name string `long:"name" short:"A" description:"the name of the application, defaults to a mangled value of info.title"`
Operations []string `long:"operation" short:"O" description:"specify an operation to include, repeat for multiple"`
Principal string `long:"principal" description:"the model to use for the security principal"`
Models []string `long:"model" short:"M" description:"specify a model to include, repeat for multiple"`
DumpData bool `long:"dump-data" description:"when present dumps the json for the template generator instead of generating files"`
DefaultScheme string `long:"default-scheme" description:"the default scheme for this API" default:"http"`
}
// Execute generates the supporting files file
func (s *Support) Execute(args []string) error {
return generator.GenerateSupport(
s.Name,
nil,
nil,
generator.GenOpts{
Spec: string(s.Spec),
Target: string(s.Target),
APIPackage: s.APIPackage,
ModelPackage: s.ModelPackage,
ServerPackage: s.ServerPackage,
ClientPackage: s.ClientPackage,
Principal: s.Principal,
DumpData: s.DumpData,
DefaultScheme: s.DefaultScheme,
})
}