diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..43370fa --- /dev/null +++ b/.npmignore @@ -0,0 +1 @@ +*.tsbuildinfo diff --git a/README.md b/README.md index f7af494..20808a0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ -![Compeller basic logo](./assets/logo.drawio.svg) # Compeller +🚨 Alpha software 🚨 + A strong typescript binding for your OpenAPI Schema that doesn't need generation. - [Compeller](#compeller) diff --git a/assets/logo.drawio.svg b/assets/logo.drawio.svg deleted file mode 100644 index eec3aa6..0000000 --- a/assets/logo.drawio.svg +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - -
-
-
- Compeller -
-
-
-
- - Compeller - -
-
-
- - - - - Viewer does not support full SVG 1.1 - - - -
diff --git a/package.json b/package.json index d4db882..974a549 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "example": "hygen compeller new --directory example", "prepack": "yarn clean && yarn build", "prepare": "husky install", - "pub:canary": "release-it patch --preRelease=alpha --npm.tag=alpha", + "pub:canary": "release-it --preRelease=alpha --npm.tag=alpha", "pub:main": "release-it patch", "release": "release-it", "test": "jest" diff --git a/src/compeller.ts b/src/compeller.ts index bdc646e..aaf5da5 100644 --- a/src/compeller.ts +++ b/src/compeller.ts @@ -31,6 +31,14 @@ export const compeller = < ) => { const path = route as string; + /** + * + * @param statusCode The response code that the API returns + * @param body The JSON body for the API that is associated with that + * response code + * + * @returns + */ const response = < R extends keyof S, SC extends T['paths'][P][M]['responses'][R]['content'][U]['schema'] @@ -42,6 +50,12 @@ export const compeller = < body: JSON.stringify(body), }); + /** + * The request validator attaches request body validation to the request + * handler for a path. + * + * @returns Ajv validation function for the inferred schema + */ const validateRequestBody = < SC extends T['paths'][P][M]['requestBody']['content'][U]['schema'] >() => { diff --git a/tsconfig.json b/tsconfig.json index bb26ef9..5f20024 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,8 @@ "include": ["src/**/*.ts"], "compilerOptions": { "outDir": "./dist", - "declaration": true + "declaration": true, + "strict": true, + "incremental": true } }