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

Consider using a DSLMarker annotation #102

Open
jogro opened this issue Apr 25, 2023 · 1 comment
Open

Consider using a DSLMarker annotation #102

jogro opened this issue Apr 25, 2023 · 1 comment

Comments

@jogro
Copy link

jogro commented Apr 25, 2023

I think your DSL could benefit greatly from using a DSLMarker annotation.

Consider defining an annotation like:

@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE, AnnotationTarget.FUNCTION)
@DslMarker
annotation class OpenApiDsl

Then annotate the API receiver lambdas like:

fun OpenAPI.paths(init: @OpenApiDsl Paths.() -> Unit) {
    paths = paths ?: Paths()
    paths.init()
}

Sadly, this could potentially break existing code.

@derveloper
Copy link
Owner

Hi jogro,

thanks again for your issue.
Feel free to create a PR, I'm more than happy to merge it and create a new release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants