Skip to content

Add additional properties to OpenApiConfig #2705

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

Closed

Conversation

msosnicki
Copy link
Contributor

Background

  • The JsonSchemaMapper and OpenApiMapper have access to OpenApiConfig. In some cases (see related smithy4s PR), there is a need to pass additional information to such mappers. This PR adds Map<String, String> additionalProperties field to enable that

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

* Sets additional non-standard config properties that might be used by other components
* @param additionalProperties Map of additional properties
*/
public void setAdditionalProperties(Map<String, String> additionalProperties) {
Copy link
Contributor

@kubukoz kubukoz Jul 17, 2025

Choose a reason for hiding this comment

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

suggestion: shall we have a method to just put into the properties, without having to pass the entire map?

i.e. void putAdditionalProperty(String key, String value)

Copy link
Contributor

Choose a reason for hiding this comment

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

also, looks like ModelAssembler allows Object values so maybe we should be as flexible here as well. String is fairly limiting, after all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, makes sense, changed so it resembles how it's done in ModelAssembler

@kstich
Copy link
Contributor

kstich commented Jul 22, 2025

Is the behavior you're looking for already filled by the JsonSchemaConfig.getExtensions(YourCustomConfig.class) method? That will populate additional fields into the YourCustomConfig class from on content that was unknown to the underlying JsonSchemaConfig when loaded.

@msosnicki
Copy link
Contributor Author

Is the behavior you're looking for already filled by the JsonSchemaConfig.getExtensions(YourCustomConfig.class) method? That will populate additional fields into the YourCustomConfig class from on content that was unknown to the underlying JsonSchemaConfig when loaded.

Sorry for late reply, the extension mechanism is exactly what is needed, thanks!

@msosnicki msosnicki closed this Aug 6, 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.

3 participants