Skip to content
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

Ignoring unknown fields? #81

Open
asaf opened this issue Aug 8, 2017 · 4 comments
Open

Ignoring unknown fields? #81

asaf opened this issue Aug 8, 2017 · 4 comments

Comments

@asaf
Copy link

asaf commented Aug 8, 2017

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

@digitalperk
Copy link
Collaborator

digitalperk commented Aug 14, 2017

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.

@asaf
Copy link
Author

asaf commented Aug 15, 2017

@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.

@digitalperk
Copy link
Collaborator

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 digitalperk reopened this Aug 16, 2017
@asaf
Copy link
Author

asaf commented Aug 17, 2017

@digitalperk
No problem, thanks

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

No branches or pull requests

2 participants