fix(testing/doc-gen): Removed const in favor of enum
MODIFY
packages/middleware-io/src/io.json-schema.ts
packages/middleware-io/src/io.json-schema.ts
@@ -56,7 +56,7 @@ const IoTypes: Record<IoTag, IoConverter> = {
[IoTag.NULL]: () => ({ type: 'null' }),
- [IoTag.LITERAL]: (type: t.LiteralType<any>) => ({ const: type.value }),
+ [IoTag.LITERAL]: (type: t.LiteralType<any>) => ({ enum: [type.value] }),
[IoTag.UNION]: (type: t.UnionType<t.Any[]>) =>
type.types.every(element => getTag(element) === IoTag.LITERAL)

MODIFY
packages/middleware-io/src/specs/io.json-schema.spec.ts
packages/middleware-io/src/specs/io.json-schema.spec.ts
@@ -118,9 +118,9 @@ describe('#ioTypeToJsonSchema', () => {
});
test('supports t.literal conversion', () => {
- expect(ioTypeToJsonSchema(t.literal(30))).toEqual({ const: 30 });
- expect(ioTypeToJsonSchema(t.literal(true))).toEqual({ const: true });
- expect(ioTypeToJsonSchema(t.literal('test'))).toEqual({ const: 'test' });
+ expect(ioTypeToJsonSchema(t.literal(30))).toEqual({ enum: [30] });
+ expect(ioTypeToJsonSchema(t.literal(true))).toEqual({ enum: [true] });
+ expect(ioTypeToJsonSchema(t.literal('test'))).toEqual({ enum: ['test'] });
});
test('supports t.null conversion', () => {

MODIFY
packages/middleware-io/src/specs/io.request.middleware.spec.ts
packages/middleware-io/src/specs/io.request.middleware.spec.ts
@@ -73,7 +73,7 @@ describe('#requestValidator$', () => {
additionalProperties: true,
},
headers: {
- properties: { 'content-type': { const: 'application/json' } },
+ properties: { 'content-type': { enum: ['application/json'] } },
required: ['content-type'],
type: 'object',
additionalProperties: true

fix(testing/doc-gen): Removed const in favor of enum