Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat : add openapi 3 support #333

Merged
merged 47 commits into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
7511cb7
refactor: better file structure
climba03003 Jan 11, 2021
4d4b915
refactor: extract common function
climba03003 Jan 11, 2021
3e5c54c
refactor: split dynamic handle to swagger and openapi
climba03003 Jan 11, 2021
1b2973f
feat: add openapi 3 support
climba03003 Jan 11, 2021
9d75d9a
test: add openapi 3 test case
climba03003 Jan 11, 2021
6eb9e6a
feat: update openapi from 3.0.0 to 3.0.3
climba03003 Jan 12, 2021
ee190b1
refactor: typo
climba03003 Jan 12, 2021
0130700
refactor: more clear argument
climba03003 Jan 12, 2021
729f4dc
refactor: use map instead of reduce
climba03003 Jan 12, 2021
a8ec317
refactor: use done instead of next
climba03003 Jan 12, 2021
984e3c0
refactor: group functions
climba03003 Jan 12, 2021
460ee0d
refactor: genResponse to generateResponse
climba03003 Jan 12, 2021
ac41bef
chore: remove invalid comment
climba03003 Jan 12, 2021
aa229df
refactor: better structure
climba03003 Jan 12, 2021
2862f27
feat: generate response according to produces
climba03003 Jan 12, 2021
92d81d5
feat: use package json as default info
climba03003 Jan 12, 2021
fc6ce2c
refactor: better cache name
climba03003 Jan 12, 2021
ee1e6b4
chore: add comment to address different issue
climba03003 Jan 12, 2021
5453c3b
feat: add oneOf, allOf, anyOf support in query, header, path, formData
climba03003 Jan 12, 2021
ba31090
Fix type of StaticDocumentSpec.document (#328)
radzom Jan 14, 2021
a9f4d3b
refactor: better file structure
climba03003 Jan 11, 2021
37cc39b
refactor: extract common function
climba03003 Jan 11, 2021
00cb007
refactor: split dynamic handle to swagger and openapi
climba03003 Jan 11, 2021
fb23cdc
feat: add openapi 3 support
climba03003 Jan 11, 2021
d1660c7
test: add openapi 3 test case
climba03003 Jan 11, 2021
bad28b6
feat: update openapi from 3.0.0 to 3.0.3
climba03003 Jan 12, 2021
abc1a90
refactor: typo
climba03003 Jan 12, 2021
780ed14
refactor: more clear argument
climba03003 Jan 12, 2021
4c6806a
refactor: use map instead of reduce
climba03003 Jan 12, 2021
c11a936
refactor: use done instead of next
climba03003 Jan 12, 2021
cf9bec5
refactor: group functions
climba03003 Jan 12, 2021
c66fd2c
refactor: genResponse to generateResponse
climba03003 Jan 12, 2021
4afe782
chore: remove invalid comment
climba03003 Jan 12, 2021
dd7d500
refactor: better structure
climba03003 Jan 12, 2021
66b0fca
feat: generate response according to produces
climba03003 Jan 12, 2021
85f5136
feat: use package json as default info
climba03003 Jan 12, 2021
18a31f1
refactor: better cache name
climba03003 Jan 12, 2021
f291f31
chore: add comment to address different issue
climba03003 Jan 12, 2021
4edb67b
feat: add oneOf, allOf, anyOf support in query, header, path, formData
climba03003 Jan 12, 2021
c0439b6
refactor: better argument name
climba03003 Jan 14, 2021
76f5858
feat: add cookies schema support for openapi 3
climba03003 Jan 14, 2021
30ec49e
fix: typo
climba03003 Jan 14, 2021
f09965d
Merge branch 'feat-openapi-3' of https://github.com/climba03003/fasti…
climba03003 Jan 14, 2021
b405dd4
chore: add openapi typings
climba03003 Jan 18, 2021
33bed43
docs: add openapi support docs
climba03003 Jan 18, 2021
03777ad
docs: update as suggestion
climba03003 Jan 18, 2021
35a9be8
fix: openapi
climba03003 Jan 25, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ fastify.ready(err => {
`dynamic` mode is the default one, if you use the plugin this way - swagger specification would be gathered from your routes definitions.
```js
{
// swagger 2.0 options
swagger: {
info: {
title: String,
Expand All @@ -136,14 +137,29 @@ fastify.ready(err => {
produces: [ String ],
tags: [ Object ],
securityDefinitions: Object
}
},
// openapi 3.0.3 options
// openapi: {
// info: {
// title: String,
// description: String,
// version: String,
// },
// externalDocs: Object,
// servers: [ Object ],
// components: Object,
// security: [ Object ],
// tags: [ Object ]
// }
}
```

*All the above parameters are optional.*
You can use all the properties of the [swagger specification](https://swagger.io/specification/), if you find anything missing, please open an issue or a pr!
You can use all the properties of the [swagger specification](https://swagger.io/specification/v2/) and [openapi specification](https://swagger.io/specification/), if you find anything missing, please open an issue or a pr!

fastify-swagger will generate Swagger v2 by default. If you pass the `opeanapi` option it will generate OpenAPI instead.

Example of the `fastify-swagger` usage in the `dynamic` mode is available [here](examples/dynamic.js).
Example of the `fastify-swagger` usage in the `dynamic` mode, `swagger` option is available [here](examples/dynamic-swagger.js) and `openapi` option is avaiable [here](examples/dynamic-openapi.js).
<a name="mode.static"></a>

##### options
Expand All @@ -154,6 +170,7 @@ fastify.ready(err => {
| hiddenTag | X-HIDDEN | Tag to control hiding of routes. |
| stripBasePath | true | Strips base path from routes in docs. |
| swagger | {} | Swagger configuration. |
| openapi | {} | Openapi configuration. |
| transform | null | Transform method for schema. |

##### static
Expand Down
Loading