scim2 icon indicating copy to clipboard operation
scim2 copied to clipboard

Ignoring unknown fields?

Open asaf opened this issue 6 years ago • 4 comments

Hey guys,

Question, we have under the 'meta' section some extra fields, when retrieving a resource we get:

java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "foo" (class com.unboundid.scim2.common.types.Meta), not marked as ignorable (5 known properties: "resourceType", "location", "lastModified", "created", "version"])

We do have in our schema a description of these fields but I guess the library doesn't consult with the schema rather just try to deserialize the Meta.class object,

Is there any way to ignore unknown fields or make the retrieve be aware of them somehow?

Another option would be to extends the resources to fit to our own needs and override the 'Meta' object (in case you are willing to make the Meta class not a final one)

Thanks

asaf avatar Aug 08 '17 15:08 asaf

The models included in the SDK strictly adhere to the SCIM 2 standard by default, which does not allow extending the meta attribute. There are a 2 options:

  1. If you don't need to access the extra fields in the meta attribute, you can set the Jackson to ignore unknown properties with:
JsonUtils.setCustomMapperFactor(
  new MapperFactory().setDeserializationCustomFeatures(
    Collections.singletonMap(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)))
  1. If you need access to the extra fields, I'd suggest you create your own model classes based on the standard ones in the SDK to accommodate your use cases.

digitalperk avatar Aug 14 '17 18:08 digitalperk

@digitalperk I think it's a hard decision, please reconsider as rfc7643 doesn't explicitly denies this,

We created our own model classes but since Meta is referenced in the ScimResource interface it is impossible to provide our own Meta object unless it extends from Meta.

asaf avatar Aug 15 '17 19:08 asaf

Thanks for the reply. I've created an internal JIRA issue to track the concern and to get additional feedback on the proposal. There is no estimated time for resolution as the issue needs to be reviewed and prioritized.

digitalperk avatar Aug 16 '17 22:08 digitalperk

@digitalperk No problem, thanks

asaf avatar Aug 17 '17 12:08 asaf