github.com/go-swagger/go-swagger@v0.31.0/doc.go (about) 1 // Copyright 2015 go-swagger maintainers 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 /* 16 Package swagger (2.0) provides a powerful interface to your API 17 18 Contains an implementation of Swagger 2.0. 19 It knows how to serialize, deserialize and validate swagger specifications. 20 21 Swagger is a simple yet powerful representation of your RESTful API. 22 With the largest ecosystem of API tooling on the planet, thousands of developers are supporting Swagger 23 in almost every modern programming language and deployment environment. 24 25 With a Swagger-enabled API, you get interactive documentation, client SDK generation and discoverability. 26 We created Swagger to help fulfill the promise of APIs. 27 28 Swagger helps companies like Apigee, Getty Images, Intuit, LivingSocial, McKesson, Microsoft, Morningstar, and PayPal 29 build the best possible services with RESTful APIs.Now in version 2.0, Swagger is more enabling than ever. 30 And it's 100% open source software. 31 32 More detailed documentation is available at https://goswagger.io. 33 34 Install: 35 36 go get -u github.com/go-swagger/go-swagger/cmd/swagger 37 38 The implementation also provides a number of command line tools to help working with swagger. 39 40 Currently there is a spec validator tool: 41 42 swagger validate https://raw.githubusercontent.com/swagger-api/swagger-spec/master/examples/v2.0/json/petstore-expanded.json 43 44 To generate a server for a swagger spec document: 45 46 swagger generate server [-f ./swagger.json] -A [application-name [--principal [principal-name]] 47 48 To generate a client for a swagger spec document: 49 50 swagger generate client [-f ./swagger.json] -A [application-name [--principal [principal-name]] 51 52 To generate a swagger spec document for a go application: 53 54 swagger generate spec -o ./swagger.json 55 56 There are several other sub commands available for the generate command 57 58 Sub command | Description 59 ------------|---------------------------------------------------------------------------------- 60 operation | generates one or more operations specified in the swagger definition 61 model | generates model files for one or more models specified in the swagger definition 62 support | generates the api builder and the main method 63 server | generates an entire server application 64 client | generates a client for a swagger specification 65 spec | generates a swagger spec document based on go code 66 67 # Generating code 68 69 You're free to add files to the directories the generated code lands in, but the files generated by the generator itself 70 will be regenerated on following generation runs so any changes to those files will be lost. 71 However extra files you create won't be lost so they are safe to use for customizing the application to your needs. 72 73 To generate a server for a swagger spec document: 74 75 swagger generate server -f ./swagger.json -A [application-name] [--principal [principal-name]] 76 */ 77 package swagger