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

GH-232 Allow reference to a model from OpenApiContentProperty #232

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

f1qwase
Copy link
Contributor

@f1qwase f1qwase commented Sep 30, 2024

Hi @dzikoysk,
I faced a need to send complex data along with files in a single request.
OpenAPI specification allows it: https://swagger.io/docs/specification/v3_0/describing-request-body/multipart-requests/

Currently javalin-openapi only allows description of primitive types properties in multipart/form content using fields type and format.
This PR introduces a from property to OpenApiPropertyContent annotation. The new from property is treated the same way as in OpenApiContent (it has higher priority than type and format and registers referenced type globally).

What do you think?

@dzikoysk dzikoysk changed the title Allow reference to a model from OpenApiContentProperty GH-232 Allow reference to a model from OpenApiContentProperty Sep 30, 2024
@dzikoysk
Copy link
Member

dzikoysk commented Sep 30, 2024

Yeah, makes sense - thanks for the PR! :) Could you quickly check if it doesn't infinitely loop when a class with self-reference is used? Like:

data class Loop(val self: Loop)

It might be a good idea to add it to the existing example (or tests), just in case 😅

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

Successfully merging this pull request may close these issues.

2 participants