Skip to content

scalar function options are not supported #280

@marcalexiei

Description

@marcalexiei

Function options are not used in the config

import { Elysia, t } from 'elysia'
import z from 'zod'
import { JSONSchema, Schema } from 'effect'

import { openapi, withHeaders } from '../src/index'

const app = new Elysia()
	.use(
		openapi({
			mapJsonSchema: {
				zod: z.toJSONSchema
			},
			scalar: {
				onBeforeRequest: ({ request }) => {
					console.info('onBeforeRequest', request.method, request.url)
				}
			}
		})
	)
	.get('/test', ({ status }) => status(204, undefined), {
		response: {
			204: z.void()
		}
	})
	.listen(3000)
  1. Run the provided code
  2. Open http://localhost:3000/openapi
  3. Open the console and perform a request

You can see that onBeforeRequest log is not present.


Type errors

Additionally, when setting scalar options a type error occurs.

It looks like that nearly all scalar properties are required:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions