Skip to content

Conversation

@lukasjelonek
Copy link
Contributor

Motivation:

At the moment it is not possible to use media types that are not included in the static supported mediatypes list in requests and responses. This forces the users to use generic media types where more specific ones exist in their openapi specs.

This pull-request replaces the current static list of mediatypes with a registry that allows the registration of additional mediatypes.

At the moment this is an early draft of the feature and the pull request is used to provide a place for a first review.

Conformance:

The Eclipse Contributor Agreement is signed by me.
The code style will be enforced once this feature reaches a mature state.

* @return The registry.
*/
@GenIgnore
MediaTypeRegistry mediaTypes();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MediaTypeRegistry mediaTypes();
MediaTypeRegistry getMediaTypeRegistry();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In hindsight I think that this field does not have to exposed here at all.

Comment on lines 17 to 40
static DefaultMediaTypeRegistry createDefault() {
return new DefaultMediaTypeRegistry()
.register(MediaTypeRegistration.TEXT_PLAIN)
.register(MediaTypeRegistration.MULTIPART_FORM_DATA)
.register(MediaTypeRegistration.APPLICATION_JSON)
.register(MediaTypeRegistration.APPLICATION_OCTET_STREAM);
}

/**
* Creates an empty registry.
*
* @return An empty registry.
*/
static DefaultMediaTypeRegistry createEmpty() {
return new DefaultMediaTypeRegistry();
}

/**
* Registers a new MediaTypeHandler
*
* @param registration The mediatype registration.
* @return This registry for a fluent interface.
*/
DefaultMediaTypeRegistry register(MediaTypeRegistration registration);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this in DefaultMediaTypeRegistry

* @param context Whether the analyser is for a request or response.
* @return A fresh content analyser instance.
*/
ContentAnalyser createContentAnalyser(String contentType, Buffer content, ValidationContext context);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getContentAnalyser

lukasjelonek added a commit to lukasjelonek/vertx-openapi that referenced this pull request Jun 12, 2025
lukasjelonek added a commit to lukasjelonek/vertx-openapi that referenced this pull request Jun 12, 2025
@lukasjelonek
Copy link
Contributor Author

I extracted the builder-part from this PR and requested a new PR: #103

@lukasjelonek lukasjelonek force-pushed the main branch 2 times, most recently from 4e21944 to b63d3fe Compare September 11, 2025 12:13
@pk-work
Copy link
Contributor

pk-work commented Sep 19, 2025

Will be resolved with #118

@pk-work pk-work closed this Sep 19, 2025
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 this pull request may close these issues.

2 participants