Skip to content

Commit 8fc203a

Browse files
committed
update README
1 parent b83d219 commit 8fc203a

File tree

1 file changed

+64
-4
lines changed

1 file changed

+64
-4
lines changed

README.md

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ Options:
5959
| info.title | custom.documentation.title OR service |
6060
| info.description | custom.documentation.description OR blank string |
6161
| info.version | custom.documentation.version OR random v4 uuid if not provided |
62+
| info.termsOfService | custom.documentation.termsOfService |
63+
| info.contact | custom.documentation.contact |
64+
| info.contact.name | custom.documentation.contact.name OR blank string |
65+
| info.contact.url | custom.documentation.contact.url if provided |
66+
| info.license | custom.documentation.license |
67+
| info.license.name | custom.documentation.license.name OR blank string |
68+
| info.license.url | custom.documentation.license.url if provided |
6269
| externalDocs.description | custom.documentation.externalDocumentation.description |
6370
| externalDocs.url | custom.documentation.externalDocumentation.url |
6471
| servers[].description | custom.documentation.servers.description |
@@ -118,6 +125,7 @@ custom:
118125
version: '1'
119126
title: 'My API'
120127
description: 'This is my API'
128+
termsOfService: https://google.com
121129
externalDocumentation:
122130
url: https://google.com
123131
description: A link to google
@@ -126,7 +134,7 @@ custom:
126134
description: The server
127135
variables:
128136
port:
129-
enum:
137+
enum:
130138
- 4000
131139
- 3000
132140
default: 3000
@@ -142,6 +150,58 @@ custom:
142150

143151
Mostly everything here is optional. A version from a UUID will be generated for you if you don't specify one, title will be the name of your service if you don't specify one.
144152

153+
#### termsOfService
154+
155+
Must be in the format of a url if included.
156+
157+
#### Contact
158+
159+
You can provide an optional contact object such as:
160+
161+
```yml
162+
custom:
163+
documentation:
164+
contact:
165+
name: John
166+
url: https://example.com
167+
email: John@example.com
168+
```
169+
170+
These fields are optional, though `url` and `email` need to be in the format of an email address (ed: what that might be, i'm not 100% sure... go read the email RFC(s)) and a url.
171+
172+
#### License
173+
174+
You can provide an optional license object such as:
175+
176+
```yml
177+
custom:
178+
documentation:
179+
license:
180+
name: Apache 2.0
181+
url: https://www.apache.org/licenses/LICENSE-2.0.html
182+
```
183+
184+
Name is required but `url` is optional and must be in the format of a url.
185+
#### Extended Fields
186+
187+
You can also add extended fields to the documentation object:
188+
189+
```yml
190+
custom:
191+
documentation:
192+
x-other-field: This is an extended field
193+
```
194+
195+
These fields must have `x-` before them, otherwise they will be ignored:
196+
197+
```yml
198+
custom:
199+
documentation:
200+
other-field: This is an extended field
201+
```
202+
203+
`other-field` here will not make it to the generated OpenAPI schema.
204+
145205
These configurations can be quite verbose; you can separate it out into it's own file, such as `serverless.doc.yml` as below:
146206

147207
```yml
@@ -246,16 +306,16 @@ custom:
246306
schema: &ErrorItem
247307
type: object
248308
properties:
249-
message:
309+
message:
250310
type: string
251311
code:
252312
type: integer
253-
313+
254314
- name: "PutDocumentResponse"
255315
description: "PUT Document response model (external reference example)"
256316
content:
257317
application/json:
258-
schema:
318+
schema:
259319
type: array
260320
items: *ErrorItem
261321
```

0 commit comments

Comments
 (0)