github.com/piotrek-janus/go-swagger@v0.26.2-0.20210330193204-fde701ef2768/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  /*Package swagger (2.0) provides a powerful interface to your API
    16  
    17  Contains an implementation of Swagger 2.0.
    18  It knows how to serialize, deserialize and validate swagger specifications.
    19  
    20  Swagger is a simple yet powerful representation of your RESTful API.
    21  With the largest ecosystem of API tooling on the planet, thousands of developers are supporting Swagger
    22  in almost every modern programming language and deployment environment.
    23  
    24  With a Swagger-enabled API, you get interactive documentation, client SDK generation and discoverability.
    25  We created Swagger to help fulfill the promise of APIs.
    26  
    27  Swagger helps companies like Apigee, Getty Images, Intuit, LivingSocial, McKesson, Microsoft, Morningstar, and PayPal
    28  build the best possible services with RESTful APIs.Now in version 2.0, Swagger is more enabling than ever.
    29  And it's 100% open source software.
    30  
    31  More detailed documentation is available at https://goswagger.io.
    32  
    33  Install:
    34  
    35  		go get -u github.com/go-swagger/go-swagger/cmd/swagger
    36  
    37  The implementation also provides a number of command line tools to help working with swagger.
    38  
    39  Currently there is a spec validator tool:
    40  
    41  		swagger validate https://raw.githubusercontent.com/swagger-api/swagger-spec/master/examples/v2.0/json/petstore-expanded.json
    42  
    43  To generate a server for a swagger spec document:
    44  
    45  		swagger generate server [-f ./swagger.json] -A [application-name [--principal [principal-name]]
    46  
    47  To generate a client for a swagger spec document:
    48  
    49  		swagger generate client [-f ./swagger.json] -A [application-name [--principal [principal-name]]
    50  
    51  To generate a swagger spec document for a go application:
    52  
    53  		swagger generate spec -o ./swagger.json
    54  
    55  There are several other sub commands available for the generate command
    56  
    57  		Sub command | Description
    58  		------------|----------------------------------------------------------------------------------
    59  		operation   | generates one or more operations specified in the swagger definition
    60  		model       | generates model files for one or more models specified in the swagger definition
    61  		support     | generates the api builder and the main method
    62  		server      | generates an entire server application
    63  		client      | generates a client for a swagger specification
    64  		spec        | generates a swagger spec document based on go code
    65  
    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  */
    78  package swagger