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

Ensure canary will increment pre-release tag and not create a patch release #18

Merged
merged 6 commits into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.tsbuildinfo
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
31 changes: 0 additions & 31 deletions assets/logo.drawio.svg

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 14 additions & 0 deletions src/compeller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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']
>() => {
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"include": ["src/**/*.ts"],
"compilerOptions": {
"outDir": "./dist",
"declaration": true
"declaration": true,
"strict": true,
"incremental": true
}
}