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

@kubb/core: add banner property to output #1512

Open
nimo23 opened this issue Jan 10, 2025 · 0 comments
Open

@kubb/core: add banner property to output #1512

nimo23 opened this issue Jan 10, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@nimo23
Copy link

nimo23 commented Jan 10, 2025

What is the problem this feature would solve?

It would be nice to add the banner property to the @kubb/core output to define a default banner for all plugins that does not override the default banner. Example:

..
import type Oas from 'oas';

function getBanner(oas: Oas) {
return `/**
 * Generated from kubb.
 * Do not edit manually.
 * version: ${oas.api.info.version}
 */`
}

export default defineConfig(() => {
    return {
        name: 'my-openapi',
        ...
        output: {
        path: './src/api',
        clean: true,
        // define the default banner
        banner: (oas: Oas) => getDefaultBanner(oas)
        },
        plugins: [
            pluginOas({
                output: {
                    ...
                    // uses default banner
                }
            }),
            pluginTs({
                output: {
                    ...
                    // does not use the default banner, but the following custom one:
                    banner: () => `// my custom banner`
            },
            ..
}),

External documents/projects?

No response

What is the feature you are proposing to solve the problem?

With the default banner property, we don't have to repeat the banner property for each plugin, which makes the configuration cleaner (DRY = don't repeat yourself).

What alternatives have you considered?

No response

@nimo23 nimo23 added the enhancement New feature or request label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant