@eropple/fastify-openapi3
Advanced tools
Comparing version 0.2.0 to 0.3.0
import { RouteOptions } from "fastify"; | ||
export declare type OperationIdFn = (route: RouteOptions) => string; | ||
export type OperationIdFn = (route: RouteOptions) => string; | ||
export declare const defaultOperationIdFn: OperationIdFn; |
import { CallbacksObject, ExternalDocumentationObject, InfoObject, OpenApiBuilder } from "openapi3-ts"; | ||
import { OperationIdFn } from "./operation-helpers.js"; | ||
export declare type OASBuilderFn = (oas: OpenApiBuilder) => void; | ||
export type OASBuilderFn = (oas: OpenApiBuilder) => void; | ||
export interface OAS3PluginPublishOptions { | ||
@@ -67,6 +67,6 @@ /** | ||
} | ||
export declare type OAS3ResponseTable<T> = { | ||
export type OAS3ResponseTable<T> = { | ||
[k: string]: T; | ||
}; | ||
export declare type OAS3RouteResponseFields = { | ||
export type OAS3RouteResponseFields = { | ||
description: string; | ||
@@ -73,0 +73,0 @@ }; |
@@ -9,3 +9,3 @@ import { OpenAPIObject } from "openapi3-ts"; | ||
*/ | ||
export declare type OASTransformFunction = (oas: OpenAPIObject) => OpenAPIObject | Promise<OpenAPIObject>; | ||
export type OASTransformFunction = (oas: OpenAPIObject) => OpenAPIObject | Promise<OpenAPIObject>; | ||
/** | ||
@@ -12,0 +12,0 @@ * Walks the OAS spec to find the plugin's extension tag on all schemas that it can reach |
import { OpenAPIObject, OperationObject, PathItemObject, ReferenceObject, SchemaObject } from "openapi3-ts"; | ||
import { TaggedSchema } from "../schemas.js"; | ||
export declare type TaggedSchemaObject = SchemaObject & TaggedSchema; | ||
export declare type MaybeSchemaHolder = { | ||
export type TaggedSchemaObject = SchemaObject & TaggedSchema; | ||
export type MaybeSchemaHolder = { | ||
schema?: SchemaObject | ReferenceObject; | ||
}; | ||
export declare type SchemaHolder = { | ||
export type SchemaHolder = { | ||
schema: SchemaObject | ReferenceObject; | ||
@@ -9,0 +9,0 @@ }; |
{ | ||
"name": "@eropple/fastify-openapi3", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"author": "Ed Ropple", | ||
@@ -26,8 +26,8 @@ "license": "LGPL-3.0", | ||
"dependencies": { | ||
"@seriousme/openapi-schema-validator": "^1.7.0", | ||
"@sinclair/typebox": "^0.23.5", | ||
"ajv": "^8.11.0", | ||
"@seriousme/openapi-schema-validator": "1.7.1", | ||
"@sinclair/typebox": "^0.25.24", | ||
"ajv": "^8.12.0", | ||
"change-case": "4.1.2", | ||
"fastify": "^4.1.0", | ||
"fastify-plugin": "3.0.1", | ||
"fastify": "^4.14.1", | ||
"fastify-plugin": "^4.5.0", | ||
"js-yaml": "^4.1.0", | ||
@@ -39,15 +39,15 @@ "openapi-ts": "^0.3.4", | ||
"devDependencies": { | ||
"@types/jest": "^28.1.3", | ||
"@types/jest": "^29.4.0", | ||
"@types/js-yaml": "^4.0.5", | ||
"@types/node": "^18.0.0", | ||
"@typescript-eslint/eslint-plugin": "^5.29.0", | ||
"@typescript-eslint/parser": "^5.29.0", | ||
"eslint": "^8.18.0", | ||
"jest": "^28.1.1", | ||
"prettier": "^2.7.1", | ||
"ts-jest": "^28.0.5", | ||
"ts-node": "^10.8.1", | ||
"typedoc": "^0.22.17", | ||
"typescript": "^4.7.4" | ||
"@types/node": "^18.14.6", | ||
"@typescript-eslint/eslint-plugin": "^5.54.1", | ||
"@typescript-eslint/parser": "^5.54.1", | ||
"eslint": "^8.35.0", | ||
"jest": "^29.5.0", | ||
"prettier": "^2.8.4", | ||
"ts-jest": "^29.0.5", | ||
"ts-node": "^10.9.1", | ||
"typedoc": "^0.23.26", | ||
"typescript": "^4.9.5" | ||
} | ||
} |
@@ -7,7 +7,7 @@ # `@eropple/fastify-openapi3` # | ||
## What is it? ## | ||
This is a library to help you generate [OpenAPI 3.1](https://spec.openapis.org/oas/v3.1.0)-compliant specs from your [Fastify](https://www.fastify.io/) app. Others exist, but to my mind have some usability issues: lack of effective type inference, meh developer mouthfeel, and so on. Because of my [own](https://github.com/modern-project/modern-ruby) [background](https://github.com/eropple/nestjs-openapi3) in building OpenAPI libraries, and my growing appreciation for Fastify, I decided to take a crack at it. | ||
This is a library to help you generate [OpenAPI 3.1](https://spec.openapis.org/oas/v3.1.0)-compliant specs from your [Fastify](https://www.fastify.io/) app. Others exist, but to my mind don't scratch the itch that the best OAS tooling does: making it faster and easier to create correct specs and valid API clients from those specs. Because of my [own](https://github.com/modern-project/modern-ruby) [background](https://github.com/eropple/nestjs-openapi3) in building OpenAPI libraries, and my growing appreciation for Fastify, I decided to take a crack at it. | ||
This library presupposes that you use [`@sinclair/typebox`](https://github.com/sinclairzx81/typebox) to define the JSON schema used in your requests, and from that JSON Schema derives types. (Ergonomics for non-TypeScript users is specifically out-of-scope.) It will walk all your routes, determine your schema, and extract and deduplicate those schemas to present a relatively clean and easy-to-use OpenAPI document. It'll then also serve JSON and YAML versions of your specification, as well as host an interactive API explorer with try-it-out features courtesy of [Rapidoc](https://mrin9.github.io/RapiDoc/). | ||
**Fair warning:** This library is in Extremely Early Access(tm) and while the functionality that's here does work, there's some functionality that _doesn't_ exist. The stuff that stands out to me personally can be found in [TODO.md](https://github.com/eropple/fastify-openapi3/blob/main/TODO.md), including a short list of things this plugin _won't_ do. | ||
**Fair warning:** This library is in Early Access(tm) and while the functionality that's here does work, there's some functionality that _doesn't_ exist. The stuff that stands out to me personally can be found in [TODO.md](https://github.com/eropple/fastify-openapi3/blob/main/TODO.md), including a short list of things this plugin _won't_ do. | ||
@@ -14,0 +14,0 @@ ## Usage ## |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2224
159386
+ Added@sinclair/typebox@0.25.24(transitive)
+ Addedfastify-plugin@4.5.1(transitive)
- Removed@sinclair/typebox@0.23.5(transitive)
- Removedfastify-plugin@3.0.1(transitive)
Updated@sinclair/typebox@^0.25.24
Updatedajv@^8.12.0
Updatedfastify@^4.14.1
Updatedfastify-plugin@^4.5.0