-
Notifications
You must be signed in to change notification settings - Fork 23
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
Introduces "describeModel" interface. #270
Conversation
* | ||
*/ | ||
@Service("modelDescriptionService") | ||
public class ModelDescriptionService<E extends PersistentObject> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<E extends PersistentObject>
is not necessary if no instances of PersistentObject
are managed by this service.
public class ModelDescriptionService<E extends PersistentObject> { | ||
|
||
public JsonSchema getJsonSchema(Class<?> clazz) throws IOException { | ||
ObjectMapper mapper = new ObjectMapper(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a project-specific ObjectMapper
that is available as bean (if archetype has been used) and should be used here:
819bba2
to
fb903c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, one remark which you may want to take. Please merge at will.
It would be very nice if you could change the archetype to include a matching bean describeModelSearchPackages
.
|
||
JsonSchema json = modelDescriptionService.getJsonSchema(foundClass); | ||
|
||
JsonSchema json = modelDescriptionService.getJsonSchema(className); | ||
return ResultSet.success(json); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to return a ResultSet.error()
if the json
is null
. you decide.
This introduces a describe-model interface which describes any model as a json-schema.
Makes use of https://github.com/FasterXML/jackson-module-jsonSchema
Does currently not support custom serializers.