Skip to content

Commit

Permalink
Merge branch 'prep-v20' into mw-class
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTail committed May 25, 2024
2 parents 1baf983 + 18e0fa6 commit 485196d
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 28 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### v20.0.0

- Method `createLogger()` removed — use `new BuiltinLogger()` instead if needed;
- Publicly exposed types are corrected for better constraints:
- `IOSchema` type: type arguments generalized to the most wide type possible;
- The `requestProps`, `responseProps` and `loggerProps` properties of the `testEndpoint()` method's argument:
Expand Down
8 changes: 0 additions & 8 deletions src/builtin-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,3 @@ export class BuiltinLogger implements AbstractLogger {
return new BuiltinLogger({ ...this.config, ctx });
}
}

/**
* @desc Alias for "new BuiltinLogger()"
* @deprecated use new BuiltinLogger()
* @todo remove in v20
* */
export const createLogger = (config: BuiltinLoggerConfig) =>
new BuiltinLogger(config);
3 changes: 1 addition & 2 deletions src/documentation-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1020,8 +1020,7 @@ export const depictSecurityRefs = (
return depictSecurityRefs({ or: [container] });
};

// @todo depictBody
export const depictRequest = ({
export const depictBody = ({
method,
path,
schema,
Expand Down
4 changes: 2 additions & 2 deletions src/documentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { mapLogicalContainer } from "./logical-container";
import { Method } from "./method";
import {
OpenAPIContext,
depictRequest,
depictBody,
depictRequestParams,
depictResponse,
depictSecurity,
Expand Down Expand Up @@ -221,7 +221,7 @@ export class Documentation extends OpenApiBuilder {
}

const requestBody = inputSources.includes("body")
? depictRequest({
? depictBody({
...commons,
paramNames: pluck("name", depictedParams),
schema: endpoint.getSchema("input"),
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export {
getMessageFromError,
getStatusCodeFromError,
} from "./common-helpers";
export { createLogger, BuiltinLogger } from "./builtin-logger";
export { BuiltinLogger } from "./builtin-logger";
export { Middleware } from "./middleware";
export {
createResultHandler,
Expand Down
3 changes: 0 additions & 3 deletions tests/unit/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ exports[`Index Entrypoint > exports > attachRouting should have certain value 1`

exports[`Index Entrypoint > exports > createConfig should have certain value 1`] = `[Function]`;

exports[`Index Entrypoint > exports > createLogger should have certain value 1`] = `[Function]`;

exports[`Index Entrypoint > exports > createResultHandler should have certain value 1`] = `[Function]`;

exports[`Index Entrypoint > exports > createServer should have certain value 1`] = `[Function]`;
Expand Down Expand Up @@ -102,7 +100,6 @@ exports[`Index Entrypoint > exports > should have certain entities exposed 1`] =
"getExamples",
"getMessageFromError",
"getStatusCodeFromError",
"createLogger",
"BuiltinLogger",
"Middleware",
"createResultHandler",
Expand Down
13 changes: 1 addition & 12 deletions tests/unit/builtin-logger.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ import {
test,
vi,
} from "vitest";
import {
BuiltinLogger,
BuiltinLoggerConfig,
createLogger,
} from "../../src/builtin-logger";
import { BuiltinLogger, BuiltinLoggerConfig } from "../../src/builtin-logger";

describe("BuiltinLogger", () => {
beforeAll(() => {
Expand Down Expand Up @@ -118,11 +114,4 @@ describe("BuiltinLogger", () => {
expect(logSpy.mock.calls).toMatchSnapshot();
});
});

/** @todo remove in v20 */
describe("createLogger() alias", () => {
test("should return instance of BuiltinLogger", () => {
expect(createLogger({ level: "debug" })).toBeInstanceOf(BuiltinLogger);
});
});
});

0 comments on commit 485196d

Please sign in to comment.