springfox / springfox

Automated JSON API documentation for API's built with Spring
http://springfox.io
Apache License 2.0
5.93k stars 1.54k forks source link

How to make custom yaml example? #3055

Closed 3DRaven closed 4 years ago

3DRaven commented 5 years ago

Hi! I used 2.9.2 version of springfox

In my project is not working @ApiModel and @Example annotations for generation of custom example.

I used this yaml spec (it part of full spec):

`paths: /v1/logic: post: description: | get vcsp flags of account security:

I used this code to rewrite default models mapper and using custom example value in swagger-ui

@Component @Primary public class CustomExampleModelMapper extends ModelMapper { @Override public Map<String, Model> mapModels(Map<String, springfox.documentation.schema.Model> from) { Map<String, Model> mapModels = super.mapModels(from); mapModels.get("Processor").setExample("test: 1\ntest1: 2"); return mapModels; } }

But in swagger-ui i see just string as:

изображение

How to place custom text in example in swagger-ui? I need to insert custom yaml in swagger-ui.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue has been automatically closed because it has not had recent activity. Please re-open a new issue if this is still an issue.