joffrey-bion / livedoc

A not-so-annotation-based documentation generator for REST and websocket services
MIT License
4 stars 2 forks source link

Add custom default values support in templates #44

Closed joffrey-bion closed 7 years ago

joffrey-bion commented 7 years ago

Currently, template generation uses property inspection for any non-primitive and non-enum type. This leads, for instance, to inspection of java.util.Date objects, which results in https://github.com/joffrey-bion/livedoc/issues/42.

We should allow for custom default values for any given class, and special cases of primitive wrapper classes and enum classes should just be pre-configured. Maybe we should consider pre-configuring Date objects as well.

ST-DDT commented 7 years ago

Maybe this could be implemed as/extended with an annotation as well. The annotation could provide example values for fields (e.x. name) like John Doe. This would also work on class level. Every time a field with that class is encountered the given example value.

@interface ApiExample {

    String value();

    ValueType type() default ValueType.TEXT/Integer/Float;

}
joffrey-bion commented 7 years ago

Very good suggestion. I don't have time to work on this right now, but I wanted to rework the templates anyway at some point, so I'll keep that in mind.

joffrey-bion commented 7 years ago

Specific issue opened for dates: https://github.com/joffrey-bion/livedoc/issues/45