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

parser-v2: Extend DeserializationUtils methods to enable providing a custom YAMLMapper #1935

Merged

Conversation

CalemRoelofsSB
Copy link
Contributor

This PR adds the possibility to set a custom YAML mapper for parsing OAS 2.0 documents with DeserializationUtils methods.

Copy link
Member

@frantuma frantuma left a comment

Choose a reason for hiding this comment

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

I would probably provide an option to set the YAMLFactory instead of the whole mapper, using feature provided by swagger-api/swagger-core#4397

This is because allowing to pass an arbitrary mapper with wrong or absent "Swagger configuration" would result in errors(e.g. when not cloning Yaml.mapper() or using ObjectMapperFactory) .

That said, I don't see evident issues except the above

}

private static Options options = new Options();

private static final Logger LOGGER = LoggerFactory.getLogger(DeserializationUtils.class);

private static ObjectMapper YAML_MAPPER = Yaml.mapper();
Copy link
Member

Choose a reason for hiding this comment

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

Would name it yamlMapper or something..

@CalemRoelofsSB
Copy link
Contributor Author

@frantuma totally agree, have updated it now to accept a YAMLFactory and create the mapper using it from the ObjectMapperFactory in swagger-core

@CalemRoelofsSB CalemRoelofsSB requested a review from frantuma May 26, 2023 08:49
@CalemRoelofsSB CalemRoelofsSB merged commit 0eb6f81 into v1 May 29, 2023
@CalemRoelofsSB CalemRoelofsSB deleted the feature/extend-DeserializationUtils-with-custom-yaml-mapper branch May 29, 2023 07:14
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