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

[SCIMPLE-93] Set type=reference, when referenceTypes are set #425

Closed
wants to merge 1 commit into from

Conversation

tm-drtina
Copy link
Contributor

https://issues.apache.org/jira/browse/SCIMPLE-93

Fields that have referenceTypes set should have type reference. Previously we set type=reference for field type, but it should be on field ref

          {
            "name" : "value",
            "type" : "reference",
            "referenceTypes" : ["external"],
            "multiValued" : false,
            "description" : "URL of a photo of the User.",
            "required" : false,
            "caseExact" : false,
            "mutability" : "readWrite",
            "returned" : "default",
            "uniqueness" : "none"
          },

source: https://datatracker.ietf.org/doc/html/rfc7643#section-8.7.1 (page 59)

A reference has a "referenceTypes" attribute...
...
By convention, a reference is commonly represented as a "$ref" sub-attribute in complex or multi-valued attributes; however, this is OPTIONAL.

source: https://datatracker.ietf.org/doc/html/rfc7643#section-2.3.7

The condition is not very nice, since the default is a list with one empty string...

@bdemers
Copy link
Member

bdemers commented Nov 29, 2023

This is great! Thanks @tm-drtina!

Any ideas for a test or two? If you don't have time to implement them, that's understandable, but a little pseudo code, will help too!

@tm-drtina
Copy link
Contributor Author

I saw there were some tests for schema: https://github.com/apache/directory-scimple/blob/develop/scim-spec/scim-spec-schema/src/test/java/org/apache/directory/scim/spec/schema/SchemaTest.java

But I think the simplest one would be to query /v2/Schemas and compare the result with the static jsons, which are already in the test resources. It's been a while since I last used in Java, but I can take a look :)

bdemers added a commit that referenced this pull request Dec 15, 2023
The attributes of each are slightly different

Fixes: #425
bdemers added a commit that referenced this pull request Dec 15, 2023
The attributes of each are slightly different

Fixes: #425
@bdemers
Copy link
Member

bdemers commented Dec 15, 2023

Fixed in: #452

Thanks again @tm-drtina! this was really helpful and me track down a related issue!

@bdemers bdemers closed this Dec 15, 2023
bdemers added a commit that referenced this pull request Dec 15, 2023
* Add test for Schema generation from Annotations

While working on the PatchGenerator I noticed a bug in the type detection.
This change adds tests and simplifies related logic

* Replaces ResourceReference with more specific GroupMembership/UserGroup

The attributes of each are slightly different

Fixes: #425
@tm-drtina tm-drtina deleted the fix-reference-types branch December 18, 2023 14:54
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.

2 participants