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

Generated OpenAPI spec is not compliant #88

Closed
Rattlyy opened this issue Nov 1, 2024 · 1 comment · Fixed by #95
Closed

Generated OpenAPI spec is not compliant #88

Rattlyy opened this issue Nov 1, 2024 · 1 comment · Fixed by #95
Milestone

Comments

@Rattlyy
Copy link
Contributor

Rattlyy commented Nov 1, 2024

https://github.com/codeborne/klite/blob/2f898f442d90f5d70fe6ea3b101dde1e2e1bf673/openapi/src/OpenAPI.kt#L90C1-L90C35

This writes the enum name in all caps, "QUERY" etc. This isn't compliant to OpenAPI spec and most codegens will ignore the parameters.

@Rattlyy
Copy link
Contributor Author

Rattlyy commented Nov 25, 2024

Hotfix:

val jackson = kliteJsonMapper {
            this.addModules(SimpleModule(
                "enum hotfix"
            ).addSerializer<ParameterIn>(ParameterIn::class.java,
                object : JsonSerializer<ParameterIn>() {
                    override fun serialize(
                        value: ParameterIn,
                        gen: JsonGenerator,
                        serializers: SerializerProvider
                    ) {
                        gen.writeString(value.toString().lowercase())
                    }
                }
            ))
        }

        use(JsonBody(jackson))

angryziber added a commit that referenced this issue Dec 13, 2024
…ich will respect Swagger's ParameterIn and other enums toString() implementation (which is lower-case)
@angryziber angryziber added this to the 1.6.10 milestone Dec 15, 2024
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

Successfully merging a pull request may close this issue.

2 participants