You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CONTRIBUTING.md
+5-74
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ First of all, thank you for considering making a contribution to the project.
7
7
To add an API to the collection, there must be a machine-readable API description in a format which is or can be converted to OpenAPI (Swagger). These include RAML, API Blueprint, IO Docs, WADL and Google Discovery Format.
8
8
9
9
First please check that the API you wish to add isn't already in the collection. You can
10
-
browse the APIs in [GitHub](https://github.com/APIs-guru/openapi-directory/tree/master/APIs) or on the [APIs.guru](https://apis.guru/browse-apis/) website.
10
+
browse the APIs in [GitHub](https://github.com/APIs-guru/openapi-directory/tree/main/APIs) or on the [APIs.guru](https://apis.guru/) website.
11
11
12
12
Please also check the API isn't in the process of being added, by checking the [list of open issues](https://github.com/APIs-guru/openapi-directory/issues).
13
13
@@ -19,92 +19,23 @@ The API should meet the following criteria:
19
19
20
20
The easiest way to request an API to be added is to use the [web form](https://apis.guru/add-api/).
21
21
22
-
### Adding an API via a Pull-Request
23
-
24
-
Clone the repo locally, if you haven't already done so, and run the following
25
-
26
-
* run `npm install` to install the dependencies for the utility script
Run `../scripts/collection.js add --help` for a complete list of options.
32
-
33
-
`{category}` should be one of the values from [/resources/categories.yaml](/resources/categories.yaml), and `{format}` be one of:
34
-
35
-
*`openapi_3`
36
-
*`swagger_2`
37
-
*`swagger_1`
38
-
*`api_blueprint`
39
-
*`raml`
40
-
*`io_docs`
41
-
*`google`
42
-
*`wadl`
43
-
44
-
If your API definition is unofficial, also specify the `--unofficial` flag.
45
-
46
-
If there are no validation errors:
47
-
48
-
* commit your change (including any `patch.yaml` created)
49
-
* push your change
50
-
* create a Pull Request
51
-
52
22
## Amending an API definition
53
23
54
24
### Adding information
55
25
56
-
If you wish to only add information to the API definition, such as a description, category, logo, tag etc, you can amend the `patch.yaml` file found in the APIs directory. The file is merged with the `swagger.yaml` or `openapi.yaml` file, so the structure should follow that of an OpenAPI definition, including only those properties necessary to place your addition correctly.
57
-
58
-
For example:
59
-
60
-
```yaml
61
-
info:
62
-
description: Our unified API brings together data across all modes of transport into a single RESTful API. This API provides access to the most highly requested realtime and status infomation across all the modes of transport, in a single and consistent way. Access to the developer documentation is available at https://api.tfl.gov.uk
Please issue a Pull Request, it is not necessary to raise an Issue as well.
26
+
If you wish to only add information to the API definition, such as a description, category, logo, tag etc, please raise an issue with the relevant details.
71
27
72
28
### Changing / Fixing an API definition
73
29
74
30
First please see if you can make your fix upstream with the owner of the API definition, this benefits everyone and is less work than maintaining patches.
75
31
76
32
Check the `info.contact` section of the API definition or the `x-origin` to see if there is an email or Twitter contact, or a GitHub repository you can contribute to.
77
33
78
-
#### Do not amend swagger/openapi.yaml files directly
34
+
#### Do not raise PRs to amend the openapi/swagger.yaml files directly
79
35
80
36
If you do this, your changes will be overwritten the next time the API update scripts are run.
81
37
82
-
The exception to this are APIs.guru-specific specification extensions (aka vendor extensions). Some of these are round-tripped between the modified API definitions on each update.
83
-
84
-
These extensions are [documented in the Wiki](https://github.com/APIs-guru/openapi-directory/wiki/specification-extensions#apisguru-extensions).
85
-
86
-
#### Creating a fixup.yaml patch
87
-
88
-
To do this, you will need to fork the repository and clone your fork locally.
89
-
90
-
These instructions should work on Linux or other Unix variants, MacOSx and Windows using the Git for Windows shell.
91
-
92
-
Create a new branch off master using the command:
93
-
94
-
`git checkout -b {new-branch-name}`
95
-
96
-
Change into the `APIs` directory.
97
-
98
-
Ensure your `EDITOR` environment variable is set to a terminal editor such as vi or emacs.
99
-
100
-
Issue the command `node ../scripts/collection fixup {path/to/swagger.yaml}`
101
-
102
-
Edit the `swagger.yaml` or `openapi.yaml` file and save.
103
-
104
-
Issue the command `node ../scripts/collection update {directory-name}` to reprocess the definition from source.
105
-
106
-
As long as there are no errors...
38
+
#### If you want to run our add/update/validate/repair scripts locally
107
39
108
-
Commit your change with an informative commit message, and push to the new branch on your fork.
0 commit comments