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

fix #3286 - prioritize schema name resolving by ApiModel.value #3292

Merged
merged 1 commit into from
Sep 18, 2019

Conversation

frantuma
Copy link
Member

up to 1.5.23 release any defined JsonRootName annotation on a model takes precedence over a
defined ApiModel.value annotation on the same model, causing e.g. issues like the one described in #3286. This PR addresses this by reversing the logic in such cases.

Note this breaks default behaviour in such scenarios comparing to previous versions, as an expected effect, given that previous logic can be considered a bug, as swagger annotations must take precedence to provide full control of the resolved spec.

To maintain previous behavior for any reason, a custom model resolver can be provided:

class CustomSchemaNameResolverConverter extends ModelResolver {

        public CustomSchemaNameResolverConverter(ObjectMapper mapper) {
            super(mapper);
        }
        protected boolean prioritizeAnnotationInspectorSchemaName() {
          return true;
        }
    }
ModelConverters.getInstance().addConverter(new CustomSchemaNameResolverConverter(Json.mapper()));

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.

1 participant