Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 1 addition & 4 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ declare namespace SerializerSelector {
options?: Options
) => SerializerCompiler;

export type SerializerCompiler = (
externalSchemas?: unknown,
options?: Options
) => Serializer;
export type SerializerCompiler = (routeDef: RouteDefinition) => Serializer;

export type Serializer = (doc: any) => string

Expand Down
5 changes: 4 additions & 1 deletion types/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import SerializerSelector, {
expectType<SerializerFactory>(factory);
const compiler = factory(externalSchemas1, {})
expectType<SerializerCompiler>(compiler);
const serializeFunc = compiler({ schema: sampleSchema })
const serializeFunc = compiler({ schema: sampleSchema, method: '', url:'', httpStatus: '' })
expectType<Serializer>(serializeFunc);

expectType<string>(serializeFunc({ name: 'hello' }))
Expand Down Expand Up @@ -88,6 +88,9 @@ expectType<SerializerFactory>(writer);
}

const endpointSchema = {
method: '',
url: '',
httpStatus: '',
schema: {
$id: 'urn:schema:endpoint',
$ref: 'urn:schema:ref'
Expand Down