github.com/minio/console@v1.3.0/CONTRIBUTING.md (about)

     1  # MinIO Console Server Contribution Guide [![Slack](https://slack.min.io/slack?type=svg)](https://slack.min.io)
     2  
     3  This is a REST portal server created using [go-swagger](https://github.com/go-swagger/go-swagger)
     4  
     5  The API handlers are created using a YAML definition located in `swagger.YAML`.
     6  
     7  To add new api, the YAML file needs to be updated with all the desired apis using
     8  the [Swagger Basic Structure](https://swagger.io/docs/specification/2-0/basic-structure/), this includes paths,
     9  parameters, definitions, tags, etc.
    10  
    11  ## Generate server from YAML
    12  
    13  Once the YAML file is ready we can autogenerate the code needed for the new api by just running:
    14  
    15  Validate it:
    16  
    17  ```
    18  swagger validate ./swagger.yml
    19  ```
    20  
    21  Update server code:
    22  
    23  ```
    24  make swagger-gen
    25  ```
    26  
    27  This will update all the necessary code.
    28  
    29  `./api/configure_console.go` is a file that contains the handlers to be used by the application, here is the only place
    30  where we need to update our code to support the new apis. This file is not affected when running the swagger generator
    31  and it is safe to edit.
    32  
    33  ## Unit Tests
    34  
    35  `./api/handlers_test.go` needs to be updated with the proper tests for the new api.
    36  
    37  To run tests:
    38  
    39  ```
    40  go test ./api
    41  ```
    42  
    43  ## Commit changes
    44  
    45  After verification, commit your changes. This is a [great post](https://chris.beams.io/posts/git-commit/) on how to
    46  write useful commit messages
    47  
    48  ```
    49  $ git commit -am 'Add some feature'
    50  ```
    51  
    52  ### Push to the branch
    53  
    54  Push your locally committed changes to the remote origin (your fork)
    55  
    56  ```
    57  $ git push origin my-new-feature
    58  ```
    59  
    60  ### Create a Pull Request
    61  
    62  Pull requests can be created via GitHub. Refer
    63  to [this document](https://help.github.com/articles/creating-a-pull-request/) for detailed steps on how to create a pull
    64  request. After a Pull Request gets peer reviewed and approved, it will be merged.
    65  
    66  ## FAQs
    67  
    68  ### How does ``console`` manages dependencies?
    69  
    70  ``MinIO`` uses `go mod` to manage its dependencies.
    71  
    72  - Run `go get foo/bar` in the source folder to add the dependency to `go.mod` file.
    73  
    74  To remove a dependency
    75  
    76  - Edit your code and remove the import reference.
    77  - Run `go mod tidy` in the source folder to remove dependency from `go.mod` file.
    78  
    79  ### What are the coding guidelines for console?
    80  
    81  ``console`` is fully conformant with Golang style.
    82  Refer: [Effective Go](https://github.com/golang/go/wiki/CodeReviewComments) article from Golang project. If you observe
    83  offending code, please feel free to send a pull request or ping us on [Slack](https://slack.min.io).