Skip to content

Conversation

rpdai
Copy link
Contributor

@rpdai rpdai commented Sep 11, 2013

With this added functionality, the following becomes possible:

import javax.validation.constraints.Min;
import com.fasterxml.jackson.databind.BeanProperty;
import com.fasterxml.jackson.module.jsonSchema.types.IntegerSchema;

public class CrudIntegerSchema extends IntegerSchema {

    @Override
    public void enrichWithBeanProperty(BeanProperty beanProperty) {
        Min minimum = beanProperty.getAnnotation(Min.class);
        if (minimum != null) {
            this.setMinimum((double)minimum.value());
        }

    }
}

Bean validation, documentation strings, and custom schema annotation support become achievable.

This resolves #18

@cowtowncoder
Copy link
Member

Ok this looks promising, thank you! I will need to read it with bit more thought, but it sounds plausible.
I will also need to see if additional method(s) could lead to deprecation of older ones.

@rpdai
Copy link
Contributor Author

rpdai commented Sep 11, 2013

Cool!

BTW once the API is settled on, I'm happy to look at adding support for bean validation annotations to the module or as extension module, if that'd be of value 👷

cowtowncoder added a commit that referenced this pull request Sep 12, 2013
Support enriching schema objects with property-specific information of a bean
@cowtowncoder cowtowncoder merged commit 070ab62 into FasterXML:master Sep 12, 2013
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.

Mechanism required to customize schema for object property
2 participants